mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-06-27 15:56:28 +00:00
added logging and ui context for bad requests of tool callings
This commit is contained in:
parent
4c9e9b7a9c
commit
0cd24c5ec1
@ -5929,15 +5929,15 @@ UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T1999987800"] = "We tried to
|
|||||||
-- We tried to communicate with the LLM provider '{0}' (type={1}). You might not be able to use this provider from your location. The provider message is: '{2}'
|
-- We tried to communicate with the LLM provider '{0}' (type={1}). You might not be able to use this provider from your location. The provider message is: '{2}'
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T2107463087"] = "We tried to communicate with the LLM provider '{0}' (type={1}). You might not be able to use this provider from your location. The provider message is: '{2}'"
|
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T2107463087"] = "We tried to communicate with the LLM provider '{0}' (type={1}). You might not be able to use this provider from your location. The provider message is: '{2}'"
|
||||||
|
|
||||||
-- The tool calling request failed with status code {0}. The provider message is: '{1}'
|
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T2584985559"] = "The tool calling request failed with status code {0}. The provider message is: '{1}'"
|
|
||||||
|
|
||||||
-- We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'
|
-- We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3014737766"] = "We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'"
|
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3014737766"] = "We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'"
|
||||||
|
|
||||||
-- We tried to communicate with the LLM provider '{0}' (type={1}). Even after {2} retries, there were some problems with the request. The provider message is: '{3}'.
|
-- We tried to communicate with the LLM provider '{0}' (type={1}). Even after {2} retries, there were some problems with the request. The provider message is: '{3}'.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3049689432"] = "We tried to communicate with the LLM provider '{0}' (type={1}). Even after {2} retries, there were some problems with the request. The provider message is: '{3}'."
|
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3049689432"] = "We tried to communicate with the LLM provider '{0}' (type={1}). Even after {2} retries, there were some problems with the request. The provider message is: '{3}'."
|
||||||
|
|
||||||
|
-- The tool calling request failed with status code {0}. See the logs for details.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3117779001"] = "The tool calling request failed with status code {0}. See the logs for details."
|
||||||
|
|
||||||
-- Tried to communicate with the LLM provider '{0}'. There were some problems with the request. The provider message is: '{1}'
|
-- Tried to communicate with the LLM provider '{0}'. There were some problems with the request. The provider message is: '{1}'
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3573577433"] = "Tried to communicate with the LLM provider '{0}'. There were some problems with the request. The provider message is: '{1}'"
|
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3573577433"] = "Tried to communicate with the LLM provider '{0}'. There were some problems with the request. The provider message is: '{1}'"
|
||||||
|
|
||||||
|
|||||||
@ -5934,6 +5934,9 @@ UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T2107463087"] = "Wir haben ve
|
|||||||
-- The tool calling request failed with status code {0}. The provider message is: '{1}'
|
-- The tool calling request failed with status code {0}. The provider message is: '{1}'
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T2584985559"] = "Die Tool-Aufrufanfrage ist mit dem Statuscode {0} fehlgeschlagen. Die Meldung des Anbieters lautet: „{1}“"
|
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T2584985559"] = "Die Tool-Aufrufanfrage ist mit dem Statuscode {0} fehlgeschlagen. Die Meldung des Anbieters lautet: „{1}“"
|
||||||
|
|
||||||
|
-- The tool calling request failed with status code {0}. See the logs for details.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3117779001"] = "Die Tool-Aufrufanfrage ist mit dem Statuscode {0} fehlgeschlagen. Details finden Sie in den Logs."
|
||||||
|
|
||||||
-- We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'
|
-- We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3014737766"] = "Wir haben versucht, mit dem LLM-Anbieter „{0}“ (Typ={1}) zu kommunizieren. Etwas wurde nicht gefunden. Die Nachricht des Anbieters lautet: „{2}“"
|
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3014737766"] = "Wir haben versucht, mit dem LLM-Anbieter „{0}“ (Typ={1}) zu kommunizieren. Etwas wurde nicht gefunden. Die Nachricht des Anbieters lautet: „{2}“"
|
||||||
|
|
||||||
|
|||||||
@ -5934,6 +5934,9 @@ UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T2107463087"] = "We tried to
|
|||||||
-- The tool calling request failed with status code {0}. The provider message is: '{1}'
|
-- The tool calling request failed with status code {0}. The provider message is: '{1}'
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T2584985559"] = "The tool calling request failed with status code {0}. The provider message is: '{1}'"
|
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T2584985559"] = "The tool calling request failed with status code {0}. The provider message is: '{1}'"
|
||||||
|
|
||||||
|
-- The tool calling request failed with status code {0}. See the logs for details.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3117779001"] = "The tool calling request failed with status code {0}. See the logs for details."
|
||||||
|
|
||||||
-- We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'
|
-- We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3014737766"] = "We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'"
|
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::BASEPROVIDER::T3014737766"] = "We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'"
|
||||||
|
|
||||||
|
|||||||
@ -629,6 +629,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
|||||||
chatThread.RuntimeComponent,
|
chatThread.RuntimeComponent,
|
||||||
chatThread.RuntimeSelectedToolIds,
|
chatThread.RuntimeSelectedToolIds,
|
||||||
this.Provider.GetModelCapabilities(chatModel),
|
this.Provider.GetModelCapabilities(chatModel),
|
||||||
|
this.Provider.GetConfidence(settingsManager).Level,
|
||||||
settingsManager.IsToolSelectionVisible(chatThread.RuntimeComponent));
|
settingsManager.IsToolSelectionVisible(chatThread.RuntimeComponent));
|
||||||
|
|
||||||
if (runnableTools.Count > 0)
|
if (runnableTools.Count > 0)
|
||||||
@ -653,13 +654,19 @@ public abstract class BaseProvider : IProvider, ISecretId
|
|||||||
var response = await this.ExecuteChatCompletionRequest(requestDto, requestPath, requestedSecret, headersAction, token);
|
var response = await this.ExecuteChatCompletionRequest(requestDto, requestPath, requestedSecret, headersAction, token);
|
||||||
var responseMessage = response?.Choices.FirstOrDefault()?.Message;
|
var responseMessage = response?.Choices.FirstOrDefault()?.Message;
|
||||||
if (responseMessage is null)
|
if (responseMessage is null)
|
||||||
|
{
|
||||||
|
currentAssistantContent!.ToolRuntimeStatus = new();
|
||||||
|
await currentAssistantContent.StreamingEvent();
|
||||||
yield break;
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
if (responseMessage.ToolCalls.Count == 0)
|
if (responseMessage.ToolCalls.Count == 0)
|
||||||
{
|
{
|
||||||
currentAssistantContent!.ToolRuntimeStatus = new();
|
currentAssistantContent!.ToolRuntimeStatus = new();
|
||||||
if (!string.IsNullOrWhiteSpace(responseMessage.Content))
|
if (!string.IsNullOrWhiteSpace(responseMessage.Content))
|
||||||
yield return new ContentStreamChunk(responseMessage.Content, []);
|
yield return new ContentStreamChunk(responseMessage.Content, []);
|
||||||
|
else if (toolCallCount > 0)
|
||||||
|
yield return new ContentStreamChunk("The model completed the tool call but did not return a final answer.", []);
|
||||||
|
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
@ -763,7 +770,14 @@ public abstract class BaseProvider : IProvider, ISecretId
|
|||||||
|
|
||||||
using var response = await this.httpClient.SendAsync(request, token);
|
using var response = await this.httpClient.SendAsync(request, token);
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var responseBody = await response.Content.ReadAsStringAsync(token);
|
||||||
|
this.logger.LogError("Tool calling chat completion request failed with status code {ResponseStatusCode} and body: '{ResponseBody}'.", response.StatusCode, responseBody);
|
||||||
|
await MessageBus.INSTANCE.SendError(new(
|
||||||
|
Icons.Material.Filled.Build,
|
||||||
|
string.Format(TB("The tool calling request failed with status code {0}. See the logs for details."), (int)response.StatusCode)));
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return await response.Content.ReadFromJsonAsync<ChatCompletionResponse>(JSON_SERIALIZER_OPTIONS, token);
|
return await response.Content.ReadFromJsonAsync<ChatCompletionResponse>(JSON_SERIALIZER_OPTIONS, token);
|
||||||
}
|
}
|
||||||
@ -1077,4 +1091,3 @@ public abstract class BaseProvider : IProvider, ISecretId
|
|||||||
_ => string.Empty,
|
_ => string.Empty,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user