From 91315b42c0a44f449446ca6e867f5699c0076ed2 Mon Sep 17 00:00:00 2001 From: Samuel Date: Wed, 6 Nov 2024 19:58:18 +0000 Subject: [PATCH] fix for openai.com requests --- backend/open_webui/apps/openai/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/open_webui/apps/openai/main.py b/backend/open_webui/apps/openai/main.py index 70cefb29c..ae84300ee 100644 --- a/backend/open_webui/apps/openai/main.py +++ b/backend/open_webui/apps/openai/main.py @@ -421,6 +421,10 @@ async def generate_chat_completion( if "max_tokens" in payload and "max_completion_tokens" in payload: del payload["max_tokens"] + # openai.com fails if it gets unknown arguments + if 'native_tool_call' in payload: + del payload['native_tool_call'] + # Fix: O1 does not support the "system" parameter, Modify "system" to "user" if is_o1 and payload["messages"][0]["role"] == "system": payload["messages"][0]["role"] = "user"