From 4e36b9794fa146bcdc3e99dc51948838bb989e21 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 8 Mar 2025 16:50:30 +0000 Subject: [PATCH] fix: logit bias issue --- backend/open_webui/routers/openai.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/routers/openai.py b/backend/open_webui/routers/openai.py index 5519afdf4..bef286ca9 100644 --- a/backend/open_webui/routers/openai.py +++ b/backend/open_webui/routers/openai.py @@ -673,7 +673,11 @@ async def generate_chat_completion( del payload["max_tokens"] # Convert the modified body back to JSON - payload['logit_bias'] = json.loads(convert_logit_bias_input_to_json(payload['logit_bias'])) + if "logit_bias" in payload: + payload["logit_bias"] = json.loads( + convert_logit_bias_input_to_json(payload["logit_bias"]) + ) + payload = json.dumps(payload) r = None