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
Implement fix
Leslie Cheng1579752e06c1
diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.pyindex 306bcd9bb2c..bcfbee9fc31 100644--- a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py+++ b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py@@ -7,7 +7,7 @@ from collections import dequefrom typing import TYPE_CHECKING, Any, AsyncIterator, Iterator, Literal, Optionalfrom litellm import verbose_logger-from litellm.types.llms.anthropic import UsageDelta+from litellm.types.llms.anthropic import UsageDelta, ToolUseBlockfrom litellm.types.utils import AdapterCompletionStreamWrapperif TYPE_CHECKING:@@ -270,7 +270,6 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper):processed_chunk.get("delta", {}).get("stop_reason")is not None):-self.holding_stop_reason_chunk = processed_chunkelse:self.chunk_queue.append(processed_chunk)@@ -380,4 +379,11 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper):self.current_content_block_start = content_block_startreturn True+ # 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+return False