mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
Co-authored-by: speakeasybot <bot@speakeasyapi.dev> Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
63 lines
2.8 KiB
Python
63 lines
2.8 KiB
Python
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
from __future__ import annotations
|
|
from .reasoningcontext import ReasoningContext
|
|
from .reasoningeffort import ReasoningEffort
|
|
from .reasoningmode import ReasoningMode
|
|
from .reasoningsummaryverbosity import ReasoningSummaryVerbosity
|
|
from openrouter.types import (
|
|
BaseModel,
|
|
Nullable,
|
|
OptionalNullable,
|
|
UNSET,
|
|
UNSET_SENTINEL,
|
|
)
|
|
from pydantic import model_serializer
|
|
from typing_extensions import NotRequired, TypedDict
|
|
|
|
|
|
class BaseReasoningConfigTypedDict(TypedDict):
|
|
context: NotRequired[Nullable[ReasoningContext]]
|
|
r"""Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer."""
|
|
effort: NotRequired[Nullable[ReasoningEffort]]
|
|
mode: NotRequired[Nullable[ReasoningMode]]
|
|
r"""Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer."""
|
|
summary: NotRequired[Nullable[ReasoningSummaryVerbosity]]
|
|
|
|
|
|
class BaseReasoningConfig(BaseModel):
|
|
context: OptionalNullable[ReasoningContext] = UNSET
|
|
r"""Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer."""
|
|
|
|
effort: OptionalNullable[ReasoningEffort] = UNSET
|
|
|
|
mode: OptionalNullable[ReasoningMode] = UNSET
|
|
r"""Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer."""
|
|
|
|
summary: OptionalNullable[ReasoningSummaryVerbosity] = UNSET
|
|
|
|
@model_serializer(mode="wrap")
|
|
def serialize_model(self, handler):
|
|
optional_fields = set(["context", "effort", "mode", "summary"])
|
|
nullable_fields = set(["context", "effort", "mode", "summary"])
|
|
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
|