mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
from __future__ import annotations
|
|
from .filecitation import FileCitation, FileCitationTypedDict
|
|
from .filepath import FilePath, FilePathTypedDict
|
|
from .urlcitation import URLCitation, URLCitationTypedDict
|
|
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
|
|
|
|
|
|
OpenAIResponsesAnnotationTypedDict = TypeAliasType(
|
|
"OpenAIResponsesAnnotationTypedDict",
|
|
Union[FilePathTypedDict, FileCitationTypedDict, URLCitationTypedDict],
|
|
)
|
|
|
|
|
|
class UnknownOpenAIResponsesAnnotation(BaseModel):
|
|
r"""A OpenAIResponsesAnnotation 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)
|
|
|
|
|
|
_OPEN_AI_RESPONSES_ANNOTATION_VARIANTS: dict[str, Any] = {
|
|
"file_citation": FileCitation,
|
|
"url_citation": URLCitation,
|
|
"file_path": FilePath,
|
|
}
|
|
|
|
|
|
OpenAIResponsesAnnotation = Annotated[
|
|
Union[FileCitation, URLCitation, FilePath, UnknownOpenAIResponsesAnnotation],
|
|
BeforeValidator(
|
|
partial(
|
|
parse_open_union,
|
|
disc_key="type",
|
|
variants=_OPEN_AI_RESPONSES_ANNOTATION_VARIANTS,
|
|
unknown_cls=UnknownOpenAIResponsesAnnotation,
|
|
union_name="OpenAIResponsesAnnotation",
|
|
)
|
|
),
|
|
]
|