mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
241 lines
8.3 KiB
Python
241 lines
8.3 KiB
Python
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
from __future__ import annotations
|
|
from .outputadvisorservertoolitem import (
|
|
OutputAdvisorServerToolItem,
|
|
OutputAdvisorServerToolItemTypedDict,
|
|
)
|
|
from .outputapplypatchcallitem import (
|
|
OutputApplyPatchCallItem,
|
|
OutputApplyPatchCallItemTypedDict,
|
|
)
|
|
from .outputapplypatchservertoolitem import (
|
|
OutputApplyPatchServerToolItem,
|
|
OutputApplyPatchServerToolItemTypedDict,
|
|
)
|
|
from .outputbashservertoolitem import (
|
|
OutputBashServerToolItem,
|
|
OutputBashServerToolItemTypedDict,
|
|
)
|
|
from .outputbrowseruseservertoolitem import (
|
|
OutputBrowserUseServerToolItem,
|
|
OutputBrowserUseServerToolItemTypedDict,
|
|
)
|
|
from .outputcodeinterpretercallitem import (
|
|
OutputCodeInterpreterCallItem,
|
|
OutputCodeInterpreterCallItemTypedDict,
|
|
)
|
|
from .outputcodeinterpreterservertoolitem import (
|
|
OutputCodeInterpreterServerToolItem,
|
|
OutputCodeInterpreterServerToolItemTypedDict,
|
|
)
|
|
from .outputcomputercallitem import (
|
|
OutputComputerCallItem,
|
|
OutputComputerCallItemTypedDict,
|
|
)
|
|
from .outputcustomtoolcallitem import (
|
|
OutputCustomToolCallItem,
|
|
OutputCustomToolCallItemTypedDict,
|
|
)
|
|
from .outputdatetimeitem import OutputDatetimeItem, OutputDatetimeItemTypedDict
|
|
from .outputfilesearchcallitem import (
|
|
OutputFileSearchCallItem,
|
|
OutputFileSearchCallItemTypedDict,
|
|
)
|
|
from .outputfilesearchservertoolitem import (
|
|
OutputFileSearchServerToolItem,
|
|
OutputFileSearchServerToolItemTypedDict,
|
|
)
|
|
from .outputfunctioncallitem import (
|
|
OutputFunctionCallItem,
|
|
OutputFunctionCallItemTypedDict,
|
|
)
|
|
from .outputfusionservertoolitem import (
|
|
OutputFusionServerToolItem,
|
|
OutputFusionServerToolItemTypedDict,
|
|
)
|
|
from .outputimagegenerationcallitem import (
|
|
OutputImageGenerationCallItem,
|
|
OutputImageGenerationCallItemTypedDict,
|
|
)
|
|
from .outputimagegenerationservertoolitem import (
|
|
OutputImageGenerationServerToolItem,
|
|
OutputImageGenerationServerToolItemTypedDict,
|
|
)
|
|
from .outputmcpservertoolitem import (
|
|
OutputMcpServerToolItem,
|
|
OutputMcpServerToolItemTypedDict,
|
|
)
|
|
from .outputmemoryservertoolitem import (
|
|
OutputMemoryServerToolItem,
|
|
OutputMemoryServerToolItemTypedDict,
|
|
)
|
|
from .outputmessageitem import OutputMessageItem, OutputMessageItemTypedDict
|
|
from .outputreasoningitem import OutputReasoningItem, OutputReasoningItemTypedDict
|
|
from .outputsearchmodelsservertoolitem import (
|
|
OutputSearchModelsServerToolItem,
|
|
OutputSearchModelsServerToolItemTypedDict,
|
|
)
|
|
from .outputshellcallitem import OutputShellCallItem, OutputShellCallItemTypedDict
|
|
from .outputshellcalloutputitem import (
|
|
OutputShellCallOutputItem,
|
|
OutputShellCallOutputItemTypedDict,
|
|
)
|
|
from .outputsubagentservertoolitem import (
|
|
OutputSubagentServerToolItem,
|
|
OutputSubagentServerToolItemTypedDict,
|
|
)
|
|
from .outputtexteditorservertoolitem import (
|
|
OutputTextEditorServerToolItem,
|
|
OutputTextEditorServerToolItemTypedDict,
|
|
)
|
|
from .outputtoolsearchservertoolitem import (
|
|
OutputToolSearchServerToolItem,
|
|
OutputToolSearchServerToolItemTypedDict,
|
|
)
|
|
from .outputwebfetchservertoolitem import (
|
|
OutputWebFetchServerToolItem,
|
|
OutputWebFetchServerToolItemTypedDict,
|
|
)
|
|
from .outputwebsearchcallitem import (
|
|
OutputWebSearchCallItem,
|
|
OutputWebSearchCallItemTypedDict,
|
|
)
|
|
from .outputwebsearchservertoolitem import (
|
|
OutputWebSearchServerToolItem,
|
|
OutputWebSearchServerToolItemTypedDict,
|
|
)
|
|
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
|
|
|
|
|
|
OutputItemsTypedDict = TypeAliasType(
|
|
"OutputItemsTypedDict",
|
|
Union[
|
|
OutputToolSearchServerToolItemTypedDict,
|
|
OutputWebSearchServerToolItemTypedDict,
|
|
OutputFileSearchServerToolItemTypedDict,
|
|
OutputWebSearchCallItemTypedDict,
|
|
OutputFileSearchCallItemTypedDict,
|
|
OutputImageGenerationCallItemTypedDict,
|
|
OutputApplyPatchServerToolItemTypedDict,
|
|
OutputTextEditorServerToolItemTypedDict,
|
|
OutputSearchModelsServerToolItemTypedDict,
|
|
OutputDatetimeItemTypedDict,
|
|
OutputApplyPatchCallItemTypedDict,
|
|
OutputMcpServerToolItemTypedDict,
|
|
OutputShellCallItemTypedDict,
|
|
OutputBrowserUseServerToolItemTypedDict,
|
|
OutputComputerCallItemTypedDict,
|
|
OutputCodeInterpreterCallItemTypedDict,
|
|
OutputCustomToolCallItemTypedDict,
|
|
OutputMemoryServerToolItemTypedDict,
|
|
OutputMessageItemTypedDict,
|
|
OutputShellCallOutputItemTypedDict,
|
|
OutputBashServerToolItemTypedDict,
|
|
OutputFunctionCallItemTypedDict,
|
|
OutputImageGenerationServerToolItemTypedDict,
|
|
OutputWebFetchServerToolItemTypedDict,
|
|
OutputCodeInterpreterServerToolItemTypedDict,
|
|
OutputReasoningItemTypedDict,
|
|
OutputAdvisorServerToolItemTypedDict,
|
|
OutputSubagentServerToolItemTypedDict,
|
|
OutputFusionServerToolItemTypedDict,
|
|
],
|
|
)
|
|
r"""An output item from the response"""
|
|
|
|
|
|
class UnknownOutputItems(BaseModel):
|
|
r"""A OutputItems 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)
|
|
|
|
|
|
_OUTPUT_ITEMS_VARIANTS: dict[str, Any] = {
|
|
"apply_patch_call": OutputApplyPatchCallItem,
|
|
"code_interpreter_call": OutputCodeInterpreterCallItem,
|
|
"computer_call": OutputComputerCallItem,
|
|
"custom_tool_call": OutputCustomToolCallItem,
|
|
"file_search_call": OutputFileSearchCallItem,
|
|
"function_call": OutputFunctionCallItem,
|
|
"image_generation_call": OutputImageGenerationCallItem,
|
|
"message": OutputMessageItem,
|
|
"openrouter:advisor": OutputAdvisorServerToolItem,
|
|
"openrouter:apply_patch": OutputApplyPatchServerToolItem,
|
|
"openrouter:bash": OutputBashServerToolItem,
|
|
"openrouter:browser_use": OutputBrowserUseServerToolItem,
|
|
"openrouter:code_interpreter": OutputCodeInterpreterServerToolItem,
|
|
"openrouter:datetime": OutputDatetimeItem,
|
|
"openrouter:experimental__search_models": OutputSearchModelsServerToolItem,
|
|
"openrouter:file_search": OutputFileSearchServerToolItem,
|
|
"openrouter:fusion": OutputFusionServerToolItem,
|
|
"openrouter:image_generation": OutputImageGenerationServerToolItem,
|
|
"openrouter:mcp": OutputMcpServerToolItem,
|
|
"openrouter:memory": OutputMemoryServerToolItem,
|
|
"openrouter:subagent": OutputSubagentServerToolItem,
|
|
"openrouter:text_editor": OutputTextEditorServerToolItem,
|
|
"openrouter:tool_search": OutputToolSearchServerToolItem,
|
|
"openrouter:web_fetch": OutputWebFetchServerToolItem,
|
|
"openrouter:web_search": OutputWebSearchServerToolItem,
|
|
"reasoning": OutputReasoningItem,
|
|
"shell_call": OutputShellCallItem,
|
|
"shell_call_output": OutputShellCallOutputItem,
|
|
"web_search_call": OutputWebSearchCallItem,
|
|
}
|
|
|
|
|
|
OutputItems = Annotated[
|
|
Union[
|
|
OutputApplyPatchCallItem,
|
|
OutputCodeInterpreterCallItem,
|
|
OutputComputerCallItem,
|
|
OutputCustomToolCallItem,
|
|
OutputFileSearchCallItem,
|
|
OutputFunctionCallItem,
|
|
OutputImageGenerationCallItem,
|
|
OutputMessageItem,
|
|
OutputAdvisorServerToolItem,
|
|
OutputApplyPatchServerToolItem,
|
|
OutputBashServerToolItem,
|
|
OutputBrowserUseServerToolItem,
|
|
OutputCodeInterpreterServerToolItem,
|
|
OutputDatetimeItem,
|
|
OutputSearchModelsServerToolItem,
|
|
OutputFileSearchServerToolItem,
|
|
OutputFusionServerToolItem,
|
|
OutputImageGenerationServerToolItem,
|
|
OutputMcpServerToolItem,
|
|
OutputMemoryServerToolItem,
|
|
OutputSubagentServerToolItem,
|
|
OutputTextEditorServerToolItem,
|
|
OutputToolSearchServerToolItem,
|
|
OutputWebFetchServerToolItem,
|
|
OutputWebSearchServerToolItem,
|
|
OutputReasoningItem,
|
|
OutputShellCallItem,
|
|
OutputShellCallOutputItem,
|
|
OutputWebSearchCallItem,
|
|
UnknownOutputItems,
|
|
],
|
|
BeforeValidator(
|
|
partial(
|
|
parse_open_union,
|
|
disc_key="type",
|
|
variants=_OUTPUT_ITEMS_VARIANTS,
|
|
unknown_cls=UnknownOutputItems,
|
|
union_name="OutputItems",
|
|
)
|
|
),
|
|
]
|
|
r"""An output item from the response"""
|