mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
136 lines
3.8 KiB
Python
136 lines
3.8 KiB
Python
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
from __future__ import annotations
|
|
from openrouter.types import (
|
|
BaseModel,
|
|
Nullable,
|
|
OptionalNullable,
|
|
UNSET,
|
|
UNSET_SENTINEL,
|
|
UnrecognizedStr,
|
|
)
|
|
import pydantic
|
|
from pydantic import ConfigDict, model_serializer
|
|
from typing import Any, Dict, List, Literal, Union
|
|
from typing_extensions import NotRequired, TypedDict
|
|
|
|
|
|
class ShellCallOutputItemOutputTypedDict(TypedDict):
|
|
type: str
|
|
content: NotRequired[Nullable[str]]
|
|
exit_code: NotRequired[Nullable[int]]
|
|
|
|
|
|
class ShellCallOutputItemOutput(BaseModel):
|
|
model_config = ConfigDict(
|
|
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
|
)
|
|
__pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False)
|
|
|
|
type: str
|
|
|
|
content: OptionalNullable[str] = UNSET
|
|
|
|
exit_code: OptionalNullable[int] = UNSET
|
|
|
|
@property
|
|
def additional_properties(self):
|
|
return self.__pydantic_extra__
|
|
|
|
@additional_properties.setter
|
|
def additional_properties(self, value):
|
|
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
|
|
|
@model_serializer(mode="wrap")
|
|
def serialize_model(self, handler):
|
|
optional_fields = set(["content", "exit_code"])
|
|
nullable_fields = set(["content", "exit_code"])
|
|
serialized = handler(self)
|
|
m = {}
|
|
|
|
for n, f in type(self).model_fields.items():
|
|
k = f.alias or n
|
|
val = serialized.get(k, serialized.get(n))
|
|
serialized.pop(k, serialized.pop(n, None))
|
|
is_nullable_and_explicitly_set = (
|
|
k in nullable_fields
|
|
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
)
|
|
|
|
if val != UNSET_SENTINEL:
|
|
if (
|
|
val is not None
|
|
or k not in optional_fields
|
|
or is_nullable_and_explicitly_set
|
|
):
|
|
m[k] = val
|
|
for k, v in serialized.items():
|
|
m[k] = v
|
|
|
|
return m
|
|
|
|
|
|
ShellCallOutputItemStatus = Union[
|
|
Literal[
|
|
"in_progress",
|
|
"completed",
|
|
"incomplete",
|
|
],
|
|
UnrecognizedStr,
|
|
]
|
|
|
|
|
|
ShellCallOutputItemType = Literal["shell_call_output",]
|
|
|
|
|
|
class ShellCallOutputItemTypedDict(TypedDict):
|
|
r"""Output from a shell command execution (newer variant)"""
|
|
|
|
call_id: str
|
|
output: List[ShellCallOutputItemOutputTypedDict]
|
|
type: ShellCallOutputItemType
|
|
id: NotRequired[Nullable[str]]
|
|
max_output_length: NotRequired[Nullable[int]]
|
|
status: NotRequired[Nullable[ShellCallOutputItemStatus]]
|
|
|
|
|
|
class ShellCallOutputItem(BaseModel):
|
|
r"""Output from a shell command execution (newer variant)"""
|
|
|
|
call_id: str
|
|
|
|
output: List[ShellCallOutputItemOutput]
|
|
|
|
type: ShellCallOutputItemType
|
|
|
|
id: OptionalNullable[str] = UNSET
|
|
|
|
max_output_length: OptionalNullable[int] = UNSET
|
|
|
|
status: OptionalNullable[ShellCallOutputItemStatus] = UNSET
|
|
|
|
@model_serializer(mode="wrap")
|
|
def serialize_model(self, handler):
|
|
optional_fields = set(["id", "max_output_length", "status"])
|
|
nullable_fields = set(["id", "max_output_length", "status"])
|
|
serialized = handler(self)
|
|
m = {}
|
|
|
|
for n, f in type(self).model_fields.items():
|
|
k = f.alias or n
|
|
val = serialized.get(k, serialized.get(n))
|
|
is_nullable_and_explicitly_set = (
|
|
k in nullable_fields
|
|
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
)
|
|
|
|
if val != UNSET_SENTINEL:
|
|
if (
|
|
val is not None
|
|
or k not in optional_fields
|
|
or is_nullable_and_explicitly_set
|
|
):
|
|
m[k] = val
|
|
|
|
return m
|