open-webui/backend/open_webui
Classic298 b91a558c9d
fix: stop forwarding empty tools arrays from the Anthropic Messages endpoint (#31343)
Anthropic clients such as Claude Code send "tools": [] on text-only requests like prompt-hook evaluation. The Anthropic Messages endpoint carried that empty array into the converted OpenAI request, and vLLM and the OpenAI API reject it with HTTP 400, so those requests failed while normal chats with tools kept working. A "tools": null body crashed the converter with a 500.

The converter now only emits tools when the list is non-empty, and only emits tool_choice when tools were emitted. Dropping tools alone is not enough: the same backends also reject tool_choice without tools, so a request sending an empty tool list plus a tool_choice would still fail.

Requests with real tools are converted exactly as before. Verified end to end against a mock backend enforcing vLLM's validation: empty, null and tool_choice-only requests went from 400/500 to 200 with end_turn, streaming included.

Fixes #31341
2026-09-27 23:11:45 +04:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal refac: build the SQLite LIKE regex from wildcard-split segments (#30393) 2026-09-23 23:55:57 -04:00
migrations chore: format 2026-08-25 16:53:53 -04:00
models fix: on PostgreSQL, searching automations or filtering models by a non-ASCII word finds nothing (#31423) 2026-09-27 23:09:54 +04:00
retrieval fix: backslashes in uploaded HTML files turn into line breaks or break the upload (#31450) 2026-09-27 23:08:14 +04:00
routers fix(retrieval): name the link when process/url cannot fetch it (#31354) 2026-09-27 23:11:20 +04:00
socket refac: scope ydoc update save scheduling to note documents (#30395) 2026-09-23 23:30:21 -04:00
static refac 2026-09-06 17:27:30 -04:00
storage fix: read S3 files with long non-ASCII names (#30418) 2026-09-23 23:30:55 -04:00
tools refac 2026-09-24 12:34:04 -04:00
utils fix: stop forwarding empty tools arrays from the Anthropic Messages endpoint (#31343) 2026-09-27 23:11:45 +04:00
__init__.py refactor: use secrets module for generated secret key (#30441) 2026-09-23 23:36:26 -04:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py refac 2026-09-21 11:09:09 -04:00
constants.py refac 2026-08-29 16:14:32 -04:00
env.py perf: per-room channel delivery for the socket.io Redis manager (#28818) 2026-09-22 14:48:56 -04:00
events.py refac 2026-08-16 23:21:00 -07:00
functions.py fix: honor bypass_system_prompt on the pipe route (#28739) 2026-08-19 11:08:02 -07:00
main.py fix: keep requested MCP OAuth scope when DCR response omits it (#30384) 2026-09-23 23:52:29 -04:00
tasks.py refac 2026-09-21 08:59:39 -04:00