The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix: litellm_oss_staging_01_31_2026_3 failing tests
Sameer Kankute7329fa8e7adf
diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.mdindex bb2c7e01c80..264c7d765b3 100644--- a/docs/my-website/docs/proxy/config_settings.md+++ b/docs/my-website/docs/proxy/config_settings.md@@ -321,6 +321,7 @@ router_settings:| redis_host | string | The host address for the Redis server. **Only set this if you have multiple instances of LiteLLM Proxy and want current tpm/rpm tracking to be shared across them** || redis_password | string | The password for the Redis server. **Only set this if you have multiple instances of LiteLLM Proxy and want current tpm/rpm tracking to be shared across them** || redis_port | string | The port number for the Redis server. **Only set this if you have multiple instances of LiteLLM Proxy and want current tpm/rpm tracking to be shared across them**|+| redis_db | int | The database number for the Redis server. **Only set this if you have multiple instances of LiteLLM Proxy and want current tpm/rpm tracking to be shared across them**|| enable_pre_call_check | boolean | If true, checks if a call is within the model's context window before making the call. [More information here](reliability) || content_policy_fallbacks | array of objects | Specifies fallback models for content policy violations. [More information here](reliability) || fallbacks | array of objects | Specifies fallback models for all types of errors. [More information here](reliability) |diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.pyindex aa2f0cc08f1..a86820f82e8 100644--- a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py+++ b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py@@ -409,10 +409,17 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper):)# Restore original tool name if it was truncated for OpenAI's 64-char limit- if block_type == "tool_use" and content_block_start.get("name"):- truncated_name = content_block_start.get("name", "")- original_name = self.tool_name_mapping.get(truncated_name, truncated_name)- content_block_start["name"] = original_name+ if block_type == "tool_use":+ # Type narrowing: content_block_start is ToolUseBlock when block_type is "tool_use"+ from typing import cast+ from litellm.types.llms.anthropic import ToolUseBlock++ tool_block = cast(ToolUseBlock, content_block_start)++ if tool_block.get("name"):+ truncated_name = tool_block["name"]+ original_name = self.tool_name_mapping.get(truncated_name, truncated_name)+ tool_block["name"] = original_nameif block_type != self.current_content_block_type:self.current_content_block_type = block_type@@ -421,9 +428,14 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper):# For parallel tool calls, we'll necessarily have a new content block# if we get a function name since it signals a new tool call- if block_type == "tool_use" and content_block_start.get("name"):- self.current_content_block_type = block_type- self.current_content_block_start = content_block_start- return True+ if block_type == "tool_use":+ from typing import cast+ from litellm.types.llms.anthropic import ToolUseBlock++ tool_block = cast(ToolUseBlock, content_block_start)+ if tool_block.get("name"):+ self.current_content_block_type = block_type+ self.current_content_block_start = content_block_start+ return Truereturn Falsediff --git a/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py b/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.pyindex bcb0059fd19..6a5c022ac7a 100644--- a/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py+++ b/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py@@ -1531,7 +1531,6 @@ def test_translate_openai_response_to_anthropic_with_reasoning_content_only():assert cast(Any, anthropic_content[1]).text == "There are **3** \"r\"s in the word strawberry."assert anthropic_response.get("stop_reason") == "end_turn"- assert tool_name_mapping == {} # No truncation needed for short names# =====================================================================