From db9aef0eaf07fe66ebd328f58a52af3052c6f9e6 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 19 Dec 2024 19:05:20 -0800 Subject: [PATCH] refac --- backend/open_webui/routers/openai.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/routers/openai.py b/backend/open_webui/routers/openai.py index f7f78be85..370513255 100644 --- a/backend/open_webui/routers/openai.py +++ b/backend/open_webui/routers/openai.py @@ -604,10 +604,10 @@ async def generate_chat_completion( if is_o1: payload = openai_o1_handler(payload) elif "api.openai.com" not in url: - # Remove "max_tokens" from the payload for backward compatibility - if "max_tokens" in payload: - payload["max_completion_tokens"] = payload["max_tokens"] - del payload["max_tokens"] + # Remove "max_completion_tokens" from the payload for backward compatibility + if "max_completion_tokens" in payload: + payload["max_tokens"] = payload["max_completion_tokens"] + del payload["max_completion_tokens"] # TODO: check if below is needed # if "max_tokens" in payload and "max_completion_tokens" in payload: