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
Add annotations to the delta
Ishaan Jaff44f4c623e2a9
diff --git a/litellm/types/utils.py b/litellm/types/utils.pyindex 58c78dfa292..8821d2c80bd 100644--- a/litellm/types/utils.py+++ b/litellm/types/utils.py@@ -630,6 +630,7 @@ class Delta(OpenAIObject):audio: Optional[ChatCompletionAudioResponse] = None,reasoning_content: Optional[str] = None,thinking_blocks: Optional[List[ChatCompletionThinkingBlock]] = None,+ annotations: Optional[List[ChatCompletionAnnotation]] = None,**params,):super(Delta, self).__init__(**params)@@ -640,6 +641,7 @@ class Delta(OpenAIObject):self.function_call: Optional[Union[FunctionCall, Any]] = Noneself.tool_calls: Optional[List[Union[ChatCompletionDeltaToolCall, Any]]] = Noneself.audio: Optional[ChatCompletionAudioResponse] = None+ self.annotations: Optional[List[ChatCompletionAnnotation]] = Noneif reasoning_content is not None:self.reasoning_content = reasoning_content@@ -653,6 +655,12 @@ class Delta(OpenAIObject):# ensure default response matches OpenAI specdel self.thinking_blocks+ # Add annotations to the delta, ensure they are only on Delta if they exist (Match OpenAI spec)+ if annotations is not None:+ self.annotations = annotations+ else:+ del self.annotations+if function_call is not None and isinstance(function_call, dict):self.function_call = FunctionCall(**function_call)else: