From 93186ba02c46d2dd5c70a6477437ae75ce445831 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sat, 28 Mar 2026 23:37:33 +0100 Subject: [PATCH] Update main.py Co-authored-by: Parker Wahle <52430642+regulad@users.noreply.github.com> --- backend/open_webui/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index d959351d4c..73d0c075e1 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -1954,7 +1954,10 @@ async def generate_messages( # Convert Anthropic payload to OpenAI format requested_model = form_data.get('model', '') - openai_payload = convert_anthropic_to_openai_payload(form_data) + try: + openai_payload = convert_anthropic_to_openai_payload(form_data) + except (ValueError, NotImplementedError) as e: + raise HTTPException(status_code=400, detail=str(e)) # Route through the existing chat_completion handler response = await chat_completion(request, openai_payload, user)