mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-29 11:23:49 +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
|
|
|
|
|
|
ContentPartDoneEventPartTypedDict = TypeAliasType(
|
|
"ContentPartDoneEventPartTypedDict",
|
|
Union[
|
|
ReasoningTextContentTypedDict,
|
|
OpenAIResponsesRefusalContentTypedDict,
|
|
ResponseOutputTextTypedDict,
|
|
],
|
|
)
|
|
|
|
|
|
class UnknownContentPartDoneEventPart(BaseModel):
|
|
r"""A ContentPartDoneEventPart 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_DONE_EVENT_PART_VARIANTS: dict[str, Any] = {
|
|
"output_text": ResponseOutputText,
|
|
"reasoning_text": ReasoningTextContent,
|
|
"refusal": OpenAIResponsesRefusalContent,
|
|
}
|
|
|
|
|
|
ContentPartDoneEventPart = Annotated[
|
|
Union[
|
|
ResponseOutputText,
|
|
ReasoningTextContent,
|
|
OpenAIResponsesRefusalContent,
|
|
UnknownContentPartDoneEventPart,
|
|
],
|
|
BeforeValidator(
|
|
partial(
|
|
parse_open_union,
|
|
disc_key="type",
|
|
variants=_CONTENT_PART_DONE_EVENT_PART_VARIANTS,
|
|
unknown_cls=UnknownContentPartDoneEventPart,
|
|
union_name="ContentPartDoneEventPart",
|
|
)
|
|
),
|
|
]
|
|
|
|
|
|
ContentPartDoneEventType = Literal["response.content_part.done",]
|
|
|
|
|
|
class ContentPartDoneEventTypedDict(TypedDict):
|
|
r"""Event emitted when a content part is complete"""
|
|
|
|
content_index: int
|
|
item_id: str
|
|
output_index: int
|
|
part: ContentPartDoneEventPartTypedDict
|
|
sequence_number: int
|
|
type: ContentPartDoneEventType
|
|
|
|
|
|
class ContentPartDoneEvent(BaseModel):
|
|
r"""Event emitted when a content part is complete"""
|
|
|
|
content_index: int
|
|
|
|
item_id: str
|
|
|
|
output_index: int
|
|
|
|
part: ContentPartDoneEventPart
|
|
|
|
sequence_number: int
|
|
|
|
type: ContentPartDoneEventType
|