mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
enh: more robust tool calling
This commit is contained in:
parent
0b38584e52
commit
37853d6a26
@ -439,9 +439,15 @@ async def chat_completion_tools_handler(
|
|||||||
tool_function_params = result.get("parameters", {})
|
tool_function_params = result.get("parameters", {})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tool_output = await tools[tool_function_name]["callable"](
|
tool_function = tools[tool_function_name]["callable"]
|
||||||
**tool_function_params
|
sig = inspect.signature(tool_function)
|
||||||
)
|
tool_function_params = {
|
||||||
|
k: v
|
||||||
|
for k, v in tool_function_params.items()
|
||||||
|
if k in sig.parameters
|
||||||
|
}
|
||||||
|
tool_output = await tool_function(**tool_function_params)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
tool_output = str(e)
|
tool_output = str(e)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user