mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
Add annotations to the delta
This commit is contained in:
parent
5c59a6a58f
commit
44f4c623e2
1 changed files with 8 additions and 0 deletions
|
|
@ -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]] = None
|
||||
self.tool_calls: Optional[List[Union[ChatCompletionDeltaToolCall, Any]]] = None
|
||||
self.audio: Optional[ChatCompletionAudioResponse] = None
|
||||
self.annotations: Optional[List[ChatCompletionAnnotation]] = None
|
||||
|
||||
if reasoning_content is not None:
|
||||
self.reasoning_content = reasoning_content
|
||||
|
|
@ -653,6 +655,12 @@ class Delta(OpenAIObject):
|
|||
# ensure default response matches OpenAI spec
|
||||
del 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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue