mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 19:37:47 +01:00
Some models produce almost correct json during function calling, but with additional data before of after it. This solves it.
This commit is contained in:
@@ -440,6 +440,7 @@ async def chat_completion_tools_handler(
|
||||
if not content:
|
||||
return body, {}
|
||||
|
||||
content = content[content.find("{") : content.rfind("}") + 1]
|
||||
result = json.loads(content)
|
||||
|
||||
tool_function_name = result.get("name", None)
|
||||
|
||||
Reference in New Issue
Block a user