litellm/litellm/rust_bridge
zoveki 68b5a737a1
fix(anthropic): retry /v1/messages without strict when Claude rejects strict tools under drop_params (#49102)
* fix(anthropic): retry /v1/messages without strict when Claude rejects strict tools under drop_params

The native /v1/messages path sent tools with `strict` straight through, so
when Claude's strict-tool limits rejected them with a 400 the caller got that
400 even with drop_params set. Under drop_params, a 400 that matches Claude's
strict-limit phrases on a request with a strict tool is now sent once more
with `strict` removed from every tool. Without drop_params nothing changes.

The Claude strict-limit matcher moves from bedrock/common_utils.py to
anthropic/common_utils.py so Bedrock converse and the base messages config
share it, and the Rust bridge routes strict tools under drop_params to Python.

* fix(anthropic): retry without strict only when a tool sends strict true

A tool with only strict false no longer triggers a resend of an identical body, the warning no longer
blames tool schemas when the rejected schema may be the output format, and requests with only
additional_drop_params stay on the Rust messages route since the Python retry ignores them

* fix(anthropic): keep sync messages calls with strict tools on Rust

Python has no sync /v1/messages handler, so routing a sync call with a
strict tool to Python raised ValueError where Rust served it before.
The strict-tools detector now applies to async calls only. The retry
warning also names the strict tool count without a plural.

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-10-29 17:18:59 -07:00
..
chat_completions refactor(rust-bridge): detect Python-only features in the catalog instead of Rust declines (#46714) 2026-10-20 15:06:25 -07:00
embeddings refactor(rust-bridge): return an unstarted Execution from native entrypoints and drive it in Python (#46299) 2026-10-14 17:50:44 -07:00
host feat(ocr)!: support outputContentFormat=markdown for Azure Document Intelligence (#48926) 2026-10-28 20:38:23 -07:00
messages fix(anthropic): retry /v1/messages without strict when Claude rejects strict tools under drop_params (#49102) 2026-10-29 17:18:59 -07:00
ocr refactor(rust-bridge): move the route host modules under host/routes (#46786) 2026-10-15 18:27:06 -07:00
responses refactor(rust-bridge): require the native extension (#48852) 2026-10-28 13:16:56 -07:00
transcription refactor(rust-bridge): unify native call inputs and Messages settings (#45126) 2026-10-07 15:05:43 -07:00
__init__.py refactor(rust-bridge): require the native extension (#48852) 2026-10-28 13:16:56 -07:00
_native.pyi build(model-catalog): ship the cost map inside the native extension (#48907) 2026-10-29 07:55:02 -07:00
AGENTS.md refactor(rust-bridge): require the native extension (#48852) 2026-10-28 13:16:56 -07:00
bindings.py refactor(rust-bridge): require the native extension (#48852) 2026-10-28 13:16:56 -07:00
catalog.py fix(anthropic): retry /v1/messages without strict when Claude rejects strict tools under drop_params (#49102) 2026-10-29 17:18:59 -07:00
clickhouse.py refactor(rust-bridge): require the native extension (#48852) 2026-10-28 13:16:56 -07:00
configuration.py feat(tokenizer): preserve Python defaults with opt-in Rust dispatch (#42174) 2026-09-22 04:41:11 +00:00
detectors.py refactor(types): replace Any with proven types in 50 files (#47818) 2026-10-21 11:58:31 +00:00
diagnostics.py refactor(rust-bridge): remove the LoggerRule concept from the catalog (#46711) 2026-10-15 17:49:51 +00:00
dispatch.py refactor(rust-bridge): detect Python-only features in the catalog instead of Rust declines (#46714) 2026-10-20 15:06:25 -07:00
execution.py refactor(rust-bridge): return an unstarted Execution from native entrypoints and drive it in Python (#46299) 2026-10-14 17:50:44 -07:00
failures.py chore(lint): remove the LIT002 mutable-construction rule (#43971) 2026-10-01 12:24:02 -07:00
fork_guard.py refactor(rust-bridge): require the native extension (#48852) 2026-10-28 13:16:56 -07:00
logger.py feat(lint): add LIT013 flagging *-ok suppressions that suppress nothing and remove the 240 stale ones (#42793) 2026-09-23 17:50:09 -07:00
preflight.py refactor(rust): move credential inheritance and the SDK limits out of the legacy callback crate into a driver preflight (#43259) 2026-09-26 01:09:36 +00:00
public_call.py refactor(rust-bridge): detect Python-only features in the catalog instead of Rust declines (#46714) 2026-10-20 15:06:25 -07:00
response_metadata.py feat(cache): select Rust caching through explicit cache objects (#43601) 2026-09-29 00:01:44 +00:00
runtime.py refactor(rust-bridge): require the native extension (#48852) 2026-10-28 13:16:56 -07:00
token_counter.py feat(tokenizer): preserve Python defaults with opt-in Rust dispatch (#42174) 2026-09-22 04:41:11 +00:00
tokenizer.py refactor(sdk): separate core AWS and tokenizer dependencies (#44447) 2026-10-08 19:07:57 -07:00