mirror of
https://github.com/open-webui/open-webui.git
synced 2025-04-11 21:39:07 +02:00
fix: tools not working
This commit is contained in:
parent
565ea92693
commit
badbe4ea06
@ -439,10 +439,17 @@ async def chat_completion_tools_handler(
|
||||
tool_function_params = result.get("parameters", {})
|
||||
|
||||
try:
|
||||
required_params = (
|
||||
tools[tool_function_name]
|
||||
.get("spec", {})
|
||||
.get("parameters", {})
|
||||
.get("required", [])
|
||||
)
|
||||
tool_function = tools[tool_function_name]["callable"]
|
||||
sig = inspect.signature(tool_function)
|
||||
tool_function_params = {
|
||||
k: v for k, v in tool_function_params.items() if k in sig.parameters
|
||||
k: v
|
||||
for k, v in tool_function_params.items()
|
||||
if k in required_params
|
||||
}
|
||||
tool_output = await tool_function(**tool_function_params)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user