mirror of
https://github.com/open-webui/open-webui.git
synced 2025-04-12 05:49:05 +02:00
fix: update chat completion tools handler to use parameters from spec fixing defaults always used
This commit is contained in:
parent
1173459eee
commit
d862295a05
@ -189,17 +189,11 @@ async def chat_completion_tools_handler(
|
||||
tool_function_params = tool_call.get("parameters", {})
|
||||
|
||||
try:
|
||||
required_params = (
|
||||
tools[tool_function_name]
|
||||
.get("spec", {})
|
||||
.get("parameters", {})
|
||||
.get("required", [])
|
||||
)
|
||||
spec = tools[tool_function_name].get("spec", {})
|
||||
allowed_params = spec.get("parameters", {}).get("properties", {}).keys()
|
||||
tool_function = tools[tool_function_name]["callable"]
|
||||
tool_function_params = {
|
||||
k: v
|
||||
for k, v in tool_function_params.items()
|
||||
if k in required_params
|
||||
k: v for k, v in tool_function_params.items() if k in allowed_params
|
||||
}
|
||||
tool_output = await tool_function(**tool_function_params)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user