mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-03 01:38:46 +00:00
* fix(anthropic): drop unsigned thinking blocks before /v1/messages reaches Claude A thought another provider served (Gemini through the /v1/messages adapter) comes back from Claude Code with an empty signature. Anthropic, Bedrock, Vertex, Azure AI, Databricks and Bedrock Mantle Claude reject it, so the first attempt 400s and the retry turns thinking off. Drop unsigned and encrypted thinking before the first attempt for backends that check Anthropic signatures, and keep the encrypted-only strip for third-party Anthropic-compatible APIs that replay their own unsigned thinking. * fix(anthropic): strip unsigned thinking only when the model is Claude The strip keyed on provider anthropic, so Kimi and other models behind an Anthropic-compatible api_base lost their own unsigned thinking. Every host now strips only for a Claude model, which also covers Claude on GitHub Copilot, and a Bedrock ARN still counts as Claude. Types the new tests. * fix(anthropic): drop unsigned thinking only where the host checks Claude signatures Anthropic-compatible hosts such as DeepSeek accept Gemini's unsigned thought and need it passed back on tool turns, so a Claude model name alone no longer triggers the strip under anthropic/. Python and Rust now also require an anthropic.com or Azure AI Foundry host there, while fixed-host providers keep the name check. Bedrock Converse drops the unsigned thought instead of sending it as reply text, and count_tokens drops it for Claude targets so it accepts the history /v1/messages accepts. The Bedrock ARN override is removed, so Bedrock uses the shared name check. * fix(messages): drop unsigned thinking from Vertex AI and Bedrock count_tokens and test the Rust handler strip * fix(anthropic): keep unsigned thinking for providers and hosts that do not check Claude signatures DeepSeek takes deepseek/claude-* names and Anthropic-compatible hosts take anthropic/claude-* names, and both want the thought back. The strip and count_tokens now share one gate, a Claude model on a provider or host that checks Claude signatures. The Bedrock count judges the deployment model, and a message that is not an object goes to the provider untouched * fix(bedrock): drop unsigned thinking before Claude Platform on AWS whatever host it names Claude Platform on AWS inherited the anthropic host check, so an explicit api_base or an ANTHROPIC_BASE_URL that points elsewhere kept another model's unsigned thought and Claude rejected it. It now uses the Bedrock rule, which checks only the model name Also adds a count_tokens handler test that posts the same thinking history Vertex AI /v1/messages sends * fix(messages): drop unsigned thinking on azure_ai's rust messages route Main now serves azure_ai /v1/messages on Rust only, so the Python strip no longer runs there. The azure_ai Rust config drops thinking blocks with an empty, missing or non-string signature for a Claude deployment, in parsed and unparsed messages, before the request goes to Azure AI Foundry. * fix(messages): drop unsigned thinking on bedrock invoke's rust messages route * test(messages): use rstest for the new bedrock invoke thinking tests * fix(messages): drop provider_specific_fields from count_tokens messages litellm puts provider_specific_fields on a returned content block, such as Gemini's thought signature on a tool_use. /v1/messages already drops it before Claude, but count_tokens sent it on, so Anthropic, Bedrock and Vertex AI answered 400 on a history with a Gemini tool turn * fix(messages): keep stripping unsigned thinking for Claude behind any gateway Strip unsigned thinking for every Claude name, as main does, and keep it only for the providers and hosts known to need it back (DeepSeek, MiniMax, Tencent, z.ai, BigModel). An anthropic/ deployment behind a custom gateway or forwarder now strips again, so it makes one call with thinking on instead of a 400 and a retry that drops all thinking * test(messages): pass typed litellm params to the DeepSeek unsigned thinking test Main's DeepSeek messages transform now reads drop_params off litellm_params, so the plain dict the test passed failed on the merge with main --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| batches | ||
| chat | ||
| count_tokens | ||
| embed | ||
| files | ||
| image | ||
| image_edit | ||
| image_generation | ||
| invoke_agent | ||
| messages | ||
| passthrough | ||
| realtime | ||
| rerank | ||
| responses | ||
| search | ||
| vector_stores | ||
| __init__.py | ||
| event_loop_probe.py | ||
| slow_upstream.py | ||
| test_anthropic_beta_support.py | ||
| test_base_aws_llm.py | ||
| test_bedrock_common_utils.py | ||
| test_bedrock_model_listing.py | ||
| test_bedrock_ssl_verify.py | ||
| test_claude_platform_provider.py | ||
| test_converse_context_management.py | ||
| test_cost_calculation.py | ||
| test_cross_region_inference_profile_mapping.py | ||
| test_guardrail_attachments.py | ||
| test_mantle.py | ||
| test_nova_imported_models.py | ||
| test_request_metadata.py | ||
| test_session_identity.py | ||
| test_web_identity_session_policy.py | ||