mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
93 lines
2.5 KiB
Python
93 lines
2.5 KiB
Python
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
from __future__ import annotations
|
|
from .openairesponsesrefusalcontent import (
|
|
OpenAIResponsesRefusalContent,
|
|
OpenAIResponsesRefusalContentTypedDict,
|
|
)
|
|
from .reasoningtextcontent import ReasoningTextContent, ReasoningTextContentTypedDict
|
|
from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
|
|
from functools import partial
|
|
from openrouter.types import BaseModel
|
|
from openrouter.utils.unions import parse_open_union
|
|
from pydantic import ConfigDict
|
|
from pydantic.functional_validators import BeforeValidator
|
|
from typing import Any, Literal, Union
|
|
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
|
|
|
|
|
ContentPartAddedEventPartTypedDict = TypeAliasType(
|
|
"ContentPartAddedEventPartTypedDict",
|
|
Union[
|
|
ReasoningTextContentTypedDict,
|
|
OpenAIResponsesRefusalContentTypedDict,
|
|
ResponseOutputTextTypedDict,
|
|
],
|
|
)
|
|
|
|
|
|
class UnknownContentPartAddedEventPart(BaseModel):
|
|
r"""A ContentPartAddedEventPart variant the SDK doesn't recognize. Preserves the raw payload."""
|
|
|
|
type: Literal["UNKNOWN"] = "UNKNOWN"
|
|
raw: Any
|
|
is_unknown: Literal[True] = True
|
|
|
|
model_config = ConfigDict(frozen=True)
|
|
|
|
|
|
_CONTENT_PART_ADDED_EVENT_PART_VARIANTS: dict[str, Any] = {
|
|
"output_text": ResponseOutputText,
|
|
"reasoning_text": ReasoningTextContent,
|
|
"refusal": OpenAIResponsesRefusalContent,
|
|
}
|
|
|
|
|
|
ContentPartAddedEventPart = Annotated[
|
|
Union[
|
|
ResponseOutputText,
|
|
ReasoningTextContent,
|
|
OpenAIResponsesRefusalContent,
|
|
UnknownContentPartAddedEventPart,
|
|
],
|
|
BeforeValidator(
|
|
partial(
|
|
parse_open_union,
|
|
disc_key="type",
|
|
variants=_CONTENT_PART_ADDED_EVENT_PART_VARIANTS,
|
|
unknown_cls=UnknownContentPartAddedEventPart,
|
|
union_name="ContentPartAddedEventPart",
|
|
)
|
|
),
|
|
]
|
|
|
|
|
|
ContentPartAddedEventType = Literal["response.content_part.added",]
|
|
|
|
|
|
class ContentPartAddedEventTypedDict(TypedDict):
|
|
r"""Event emitted when a new content part is added to an output item"""
|
|
|
|
content_index: int
|
|
item_id: str
|
|
output_index: int
|
|
part: ContentPartAddedEventPartTypedDict
|
|
sequence_number: int
|
|
type: ContentPartAddedEventType
|
|
|
|
|
|
class ContentPartAddedEvent(BaseModel):
|
|
r"""Event emitted when a new content part is added to an output item"""
|
|
|
|
content_index: int
|
|
|
|
item_id: str
|
|
|
|
output_index: int
|
|
|
|
part: ContentPartAddedEventPart
|
|
|
|
sequence_number: int
|
|
|
|
type: ContentPartAddedEventType
|