mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
fix(types): declare sequence_number on Responses API streaming events
Pydantic-extra storage works at runtime but mypy (with pydantic.mypy) treats undeclared constructor kwargs as call-arg errors. Declare sequence_number explicitly on the event classes used by the Responses API streaming iterator so the type checker accepts the kwarg and allows setattr on OutputTextAnnotationAddedEvent.
This commit is contained in:
parent
a8c00601e7
commit
115a081420
1 changed files with 11 additions and 0 deletions
|
|
@ -1448,16 +1448,19 @@ class ResponsesAPIStreamEvents(str, Enum):
|
|||
class ResponseCreatedEvent(BaseLiteLLMOpenAIResponseObject):
|
||||
type: Literal[ResponsesAPIStreamEvents.RESPONSE_CREATED]
|
||||
response: ResponsesAPIResponse
|
||||
sequence_number: int = 0
|
||||
|
||||
|
||||
class ResponseInProgressEvent(BaseLiteLLMOpenAIResponseObject):
|
||||
type: Literal[ResponsesAPIStreamEvents.RESPONSE_IN_PROGRESS]
|
||||
response: ResponsesAPIResponse
|
||||
sequence_number: int = 0
|
||||
|
||||
|
||||
class ResponseCompletedEvent(BaseLiteLLMOpenAIResponseObject):
|
||||
type: Literal[ResponsesAPIStreamEvents.RESPONSE_COMPLETED]
|
||||
response: ResponsesAPIResponse
|
||||
sequence_number: int = 0
|
||||
_hidden_params: dict = PrivateAttr(default_factory=dict)
|
||||
|
||||
|
||||
|
|
@ -1484,6 +1487,7 @@ class ReasoningSummaryTextDeltaEvent(BaseLiteLLMOpenAIResponseObject):
|
|||
output_index: int
|
||||
summary_index: int = 0
|
||||
delta: str
|
||||
sequence_number: int = 0
|
||||
|
||||
|
||||
class ReasoningSummaryTextDoneEvent(BaseLiteLLMOpenAIResponseObject):
|
||||
|
|
@ -1508,6 +1512,7 @@ class OutputItemAddedEvent(BaseLiteLLMOpenAIResponseObject):
|
|||
type: Literal[ResponsesAPIStreamEvents.OUTPUT_ITEM_ADDED]
|
||||
output_index: int
|
||||
item: Optional[BaseLiteLLMOpenAIResponseObject]
|
||||
sequence_number: int = 0
|
||||
|
||||
|
||||
class OutputItemDoneEvent(BaseLiteLLMOpenAIResponseObject):
|
||||
|
|
@ -1536,6 +1541,7 @@ class ContentPartAddedEvent(BaseLiteLLMOpenAIResponseObject):
|
|||
output_index: int
|
||||
content_index: int
|
||||
part: BaseLiteLLMOpenAIResponseObject
|
||||
sequence_number: int = 0
|
||||
|
||||
|
||||
class ContentPartDonePartOutputText(BaseLiteLLMOpenAIResponseObject):
|
||||
|
|
@ -1568,6 +1574,7 @@ class ContentPartDoneEvent(BaseLiteLLMOpenAIResponseObject):
|
|||
output_index: int
|
||||
content_index: int
|
||||
part: PART_UNION_TYPES
|
||||
sequence_number: int = 0
|
||||
|
||||
|
||||
class OutputTextDeltaEvent(BaseLiteLLMOpenAIResponseObject):
|
||||
|
|
@ -1576,6 +1583,7 @@ class OutputTextDeltaEvent(BaseLiteLLMOpenAIResponseObject):
|
|||
output_index: int
|
||||
content_index: int
|
||||
delta: str
|
||||
sequence_number: int = 0
|
||||
|
||||
|
||||
class OutputTextAnnotationAddedEvent(BaseLiteLLMOpenAIResponseObject):
|
||||
|
|
@ -1585,6 +1593,7 @@ class OutputTextAnnotationAddedEvent(BaseLiteLLMOpenAIResponseObject):
|
|||
content_index: int
|
||||
annotation_index: int
|
||||
annotation: dict
|
||||
sequence_number: int = 0
|
||||
|
||||
|
||||
class OutputTextDoneEvent(BaseLiteLLMOpenAIResponseObject):
|
||||
|
|
@ -1616,6 +1625,7 @@ class FunctionCallArgumentsDeltaEvent(BaseLiteLLMOpenAIResponseObject):
|
|||
item_id: str
|
||||
output_index: int
|
||||
delta: str
|
||||
sequence_number: int = 0
|
||||
|
||||
|
||||
class FunctionCallArgumentsDoneEvent(BaseLiteLLMOpenAIResponseObject):
|
||||
|
|
@ -1623,6 +1633,7 @@ class FunctionCallArgumentsDoneEvent(BaseLiteLLMOpenAIResponseObject):
|
|||
item_id: str
|
||||
output_index: int
|
||||
arguments: str
|
||||
sequence_number: int = 0
|
||||
|
||||
|
||||
class FileSearchCallInProgressEvent(BaseLiteLLMOpenAIResponseObject):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue