mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
chore: 🐝 Update SDK - Generate (spec change merged) 0.11.15 (#418)
Co-authored-by: speakeasybot <bot@speakeasyapi.dev> Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
speakeasybot
speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
parent
a2e9c97855
commit
3f1ab05c95
@@ -2139,6 +2139,16 @@ if TYPE_CHECKING:
|
||||
PreviewWebSearchUserLocationType,
|
||||
PreviewWebSearchUserLocationTypedDict,
|
||||
)
|
||||
from .promptcachebreakpoint import (
|
||||
PromptCacheBreakpoint,
|
||||
PromptCacheBreakpointMode,
|
||||
PromptCacheBreakpointTypedDict,
|
||||
)
|
||||
from .promptcacheoptions import (
|
||||
PromptCacheOptions,
|
||||
PromptCacheOptionsMode,
|
||||
PromptCacheOptionsTypedDict,
|
||||
)
|
||||
from .promptinjectionscanscope import PromptInjectionScanScope
|
||||
from .providername import ProviderName
|
||||
from .provideroptions import ProviderOptions, ProviderOptionsTypedDict
|
||||
@@ -2199,6 +2209,7 @@ if TYPE_CHECKING:
|
||||
RankingsDailyResponseTypedDict,
|
||||
)
|
||||
from .reasoningconfig import ReasoningConfig, ReasoningConfigTypedDict
|
||||
from .reasoningcontext import ReasoningContext
|
||||
from .reasoningdeltaevent import (
|
||||
ReasoningDeltaEvent,
|
||||
ReasoningDeltaEventType,
|
||||
@@ -4217,6 +4228,12 @@ __all__ = [
|
||||
"PriceSource",
|
||||
"Pricing",
|
||||
"PricingTypedDict",
|
||||
"PromptCacheBreakpoint",
|
||||
"PromptCacheBreakpointMode",
|
||||
"PromptCacheBreakpointTypedDict",
|
||||
"PromptCacheOptions",
|
||||
"PromptCacheOptionsMode",
|
||||
"PromptCacheOptionsTypedDict",
|
||||
"PromptInjectionScanScope",
|
||||
"ProviderName",
|
||||
"ProviderOptions",
|
||||
@@ -4253,6 +4270,7 @@ __all__ = [
|
||||
"Reason",
|
||||
"ReasoningConfig",
|
||||
"ReasoningConfigTypedDict",
|
||||
"ReasoningContext",
|
||||
"ReasoningDeltaEvent",
|
||||
"ReasoningDeltaEventType",
|
||||
"ReasoningDeltaEventTypedDict",
|
||||
@@ -6342,6 +6360,12 @@ _dynamic_imports: dict[str, str] = {
|
||||
"PreviewWebSearchUserLocation": ".preview_websearchuserlocation",
|
||||
"PreviewWebSearchUserLocationType": ".preview_websearchuserlocation",
|
||||
"PreviewWebSearchUserLocationTypedDict": ".preview_websearchuserlocation",
|
||||
"PromptCacheBreakpoint": ".promptcachebreakpoint",
|
||||
"PromptCacheBreakpointMode": ".promptcachebreakpoint",
|
||||
"PromptCacheBreakpointTypedDict": ".promptcachebreakpoint",
|
||||
"PromptCacheOptions": ".promptcacheoptions",
|
||||
"PromptCacheOptionsMode": ".promptcacheoptions",
|
||||
"PromptCacheOptionsTypedDict": ".promptcacheoptions",
|
||||
"PromptInjectionScanScope": ".promptinjectionscanscope",
|
||||
"ProviderName": ".providername",
|
||||
"ProviderOptions": ".provideroptions",
|
||||
@@ -6390,6 +6414,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"RankingsDailyResponseTypedDict": ".rankingsdailyresponse",
|
||||
"ReasoningConfig": ".reasoningconfig",
|
||||
"ReasoningConfigTypedDict": ".reasoningconfig",
|
||||
"ReasoningContext": ".reasoningcontext",
|
||||
"ReasoningDeltaEvent": ".reasoningdeltaevent",
|
||||
"ReasoningDeltaEventType": ".reasoningdeltaevent",
|
||||
"ReasoningDeltaEventTypedDict": ".reasoningdeltaevent",
|
||||
|
||||
@@ -53,7 +53,7 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
BaseInputsContent1TypedDict = TypeAliasType(
|
||||
"BaseInputsContent1TypedDict",
|
||||
Union[
|
||||
InputTextTypedDict, InputAudioTypedDict, InputImageTypedDict, InputFileTypedDict
|
||||
InputAudioTypedDict, InputTextTypedDict, InputImageTypedDict, InputFileTypedDict
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""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
|
||||
@@ -16,6 +17,8 @@ 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."""
|
||||
@@ -23,6 +26,9 @@ class BaseReasoningConfigTypedDict(TypedDict):
|
||||
|
||||
|
||||
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
|
||||
@@ -32,8 +38,8 @@ class BaseReasoningConfig(BaseModel):
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["effort", "mode", "summary"])
|
||||
nullable_fields = set(["effort", "mode", "summary"])
|
||||
optional_fields = set(["context", "effort", "mode", "summary"])
|
||||
nullable_fields = set(["context", "effort", "mode", "summary"])
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
|
||||
|
||||
@@ -79,9 +79,9 @@ class EasyInputMessageContentInputImage(BaseModel):
|
||||
EasyInputMessageContentUnion1TypedDict = TypeAliasType(
|
||||
"EasyInputMessageContentUnion1TypedDict",
|
||||
Union[
|
||||
InputTextTypedDict,
|
||||
InputAudioTypedDict,
|
||||
InputVideoTypedDict,
|
||||
InputTextTypedDict,
|
||||
EasyInputMessageContentInputImageTypedDict,
|
||||
InputFileTypedDict,
|
||||
],
|
||||
|
||||
@@ -79,9 +79,9 @@ class InputMessageItemContentInputImage(BaseModel):
|
||||
InputMessageItemContentUnionTypedDict = TypeAliasType(
|
||||
"InputMessageItemContentUnionTypedDict",
|
||||
Union[
|
||||
InputTextTypedDict,
|
||||
InputAudioTypedDict,
|
||||
InputVideoTypedDict,
|
||||
InputTextTypedDict,
|
||||
InputMessageItemContentInputImageTypedDict,
|
||||
InputFileTypedDict,
|
||||
],
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from .promptcachebreakpoint import PromptCacheBreakpoint, PromptCacheBreakpointTypedDict
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
InputTextType = Literal["input_text",]
|
||||
@@ -14,6 +22,8 @@ class InputTextTypedDict(TypedDict):
|
||||
|
||||
text: str
|
||||
type: InputTextType
|
||||
prompt_cache_breakpoint: NotRequired[Nullable[PromptCacheBreakpointTypedDict]]
|
||||
r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer."""
|
||||
|
||||
|
||||
class InputText(BaseModel):
|
||||
@@ -22,3 +32,31 @@ class InputText(BaseModel):
|
||||
text: str
|
||||
|
||||
type: InputTextType
|
||||
|
||||
prompt_cache_breakpoint: OptionalNullable[PromptCacheBreakpoint] = UNSET
|
||||
r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["prompt_cache_breakpoint"])
|
||||
nullable_fields = set(["prompt_cache_breakpoint"])
|
||||
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
|
||||
|
||||
@@ -17,7 +17,7 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
OpenAIResponseInputMessageItemContentTypedDict = TypeAliasType(
|
||||
"OpenAIResponseInputMessageItemContentTypedDict",
|
||||
Union[
|
||||
InputTextTypedDict, InputAudioTypedDict, InputImageTypedDict, InputFileTypedDict
|
||||
InputAudioTypedDict, InputTextTypedDict, InputImageTypedDict, InputFileTypedDict
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
PromptCacheBreakpointMode = Literal["explicit",]
|
||||
|
||||
|
||||
class PromptCacheBreakpointTypedDict(TypedDict):
|
||||
r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer."""
|
||||
|
||||
mode: PromptCacheBreakpointMode
|
||||
|
||||
|
||||
class PromptCacheBreakpoint(BaseModel):
|
||||
r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer."""
|
||||
|
||||
mode: PromptCacheBreakpointMode
|
||||
@@ -0,0 +1,56 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
PromptCacheOptionsMode = Literal["explicit",]
|
||||
|
||||
|
||||
class PromptCacheOptionsTypedDict(TypedDict):
|
||||
r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer."""
|
||||
|
||||
mode: PromptCacheOptionsMode
|
||||
ttl: NotRequired[Nullable[str]]
|
||||
|
||||
|
||||
class PromptCacheOptions(BaseModel):
|
||||
r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer."""
|
||||
|
||||
mode: PromptCacheOptionsMode
|
||||
|
||||
ttl: OptionalNullable[str] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["ttl"])
|
||||
nullable_fields = set(["ttl"])
|
||||
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
|
||||
@@ -1,6 +1,7 @@
|
||||
"""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
|
||||
@@ -18,6 +19,8 @@ from typing_extensions import NotRequired, TypedDict
|
||||
class ReasoningConfigTypedDict(TypedDict):
|
||||
r"""Configuration for reasoning mode in the response"""
|
||||
|
||||
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."""
|
||||
@@ -29,6 +32,9 @@ class ReasoningConfigTypedDict(TypedDict):
|
||||
class ReasoningConfig(BaseModel):
|
||||
r"""Configuration for reasoning mode in the response"""
|
||||
|
||||
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
|
||||
@@ -42,8 +48,12 @@ class ReasoningConfig(BaseModel):
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["effort", "mode", "summary", "enabled", "max_tokens"])
|
||||
nullable_fields = set(["effort", "mode", "summary", "enabled", "max_tokens"])
|
||||
optional_fields = set(
|
||||
["context", "effort", "mode", "summary", "enabled", "max_tokens"]
|
||||
)
|
||||
nullable_fields = set(
|
||||
["context", "effort", "mode", "summary", "enabled", "max_tokens"]
|
||||
)
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
ReasoningContext = Union[
|
||||
Literal[
|
||||
"auto",
|
||||
"all_turns",
|
||||
"current_turn",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
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."""
|
||||
@@ -72,6 +72,7 @@ from .preview_websearchservertool import (
|
||||
PreviewWebSearchServerTool,
|
||||
PreviewWebSearchServerToolTypedDict,
|
||||
)
|
||||
from .promptcacheoptions import PromptCacheOptions, PromptCacheOptionsTypedDict
|
||||
from .providerpreferences import ProviderPreferences, ProviderPreferencesTypedDict
|
||||
from .reasoningconfig import ReasoningConfig, ReasoningConfigTypedDict
|
||||
from .responsehealingplugin import ResponseHealingPlugin, ResponseHealingPluginTypedDict
|
||||
@@ -314,6 +315,8 @@ class ResponsesRequestTypedDict(TypedDict):
|
||||
previous_response_id: NotRequired[Nullable[str]]
|
||||
prompt: NotRequired[Nullable[StoredPromptTemplateTypedDict]]
|
||||
prompt_cache_key: NotRequired[Nullable[str]]
|
||||
prompt_cache_options: NotRequired[Nullable[PromptCacheOptionsTypedDict]]
|
||||
r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer."""
|
||||
provider: NotRequired[Nullable[ProviderPreferencesTypedDict]]
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
reasoning: NotRequired[Nullable[ReasoningConfigTypedDict]]
|
||||
@@ -391,6 +394,9 @@ class ResponsesRequest(BaseModel):
|
||||
|
||||
prompt_cache_key: OptionalNullable[str] = UNSET
|
||||
|
||||
prompt_cache_options: OptionalNullable[PromptCacheOptions] = UNSET
|
||||
r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer."""
|
||||
|
||||
provider: OptionalNullable[ProviderPreferences] = UNSET
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
|
||||
@@ -461,6 +467,7 @@ class ResponsesRequest(BaseModel):
|
||||
"previous_response_id",
|
||||
"prompt",
|
||||
"prompt_cache_key",
|
||||
"prompt_cache_options",
|
||||
"provider",
|
||||
"reasoning",
|
||||
"safety_identifier",
|
||||
@@ -495,6 +502,7 @@ class ResponsesRequest(BaseModel):
|
||||
"previous_response_id",
|
||||
"prompt",
|
||||
"prompt_cache_key",
|
||||
"prompt_cache_options",
|
||||
"provider",
|
||||
"reasoning",
|
||||
"safety_identifier",
|
||||
|
||||
@@ -15,11 +15,39 @@ from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
class InputTokensDetailsTypedDict(TypedDict):
|
||||
cached_tokens: int
|
||||
cache_write_tokens: NotRequired[Nullable[int]]
|
||||
|
||||
|
||||
class InputTokensDetails(BaseModel):
|
||||
cached_tokens: int
|
||||
|
||||
cache_write_tokens: OptionalNullable[int] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["cache_write_tokens"])
|
||||
nullable_fields = set(["cache_write_tokens"])
|
||||
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
|
||||
|
||||
|
||||
class OutputTokensDetailsTypedDict(TypedDict):
|
||||
reasoning_tokens: int
|
||||
|
||||
Reference in New Issue
Block a user