mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-01 01:12:43 -05:00
fix: a malformed tool call with Tool Search on ends tool use for the rest of the reply (#33872)
With Tool Search on, when the model sent a broken call for a tool Tool Search had not loaded yet (arguments that were not a JSON object, or a list of tool calls that was empty or in the wrong format), Open WebUI handled it like an unfinished model response and the rest of the reply ran without any tools. Now the model gets a tool error back, like it does for an unknown tool name, and can retry with its tools. Only a model response that really was cut off still ends tool use. Fixes #33871
This commit is contained in:
1 parent
9c9e7f0f09
commit
06ff3f9195
1 file changed
+4
-1
@@ -5854,7 +5854,10 @@ async def streaming_chat_response_handler(response, ctx):
|
||||
else f'Error: Tool "{item["name"]}" not found.'
|
||||
)
|
||||
blocked = tool_repetition_error(item, tool_history)
|
||||
stop_reason = stop_reason or round_error or blocked or tool_call.get('execution_error')
|
||||
is_incomplete = tool_call.get('execution_error') == INCOMPLETE_CALL_ERROR
|
||||
stop_reason = (
|
||||
stop_reason or round_error or blocked or (INCOMPLETE_CALL_ERROR if is_incomplete else None)
|
||||
)
|
||||
error = f'Error: {round_error}' if round_error else error or blocked
|
||||
if error:
|
||||
tool_history.append(item)
|
||||
|
||||
Reference in new issue
Block a user