mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-08-01 12:40:23 +08:00
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
import importlib.metadata
|
||||
|
||||
__title__: str = "openrouter"
|
||||
__version__: str = "0.3.3"
|
||||
__version__: str = "0.4.1"
|
||||
__openapi_doc_version__: str = "1.0.0"
|
||||
__gen_version__: str = "2.694.1"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.3.3 2.694.1 1.0.0 openrouter"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.4.1 2.694.1 1.0.0 openrouter"
|
||||
|
||||
try:
|
||||
if __package__ is not None:
|
||||
|
||||
+587
-134
@@ -21,110 +21,7 @@ class CompleteAcceptEnum(str, Enum):
|
||||
|
||||
|
||||
class Chat(BaseSDK):
|
||||
# region sdk-class-body
|
||||
@overload
|
||||
def complete(
|
||||
self,
|
||||
*,
|
||||
messages: Union[
|
||||
List[models.ChatCompletionMessageParam],
|
||||
List[models.ChatCompletionMessageParamTypedDict],
|
||||
],
|
||||
model: Optional[str] = None,
|
||||
stream: Literal[True],
|
||||
stream_options: OptionalNullable[
|
||||
Union[models.StreamOptions, models.StreamOptionsTypedDict]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = 1,
|
||||
tool_choice: Optional[
|
||||
Union[
|
||||
models.ChatCompletionToolChoiceOption,
|
||||
models.ChatCompletionToolChoiceOptionTypedDict,
|
||||
]
|
||||
] = None,
|
||||
tools: Optional[
|
||||
Union[
|
||||
List[models.ChatCompletionTool],
|
||||
List[models.ChatCompletionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = 1,
|
||||
user: Optional[str] = None,
|
||||
model_list: OptionalNullable[List[str]] = UNSET,
|
||||
reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET,
|
||||
provider: OptionalNullable[
|
||||
Union[models.Provider, models.ProviderTypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[List[models.Plugin], List[models.PluginTypedDict]]
|
||||
] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
accept_header_override: Optional[CompleteAcceptEnum] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> eventstreaming.EventStream[models.ChatCompletionChunkWrapper]: ...
|
||||
|
||||
@overload
|
||||
def complete(
|
||||
self,
|
||||
*,
|
||||
messages: Union[
|
||||
List[models.ChatCompletionMessageParam],
|
||||
List[models.ChatCompletionMessageParamTypedDict],
|
||||
],
|
||||
model: Optional[str] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
logit_bias: OptionalNullable[Dict[str, float]] = UNSET,
|
||||
logprobs: OptionalNullable[bool] = UNSET,
|
||||
top_logprobs: OptionalNullable[float] = UNSET,
|
||||
max_completion_tokens: OptionalNullable[float] = UNSET,
|
||||
max_tokens: OptionalNullable[float] = UNSET,
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
presence_penalty: OptionalNullable[float] = UNSET,
|
||||
reasoning: OptionalNullable[
|
||||
Union[models.Reasoning, models.ReasoningTypedDict]
|
||||
] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[models.ResponseFormat, models.ResponseFormatTypedDict]
|
||||
] = None,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[Union[models.Stop, models.StopTypedDict]] = UNSET,
|
||||
stream: Union[Literal[False], None] = None,
|
||||
stream_options: OptionalNullable[
|
||||
Union[models.StreamOptions, models.StreamOptionsTypedDict]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = 1,
|
||||
tool_choice: Optional[
|
||||
Union[
|
||||
models.ChatCompletionToolChoiceOption,
|
||||
models.ChatCompletionToolChoiceOptionTypedDict,
|
||||
]
|
||||
] = None,
|
||||
tools: Optional[
|
||||
Union[
|
||||
List[models.ChatCompletionTool],
|
||||
List[models.ChatCompletionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = 1,
|
||||
user: Optional[str] = None,
|
||||
model_list: OptionalNullable[List[str]] = UNSET,
|
||||
reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET,
|
||||
provider: OptionalNullable[
|
||||
Union[models.Provider, models.ProviderTypedDict]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[List[models.Plugin], List[models.PluginTypedDict]]
|
||||
] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
accept_header_override: Optional[CompleteAcceptEnum] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> models.ChatCompletion: ...
|
||||
|
||||
# endregion sdk-class-body
|
||||
r"""Chat completion operations"""
|
||||
|
||||
def complete(
|
||||
self,
|
||||
@@ -143,16 +40,30 @@ class Chat(BaseSDK):
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
presence_penalty: OptionalNullable[float] = UNSET,
|
||||
reasoning: OptionalNullable[
|
||||
Union[models.Reasoning, models.ReasoningTypedDict]
|
||||
Union[
|
||||
models.ChatCompletionCreateParamsReasoning,
|
||||
models.ChatCompletionCreateParamsReasoningTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[models.ResponseFormat, models.ResponseFormatTypedDict]
|
||||
Union[
|
||||
models.ChatCompletionCreateParamsResponseFormatUnion,
|
||||
models.ChatCompletionCreateParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
] = None,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[Union[models.Stop, models.StopTypedDict]] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
models.ChatCompletionCreateParamsStop,
|
||||
models.ChatCompletionCreateParamsStopTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
stream: OptionalNullable[bool] = False,
|
||||
stream_options: OptionalNullable[
|
||||
Union[models.StreamOptions, models.StreamOptionsTypedDict]
|
||||
Union[
|
||||
models.ChatCompletionCreateParamsStreamOptions,
|
||||
models.ChatCompletionCreateParamsStreamOptionsTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = 1,
|
||||
tool_choice: Optional[
|
||||
@@ -169,13 +80,21 @@ class Chat(BaseSDK):
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = 1,
|
||||
user: Optional[str] = None,
|
||||
model_list: OptionalNullable[List[str]] = UNSET,
|
||||
reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET,
|
||||
fallback_models: OptionalNullable[List[str]] = UNSET,
|
||||
reasoning_effort: OptionalNullable[
|
||||
models.ChatCompletionCreateParamsReasoningEffort
|
||||
] = UNSET,
|
||||
provider: OptionalNullable[
|
||||
Union[models.Provider, models.ProviderTypedDict]
|
||||
Union[
|
||||
models.ChatCompletionCreateParamsProvider,
|
||||
models.ChatCompletionCreateParamsProviderTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[List[models.Plugin], List[models.PluginTypedDict]]
|
||||
Union[
|
||||
List[models.ChatCompletionCreateParamsPluginUnion],
|
||||
List[models.ChatCompletionCreateParamsPluginUnionTypedDict],
|
||||
]
|
||||
] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -208,7 +127,7 @@ class Chat(BaseSDK):
|
||||
:param tools: Available tools for function calling
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param user: Unique user identifier
|
||||
:param model_list: Order of models to fallback to for this request
|
||||
:param fallback_models: Order of models to fallback to for this request
|
||||
:param reasoning_effort: Reasoning effort
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
@@ -242,16 +161,18 @@ class Chat(BaseSDK):
|
||||
metadata=metadata,
|
||||
presence_penalty=presence_penalty,
|
||||
reasoning=utils.get_pydantic_model(
|
||||
reasoning, OptionalNullable[models.Reasoning]
|
||||
reasoning, OptionalNullable[models.ChatCompletionCreateParamsReasoning]
|
||||
),
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format, Optional[models.ResponseFormat]
|
||||
response_format,
|
||||
Optional[models.ChatCompletionCreateParamsResponseFormatUnion],
|
||||
),
|
||||
seed=seed,
|
||||
stop=stop,
|
||||
stream=stream,
|
||||
stream_options=utils.get_pydantic_model(
|
||||
stream_options, OptionalNullable[models.StreamOptions]
|
||||
stream_options,
|
||||
OptionalNullable[models.ChatCompletionCreateParamsStreamOptions],
|
||||
),
|
||||
temperature=temperature,
|
||||
tool_choice=utils.get_pydantic_model(
|
||||
@@ -262,12 +183,14 @@ class Chat(BaseSDK):
|
||||
),
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
model_list=model_list,
|
||||
fallback_models=fallback_models,
|
||||
reasoning_effort=reasoning_effort,
|
||||
provider=utils.get_pydantic_model(
|
||||
provider, OptionalNullable[models.Provider]
|
||||
provider, OptionalNullable[models.ChatCompletionCreateParamsProvider]
|
||||
),
|
||||
plugins=utils.get_pydantic_model(
|
||||
plugins, Optional[List[models.ChatCompletionCreateParamsPluginUnion]]
|
||||
),
|
||||
plugins=utils.get_pydantic_model(plugins, Optional[List[models.Plugin]]),
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
@@ -375,16 +298,30 @@ class Chat(BaseSDK):
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
presence_penalty: OptionalNullable[float] = UNSET,
|
||||
reasoning: OptionalNullable[
|
||||
Union[models.Reasoning, models.ReasoningTypedDict]
|
||||
Union[
|
||||
models.ChatCompletionCreateParamsReasoning,
|
||||
models.ChatCompletionCreateParamsReasoningTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[models.ResponseFormat, models.ResponseFormatTypedDict]
|
||||
Union[
|
||||
models.ChatCompletionCreateParamsResponseFormatUnion,
|
||||
models.ChatCompletionCreateParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
] = None,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[Union[models.Stop, models.StopTypedDict]] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
models.ChatCompletionCreateParamsStop,
|
||||
models.ChatCompletionCreateParamsStopTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
stream: OptionalNullable[bool] = False,
|
||||
stream_options: OptionalNullable[
|
||||
Union[models.StreamOptions, models.StreamOptionsTypedDict]
|
||||
Union[
|
||||
models.ChatCompletionCreateParamsStreamOptions,
|
||||
models.ChatCompletionCreateParamsStreamOptionsTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = 1,
|
||||
tool_choice: Optional[
|
||||
@@ -401,13 +338,21 @@ class Chat(BaseSDK):
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = 1,
|
||||
user: Optional[str] = None,
|
||||
model_list: OptionalNullable[List[str]] = UNSET,
|
||||
reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET,
|
||||
fallback_models: OptionalNullable[List[str]] = UNSET,
|
||||
reasoning_effort: OptionalNullable[
|
||||
models.ChatCompletionCreateParamsReasoningEffort
|
||||
] = UNSET,
|
||||
provider: OptionalNullable[
|
||||
Union[models.Provider, models.ProviderTypedDict]
|
||||
Union[
|
||||
models.ChatCompletionCreateParamsProvider,
|
||||
models.ChatCompletionCreateParamsProviderTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[List[models.Plugin], List[models.PluginTypedDict]]
|
||||
Union[
|
||||
List[models.ChatCompletionCreateParamsPluginUnion],
|
||||
List[models.ChatCompletionCreateParamsPluginUnionTypedDict],
|
||||
]
|
||||
] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -440,7 +385,7 @@ class Chat(BaseSDK):
|
||||
:param tools: Available tools for function calling
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param user: Unique user identifier
|
||||
:param model_list: Order of models to fallback to for this request
|
||||
:param fallback_models: Order of models to fallback to for this request
|
||||
:param reasoning_effort: Reasoning effort
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
@@ -474,16 +419,18 @@ class Chat(BaseSDK):
|
||||
metadata=metadata,
|
||||
presence_penalty=presence_penalty,
|
||||
reasoning=utils.get_pydantic_model(
|
||||
reasoning, OptionalNullable[models.Reasoning]
|
||||
reasoning, OptionalNullable[models.ChatCompletionCreateParamsReasoning]
|
||||
),
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format, Optional[models.ResponseFormat]
|
||||
response_format,
|
||||
Optional[models.ChatCompletionCreateParamsResponseFormatUnion],
|
||||
),
|
||||
seed=seed,
|
||||
stop=stop,
|
||||
stream=stream,
|
||||
stream_options=utils.get_pydantic_model(
|
||||
stream_options, OptionalNullable[models.StreamOptions]
|
||||
stream_options,
|
||||
OptionalNullable[models.ChatCompletionCreateParamsStreamOptions],
|
||||
),
|
||||
temperature=temperature,
|
||||
tool_choice=utils.get_pydantic_model(
|
||||
@@ -494,12 +441,14 @@ class Chat(BaseSDK):
|
||||
),
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
model_list=model_list,
|
||||
fallback_models=fallback_models,
|
||||
reasoning_effort=reasoning_effort,
|
||||
provider=utils.get_pydantic_model(
|
||||
provider, OptionalNullable[models.Provider]
|
||||
provider, OptionalNullable[models.ChatCompletionCreateParamsProvider]
|
||||
),
|
||||
plugins=utils.get_pydantic_model(
|
||||
plugins, Optional[List[models.ChatCompletionCreateParamsPluginUnion]]
|
||||
),
|
||||
plugins=utils.get_pydantic_model(plugins, Optional[List[models.Plugin]]),
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
@@ -589,3 +538,507 @@ class Chat(BaseSDK):
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"Unexpected response received", http_res, http_res_text
|
||||
)
|
||||
|
||||
def complete_stream(
|
||||
self,
|
||||
*,
|
||||
messages: Union[
|
||||
List[models.ChatCompletionMessageParam],
|
||||
List[models.ChatCompletionMessageParamTypedDict],
|
||||
],
|
||||
stream: OptionalNullable[bool] = False,
|
||||
model: Optional[str] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
logit_bias: OptionalNullable[Dict[str, float]] = UNSET,
|
||||
logprobs: OptionalNullable[bool] = UNSET,
|
||||
top_logprobs: OptionalNullable[float] = UNSET,
|
||||
max_completion_tokens: OptionalNullable[float] = UNSET,
|
||||
max_tokens: OptionalNullable[float] = UNSET,
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
presence_penalty: OptionalNullable[float] = UNSET,
|
||||
reasoning: OptionalNullable[
|
||||
Union[
|
||||
models.ChatStreamCompletionCreateParamsReasoning,
|
||||
models.ChatStreamCompletionCreateParamsReasoningTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[
|
||||
models.ChatStreamCompletionCreateParamsResponseFormatUnion,
|
||||
models.ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
] = None,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
models.ChatStreamCompletionCreateParamsStop,
|
||||
models.ChatStreamCompletionCreateParamsStopTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
stream_options: OptionalNullable[
|
||||
Union[
|
||||
models.ChatStreamCompletionCreateParamsStreamOptions,
|
||||
models.ChatStreamCompletionCreateParamsStreamOptionsTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = 1,
|
||||
tool_choice: Optional[
|
||||
Union[
|
||||
models.ChatCompletionToolChoiceOption,
|
||||
models.ChatCompletionToolChoiceOptionTypedDict,
|
||||
]
|
||||
] = None,
|
||||
tools: Optional[
|
||||
Union[
|
||||
List[models.ChatCompletionTool],
|
||||
List[models.ChatCompletionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = 1,
|
||||
user: Optional[str] = None,
|
||||
fallback_models: OptionalNullable[List[str]] = UNSET,
|
||||
reasoning_effort: OptionalNullable[
|
||||
models.ChatStreamCompletionCreateParamsReasoningEffort
|
||||
] = UNSET,
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
models.ChatStreamCompletionCreateParamsProvider,
|
||||
models.ChatStreamCompletionCreateParamsProviderTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[models.ChatStreamCompletionCreateParamsPluginUnion],
|
||||
List[models.ChatStreamCompletionCreateParamsPluginUnionTypedDict],
|
||||
]
|
||||
] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> eventstreaming.EventStream[models.StreamChatCompletionResponseBody]:
|
||||
r"""Create a chat completion
|
||||
|
||||
Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
:param messages: List of messages for the conversation
|
||||
:param stream: Enable streaming response
|
||||
:param model: Model to use for completion
|
||||
:param frequency_penalty: Frequency penalty (-2.0 to 2.0)
|
||||
:param logit_bias: Token logit bias adjustments
|
||||
:param logprobs: Return log probabilities
|
||||
:param top_logprobs: Number of top log probabilities to return (0-20)
|
||||
:param max_completion_tokens: Maximum tokens in completion
|
||||
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens)
|
||||
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
|
||||
:param presence_penalty: Presence penalty (-2.0 to 2.0)
|
||||
:param reasoning: Reasoning configuration
|
||||
:param response_format: Response format configuration
|
||||
:param seed: Random seed for deterministic outputs
|
||||
:param stop: Stop sequences (up to 4)
|
||||
:param stream_options:
|
||||
:param temperature: Sampling temperature (0-2)
|
||||
:param tool_choice: Tool choice configuration
|
||||
:param tools: Available tools for function calling
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param user: Unique user identifier
|
||||
:param fallback_models: Order of models to fallback to for this request
|
||||
:param reasoning_effort: Reasoning effort
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = models.ChatStreamCompletionCreateParams(
|
||||
stream=stream,
|
||||
messages=utils.get_pydantic_model(
|
||||
messages, List[models.ChatCompletionMessageParam]
|
||||
),
|
||||
model=model,
|
||||
frequency_penalty=frequency_penalty,
|
||||
logit_bias=logit_bias,
|
||||
logprobs=logprobs,
|
||||
top_logprobs=top_logprobs,
|
||||
max_completion_tokens=max_completion_tokens,
|
||||
max_tokens=max_tokens,
|
||||
metadata=metadata,
|
||||
presence_penalty=presence_penalty,
|
||||
reasoning=utils.get_pydantic_model(
|
||||
reasoning,
|
||||
OptionalNullable[models.ChatStreamCompletionCreateParamsReasoning],
|
||||
),
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format,
|
||||
Optional[models.ChatStreamCompletionCreateParamsResponseFormatUnion],
|
||||
),
|
||||
seed=seed,
|
||||
stop=stop,
|
||||
stream_options=utils.get_pydantic_model(
|
||||
stream_options,
|
||||
OptionalNullable[models.ChatStreamCompletionCreateParamsStreamOptions],
|
||||
),
|
||||
temperature=temperature,
|
||||
tool_choice=utils.get_pydantic_model(
|
||||
tool_choice, Optional[models.ChatCompletionToolChoiceOption]
|
||||
),
|
||||
tools=utils.get_pydantic_model(
|
||||
tools, Optional[List[models.ChatCompletionTool]]
|
||||
),
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
fallback_models=fallback_models,
|
||||
reasoning_effort=reasoning_effort,
|
||||
provider=utils.get_pydantic_model(
|
||||
provider,
|
||||
OptionalNullable[models.ChatStreamCompletionCreateParamsProvider],
|
||||
),
|
||||
plugins=utils.get_pydantic_model(
|
||||
plugins,
|
||||
Optional[List[models.ChatStreamCompletionCreateParamsPluginUnion]],
|
||||
),
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
method="POST",
|
||||
path="/chat/completions#stream",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=True,
|
||||
request_has_path_params=False,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="text/event-stream",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", models.ChatStreamCompletionCreateParams
|
||||
),
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
||||
|
||||
http_res = self.do_request(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="streamChatCompletion",
|
||||
oauth2_scopes=[],
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, models.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
|
||||
stream=True,
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "text/event-stream"):
|
||||
return eventstreaming.EventStream(
|
||||
http_res,
|
||||
lambda raw: utils.unmarshal_json(
|
||||
raw, models.StreamChatCompletionResponseBody
|
||||
),
|
||||
sentinel="[DONE]",
|
||||
client_ref=self,
|
||||
)
|
||||
if utils.match_response(http_res, ["400", "401", "429"], "application/json"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
response_data = unmarshal_json_response(
|
||||
errors.ChatCompletionErrorData, http_res, http_res_text
|
||||
)
|
||||
raise errors.ChatCompletionError(response_data, http_res, http_res_text)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
response_data = unmarshal_json_response(
|
||||
errors.ChatCompletionErrorData, http_res, http_res_text
|
||||
)
|
||||
raise errors.ChatCompletionError(response_data, http_res, http_res_text)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"Unexpected response received", http_res, http_res_text
|
||||
)
|
||||
|
||||
async def complete_stream_async(
|
||||
self,
|
||||
*,
|
||||
messages: Union[
|
||||
List[models.ChatCompletionMessageParam],
|
||||
List[models.ChatCompletionMessageParamTypedDict],
|
||||
],
|
||||
stream: OptionalNullable[bool] = False,
|
||||
model: Optional[str] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
logit_bias: OptionalNullable[Dict[str, float]] = UNSET,
|
||||
logprobs: OptionalNullable[bool] = UNSET,
|
||||
top_logprobs: OptionalNullable[float] = UNSET,
|
||||
max_completion_tokens: OptionalNullable[float] = UNSET,
|
||||
max_tokens: OptionalNullable[float] = UNSET,
|
||||
metadata: Optional[Dict[str, str]] = None,
|
||||
presence_penalty: OptionalNullable[float] = UNSET,
|
||||
reasoning: OptionalNullable[
|
||||
Union[
|
||||
models.ChatStreamCompletionCreateParamsReasoning,
|
||||
models.ChatStreamCompletionCreateParamsReasoningTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
response_format: Optional[
|
||||
Union[
|
||||
models.ChatStreamCompletionCreateParamsResponseFormatUnion,
|
||||
models.ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict,
|
||||
]
|
||||
] = None,
|
||||
seed: OptionalNullable[int] = UNSET,
|
||||
stop: OptionalNullable[
|
||||
Union[
|
||||
models.ChatStreamCompletionCreateParamsStop,
|
||||
models.ChatStreamCompletionCreateParamsStopTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
stream_options: OptionalNullable[
|
||||
Union[
|
||||
models.ChatStreamCompletionCreateParamsStreamOptions,
|
||||
models.ChatStreamCompletionCreateParamsStreamOptionsTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = 1,
|
||||
tool_choice: Optional[
|
||||
Union[
|
||||
models.ChatCompletionToolChoiceOption,
|
||||
models.ChatCompletionToolChoiceOptionTypedDict,
|
||||
]
|
||||
] = None,
|
||||
tools: Optional[
|
||||
Union[
|
||||
List[models.ChatCompletionTool],
|
||||
List[models.ChatCompletionToolTypedDict],
|
||||
]
|
||||
] = None,
|
||||
top_p: OptionalNullable[float] = 1,
|
||||
user: Optional[str] = None,
|
||||
fallback_models: OptionalNullable[List[str]] = UNSET,
|
||||
reasoning_effort: OptionalNullable[
|
||||
models.ChatStreamCompletionCreateParamsReasoningEffort
|
||||
] = UNSET,
|
||||
provider: OptionalNullable[
|
||||
Union[
|
||||
models.ChatStreamCompletionCreateParamsProvider,
|
||||
models.ChatStreamCompletionCreateParamsProviderTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
plugins: Optional[
|
||||
Union[
|
||||
List[models.ChatStreamCompletionCreateParamsPluginUnion],
|
||||
List[models.ChatStreamCompletionCreateParamsPluginUnionTypedDict],
|
||||
]
|
||||
] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> eventstreaming.EventStreamAsync[models.StreamChatCompletionResponseBody]:
|
||||
r"""Create a chat completion
|
||||
|
||||
Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
||||
|
||||
:param messages: List of messages for the conversation
|
||||
:param stream: Enable streaming response
|
||||
:param model: Model to use for completion
|
||||
:param frequency_penalty: Frequency penalty (-2.0 to 2.0)
|
||||
:param logit_bias: Token logit bias adjustments
|
||||
:param logprobs: Return log probabilities
|
||||
:param top_logprobs: Number of top log probabilities to return (0-20)
|
||||
:param max_completion_tokens: Maximum tokens in completion
|
||||
:param max_tokens: Maximum tokens (deprecated, use max_completion_tokens)
|
||||
:param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
|
||||
:param presence_penalty: Presence penalty (-2.0 to 2.0)
|
||||
:param reasoning: Reasoning configuration
|
||||
:param response_format: Response format configuration
|
||||
:param seed: Random seed for deterministic outputs
|
||||
:param stop: Stop sequences (up to 4)
|
||||
:param stream_options:
|
||||
:param temperature: Sampling temperature (0-2)
|
||||
:param tool_choice: Tool choice configuration
|
||||
:param tools: Available tools for function calling
|
||||
:param top_p: Nucleus sampling parameter (0-1)
|
||||
:param user: Unique user identifier
|
||||
:param fallback_models: Order of models to fallback to for this request
|
||||
:param reasoning_effort: Reasoning effort
|
||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
:param http_headers: Additional headers to set or replace on requests.
|
||||
"""
|
||||
base_url = None
|
||||
url_variables = None
|
||||
if timeout_ms is None:
|
||||
timeout_ms = self.sdk_configuration.timeout_ms
|
||||
|
||||
if server_url is not None:
|
||||
base_url = server_url
|
||||
else:
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = models.ChatStreamCompletionCreateParams(
|
||||
stream=stream,
|
||||
messages=utils.get_pydantic_model(
|
||||
messages, List[models.ChatCompletionMessageParam]
|
||||
),
|
||||
model=model,
|
||||
frequency_penalty=frequency_penalty,
|
||||
logit_bias=logit_bias,
|
||||
logprobs=logprobs,
|
||||
top_logprobs=top_logprobs,
|
||||
max_completion_tokens=max_completion_tokens,
|
||||
max_tokens=max_tokens,
|
||||
metadata=metadata,
|
||||
presence_penalty=presence_penalty,
|
||||
reasoning=utils.get_pydantic_model(
|
||||
reasoning,
|
||||
OptionalNullable[models.ChatStreamCompletionCreateParamsReasoning],
|
||||
),
|
||||
response_format=utils.get_pydantic_model(
|
||||
response_format,
|
||||
Optional[models.ChatStreamCompletionCreateParamsResponseFormatUnion],
|
||||
),
|
||||
seed=seed,
|
||||
stop=stop,
|
||||
stream_options=utils.get_pydantic_model(
|
||||
stream_options,
|
||||
OptionalNullable[models.ChatStreamCompletionCreateParamsStreamOptions],
|
||||
),
|
||||
temperature=temperature,
|
||||
tool_choice=utils.get_pydantic_model(
|
||||
tool_choice, Optional[models.ChatCompletionToolChoiceOption]
|
||||
),
|
||||
tools=utils.get_pydantic_model(
|
||||
tools, Optional[List[models.ChatCompletionTool]]
|
||||
),
|
||||
top_p=top_p,
|
||||
user=user,
|
||||
fallback_models=fallback_models,
|
||||
reasoning_effort=reasoning_effort,
|
||||
provider=utils.get_pydantic_model(
|
||||
provider,
|
||||
OptionalNullable[models.ChatStreamCompletionCreateParamsProvider],
|
||||
),
|
||||
plugins=utils.get_pydantic_model(
|
||||
plugins,
|
||||
Optional[List[models.ChatStreamCompletionCreateParamsPluginUnion]],
|
||||
),
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
method="POST",
|
||||
path="/chat/completions#stream",
|
||||
base_url=base_url,
|
||||
url_variables=url_variables,
|
||||
request=request,
|
||||
request_body_required=True,
|
||||
request_has_path_params=False,
|
||||
request_has_query_params=True,
|
||||
user_agent_header="user-agent",
|
||||
accept_header_value="text/event-stream",
|
||||
http_headers=http_headers,
|
||||
security=self.sdk_configuration.security,
|
||||
get_serialized_body=lambda: utils.serialize_request_body(
|
||||
request, False, False, "json", models.ChatStreamCompletionCreateParams
|
||||
),
|
||||
timeout_ms=timeout_ms,
|
||||
)
|
||||
|
||||
if retries == UNSET:
|
||||
if self.sdk_configuration.retry_config is not UNSET:
|
||||
retries = self.sdk_configuration.retry_config
|
||||
|
||||
retry_config = None
|
||||
if isinstance(retries, utils.RetryConfig):
|
||||
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
||||
|
||||
http_res = await self.do_request_async(
|
||||
hook_ctx=HookContext(
|
||||
config=self.sdk_configuration,
|
||||
base_url=base_url or "",
|
||||
operation_id="streamChatCompletion",
|
||||
oauth2_scopes=[],
|
||||
security_source=get_security_from_env(
|
||||
self.sdk_configuration.security, models.Security
|
||||
),
|
||||
),
|
||||
request=req,
|
||||
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
|
||||
stream=True,
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "text/event-stream"):
|
||||
return eventstreaming.EventStreamAsync(
|
||||
http_res,
|
||||
lambda raw: utils.unmarshal_json(
|
||||
raw, models.StreamChatCompletionResponseBody
|
||||
),
|
||||
sentinel="[DONE]",
|
||||
client_ref=self,
|
||||
)
|
||||
if utils.match_response(http_res, ["400", "401", "429"], "application/json"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
response_data = unmarshal_json_response(
|
||||
errors.ChatCompletionErrorData, http_res, http_res_text
|
||||
)
|
||||
raise errors.ChatCompletionError(response_data, http_res, http_res_text)
|
||||
if utils.match_response(http_res, "500", "application/json"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
response_data = unmarshal_json_response(
|
||||
errors.ChatCompletionErrorData, http_res, http_res_text
|
||||
)
|
||||
raise errors.ChatCompletionError(response_data, http_res, http_res_text)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
if utils.match_response(http_res, "5XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"API error occurred", http_res, http_res_text
|
||||
)
|
||||
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.OpenRouterDefaultError(
|
||||
"Unexpected response received", http_res, http_res_text
|
||||
)
|
||||
|
||||
+439
-210
@@ -76,79 +76,79 @@ if TYPE_CHECKING:
|
||||
ChatCompletionContentPartTextTypedDict,
|
||||
)
|
||||
from .chatcompletioncreateparams import (
|
||||
Audio,
|
||||
AudioTypedDict,
|
||||
ChatCompletionCreateParams,
|
||||
ChatCompletionCreateParamsAudio,
|
||||
ChatCompletionCreateParamsAudioTypedDict,
|
||||
ChatCompletionCreateParamsCompletion,
|
||||
ChatCompletionCreateParamsCompletionTypedDict,
|
||||
ChatCompletionCreateParamsDataCollection,
|
||||
ChatCompletionCreateParamsEffort,
|
||||
ChatCompletionCreateParamsEngine,
|
||||
ChatCompletionCreateParamsIDChainOfThought,
|
||||
ChatCompletionCreateParamsIDFileParser,
|
||||
ChatCompletionCreateParamsIDModeration,
|
||||
ChatCompletionCreateParamsIDWeb,
|
||||
ChatCompletionCreateParamsIgnoreEnum,
|
||||
ChatCompletionCreateParamsIgnoreUnion,
|
||||
ChatCompletionCreateParamsIgnoreUnionTypedDict,
|
||||
ChatCompletionCreateParamsImage,
|
||||
ChatCompletionCreateParamsImageTypedDict,
|
||||
ChatCompletionCreateParamsJSONSchema,
|
||||
ChatCompletionCreateParamsJSONSchemaTypedDict,
|
||||
ChatCompletionCreateParamsMaxPrice,
|
||||
ChatCompletionCreateParamsMaxPriceTypedDict,
|
||||
ChatCompletionCreateParamsOnlyEnum,
|
||||
ChatCompletionCreateParamsOnlyUnion,
|
||||
ChatCompletionCreateParamsOnlyUnionTypedDict,
|
||||
ChatCompletionCreateParamsOrderEnum,
|
||||
ChatCompletionCreateParamsOrderUnion,
|
||||
ChatCompletionCreateParamsOrderUnionTypedDict,
|
||||
ChatCompletionCreateParamsPdf,
|
||||
ChatCompletionCreateParamsPdfEngine,
|
||||
ChatCompletionCreateParamsPdfTypedDict,
|
||||
ChatCompletionCreateParamsPluginChainOfThought,
|
||||
ChatCompletionCreateParamsPluginChainOfThoughtTypedDict,
|
||||
ChatCompletionCreateParamsPluginFileParser,
|
||||
ChatCompletionCreateParamsPluginFileParserTypedDict,
|
||||
ChatCompletionCreateParamsPluginModeration,
|
||||
ChatCompletionCreateParamsPluginModerationTypedDict,
|
||||
ChatCompletionCreateParamsPluginUnion,
|
||||
ChatCompletionCreateParamsPluginUnionTypedDict,
|
||||
ChatCompletionCreateParamsPluginWeb,
|
||||
ChatCompletionCreateParamsPluginWebTypedDict,
|
||||
ChatCompletionCreateParamsPrompt,
|
||||
ChatCompletionCreateParamsPromptTypedDict,
|
||||
ChatCompletionCreateParamsProvider,
|
||||
ChatCompletionCreateParamsProviderTypedDict,
|
||||
ChatCompletionCreateParamsQuantization,
|
||||
ChatCompletionCreateParamsReasoning,
|
||||
ChatCompletionCreateParamsReasoningEffort,
|
||||
ChatCompletionCreateParamsReasoningTypedDict,
|
||||
ChatCompletionCreateParamsRequest,
|
||||
ChatCompletionCreateParamsRequestTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatGrammar,
|
||||
ChatCompletionCreateParamsResponseFormatGrammarTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatJSONObject,
|
||||
ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatJSONSchema,
|
||||
ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatPython,
|
||||
ChatCompletionCreateParamsResponseFormatPythonTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatText,
|
||||
ChatCompletionCreateParamsResponseFormatTextTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatUnion,
|
||||
ChatCompletionCreateParamsResponseFormatUnionTypedDict,
|
||||
ChatCompletionCreateParamsSort,
|
||||
ChatCompletionCreateParamsStop,
|
||||
ChatCompletionCreateParamsStopTypedDict,
|
||||
ChatCompletionCreateParamsStreamOptions,
|
||||
ChatCompletionCreateParamsStreamOptionsTypedDict,
|
||||
ChatCompletionCreateParamsTypeGrammar,
|
||||
ChatCompletionCreateParamsTypeJSONObject,
|
||||
ChatCompletionCreateParamsTypeJSONSchema,
|
||||
ChatCompletionCreateParamsTypePython,
|
||||
ChatCompletionCreateParamsTypeText,
|
||||
ChatCompletionCreateParamsTypedDict,
|
||||
Completion,
|
||||
CompletionTypedDict,
|
||||
DataCollection,
|
||||
Effort,
|
||||
Engine,
|
||||
IDChainOfThought,
|
||||
IDFileParser,
|
||||
IDModeration,
|
||||
IDWeb,
|
||||
Ignore,
|
||||
IgnoreEnum,
|
||||
IgnoreTypedDict,
|
||||
Image,
|
||||
ImageTypedDict,
|
||||
JSONSchema,
|
||||
JSONSchemaTypedDict,
|
||||
MaxPrice,
|
||||
MaxPriceTypedDict,
|
||||
Only,
|
||||
OnlyEnum,
|
||||
OnlyTypedDict,
|
||||
Order,
|
||||
OrderEnum,
|
||||
OrderTypedDict,
|
||||
Pdf,
|
||||
PdfEngine,
|
||||
PdfTypedDict,
|
||||
Plugin,
|
||||
PluginChainOfThought,
|
||||
PluginChainOfThoughtTypedDict,
|
||||
PluginFileParser,
|
||||
PluginFileParserTypedDict,
|
||||
PluginModeration,
|
||||
PluginModerationTypedDict,
|
||||
PluginTypedDict,
|
||||
PluginWeb,
|
||||
PluginWebTypedDict,
|
||||
Prompt,
|
||||
PromptTypedDict,
|
||||
Provider,
|
||||
ProviderTypedDict,
|
||||
Quantization,
|
||||
Reasoning,
|
||||
ReasoningEffort,
|
||||
ReasoningTypedDict,
|
||||
Request,
|
||||
RequestTypedDict,
|
||||
ResponseFormat,
|
||||
ResponseFormatGrammar,
|
||||
ResponseFormatGrammarTypedDict,
|
||||
ResponseFormatJSONObject,
|
||||
ResponseFormatJSONObjectTypedDict,
|
||||
ResponseFormatJSONSchema,
|
||||
ResponseFormatJSONSchemaTypedDict,
|
||||
ResponseFormatPython,
|
||||
ResponseFormatPythonTypedDict,
|
||||
ResponseFormatText,
|
||||
ResponseFormatTextTypedDict,
|
||||
ResponseFormatTypedDict,
|
||||
Sort,
|
||||
Stop,
|
||||
StopTypedDict,
|
||||
StreamOptions,
|
||||
StreamOptionsTypedDict,
|
||||
TypeGrammar,
|
||||
TypeJSONObject,
|
||||
TypeJSONSchema,
|
||||
TypePython,
|
||||
)
|
||||
from .chatcompletionerror import Error, ErrorTypedDict
|
||||
from .chatcompletionmessage import (
|
||||
@@ -221,6 +221,81 @@ if TYPE_CHECKING:
|
||||
ChatCompletionUserMessageParamRole,
|
||||
ChatCompletionUserMessageParamTypedDict,
|
||||
)
|
||||
from .chatstreamcompletioncreateparams import (
|
||||
ChatStreamCompletionCreateParams,
|
||||
ChatStreamCompletionCreateParamsAudio,
|
||||
ChatStreamCompletionCreateParamsAudioTypedDict,
|
||||
ChatStreamCompletionCreateParamsCompletion,
|
||||
ChatStreamCompletionCreateParamsCompletionTypedDict,
|
||||
ChatStreamCompletionCreateParamsDataCollection,
|
||||
ChatStreamCompletionCreateParamsEffort,
|
||||
ChatStreamCompletionCreateParamsEngine,
|
||||
ChatStreamCompletionCreateParamsIDChainOfThought,
|
||||
ChatStreamCompletionCreateParamsIDFileParser,
|
||||
ChatStreamCompletionCreateParamsIDModeration,
|
||||
ChatStreamCompletionCreateParamsIDWeb,
|
||||
ChatStreamCompletionCreateParamsIgnoreEnum,
|
||||
ChatStreamCompletionCreateParamsIgnoreUnion,
|
||||
ChatStreamCompletionCreateParamsIgnoreUnionTypedDict,
|
||||
ChatStreamCompletionCreateParamsImage,
|
||||
ChatStreamCompletionCreateParamsImageTypedDict,
|
||||
ChatStreamCompletionCreateParamsJSONSchema,
|
||||
ChatStreamCompletionCreateParamsJSONSchemaTypedDict,
|
||||
ChatStreamCompletionCreateParamsMaxPrice,
|
||||
ChatStreamCompletionCreateParamsMaxPriceTypedDict,
|
||||
ChatStreamCompletionCreateParamsOnlyEnum,
|
||||
ChatStreamCompletionCreateParamsOnlyUnion,
|
||||
ChatStreamCompletionCreateParamsOnlyUnionTypedDict,
|
||||
ChatStreamCompletionCreateParamsOrderEnum,
|
||||
ChatStreamCompletionCreateParamsOrderUnion,
|
||||
ChatStreamCompletionCreateParamsOrderUnionTypedDict,
|
||||
ChatStreamCompletionCreateParamsPdf,
|
||||
ChatStreamCompletionCreateParamsPdfEngine,
|
||||
ChatStreamCompletionCreateParamsPdfTypedDict,
|
||||
ChatStreamCompletionCreateParamsPluginChainOfThought,
|
||||
ChatStreamCompletionCreateParamsPluginChainOfThoughtTypedDict,
|
||||
ChatStreamCompletionCreateParamsPluginFileParser,
|
||||
ChatStreamCompletionCreateParamsPluginFileParserTypedDict,
|
||||
ChatStreamCompletionCreateParamsPluginModeration,
|
||||
ChatStreamCompletionCreateParamsPluginModerationTypedDict,
|
||||
ChatStreamCompletionCreateParamsPluginUnion,
|
||||
ChatStreamCompletionCreateParamsPluginUnionTypedDict,
|
||||
ChatStreamCompletionCreateParamsPluginWeb,
|
||||
ChatStreamCompletionCreateParamsPluginWebTypedDict,
|
||||
ChatStreamCompletionCreateParamsPrompt,
|
||||
ChatStreamCompletionCreateParamsPromptTypedDict,
|
||||
ChatStreamCompletionCreateParamsProvider,
|
||||
ChatStreamCompletionCreateParamsProviderTypedDict,
|
||||
ChatStreamCompletionCreateParamsQuantization,
|
||||
ChatStreamCompletionCreateParamsReasoning,
|
||||
ChatStreamCompletionCreateParamsReasoningEffort,
|
||||
ChatStreamCompletionCreateParamsReasoningTypedDict,
|
||||
ChatStreamCompletionCreateParamsRequest,
|
||||
ChatStreamCompletionCreateParamsRequestTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatGrammar,
|
||||
ChatStreamCompletionCreateParamsResponseFormatGrammarTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatJSONObject,
|
||||
ChatStreamCompletionCreateParamsResponseFormatJSONObjectTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatJSONSchema,
|
||||
ChatStreamCompletionCreateParamsResponseFormatJSONSchemaTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatPython,
|
||||
ChatStreamCompletionCreateParamsResponseFormatPythonTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatText,
|
||||
ChatStreamCompletionCreateParamsResponseFormatTextTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatUnion,
|
||||
ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict,
|
||||
ChatStreamCompletionCreateParamsSort,
|
||||
ChatStreamCompletionCreateParamsStop,
|
||||
ChatStreamCompletionCreateParamsStopTypedDict,
|
||||
ChatStreamCompletionCreateParamsStreamOptions,
|
||||
ChatStreamCompletionCreateParamsStreamOptionsTypedDict,
|
||||
ChatStreamCompletionCreateParamsTypeGrammar,
|
||||
ChatStreamCompletionCreateParamsTypeJSONObject,
|
||||
ChatStreamCompletionCreateParamsTypeJSONSchema,
|
||||
ChatStreamCompletionCreateParamsTypePython,
|
||||
ChatStreamCompletionCreateParamsTypeText,
|
||||
ChatStreamCompletionCreateParamsTypedDict,
|
||||
)
|
||||
from .completionusage import (
|
||||
CompletionTokensDetails,
|
||||
CompletionTokensDetailsTypedDict,
|
||||
@@ -274,6 +349,10 @@ if TYPE_CHECKING:
|
||||
ResponseFormatJSONSchemaSchemaTypedDict,
|
||||
)
|
||||
from .security import Security, SecurityTypedDict
|
||||
from .streamchatcompletionop import (
|
||||
StreamChatCompletionResponseBody,
|
||||
StreamChatCompletionResponseBodyTypedDict,
|
||||
)
|
||||
from .urlcitationannotationdetail import (
|
||||
URLCitation,
|
||||
URLCitationAnnotationDetail,
|
||||
@@ -285,8 +364,6 @@ if TYPE_CHECKING:
|
||||
__all__ = [
|
||||
"AnnotationDetail",
|
||||
"AnnotationDetailTypedDict",
|
||||
"Audio",
|
||||
"AudioTypedDict",
|
||||
"ChatCompletion",
|
||||
"ChatCompletionAssistantMessageParam",
|
||||
"ChatCompletionAssistantMessageParamContent",
|
||||
@@ -327,6 +404,76 @@ __all__ = [
|
||||
"ChatCompletionContentPartTextTypedDict",
|
||||
"ChatCompletionContentPartTypedDict",
|
||||
"ChatCompletionCreateParams",
|
||||
"ChatCompletionCreateParamsAudio",
|
||||
"ChatCompletionCreateParamsAudioTypedDict",
|
||||
"ChatCompletionCreateParamsCompletion",
|
||||
"ChatCompletionCreateParamsCompletionTypedDict",
|
||||
"ChatCompletionCreateParamsDataCollection",
|
||||
"ChatCompletionCreateParamsEffort",
|
||||
"ChatCompletionCreateParamsEngine",
|
||||
"ChatCompletionCreateParamsIDChainOfThought",
|
||||
"ChatCompletionCreateParamsIDFileParser",
|
||||
"ChatCompletionCreateParamsIDModeration",
|
||||
"ChatCompletionCreateParamsIDWeb",
|
||||
"ChatCompletionCreateParamsIgnoreEnum",
|
||||
"ChatCompletionCreateParamsIgnoreUnion",
|
||||
"ChatCompletionCreateParamsIgnoreUnionTypedDict",
|
||||
"ChatCompletionCreateParamsImage",
|
||||
"ChatCompletionCreateParamsImageTypedDict",
|
||||
"ChatCompletionCreateParamsJSONSchema",
|
||||
"ChatCompletionCreateParamsJSONSchemaTypedDict",
|
||||
"ChatCompletionCreateParamsMaxPrice",
|
||||
"ChatCompletionCreateParamsMaxPriceTypedDict",
|
||||
"ChatCompletionCreateParamsOnlyEnum",
|
||||
"ChatCompletionCreateParamsOnlyUnion",
|
||||
"ChatCompletionCreateParamsOnlyUnionTypedDict",
|
||||
"ChatCompletionCreateParamsOrderEnum",
|
||||
"ChatCompletionCreateParamsOrderUnion",
|
||||
"ChatCompletionCreateParamsOrderUnionTypedDict",
|
||||
"ChatCompletionCreateParamsPdf",
|
||||
"ChatCompletionCreateParamsPdfEngine",
|
||||
"ChatCompletionCreateParamsPdfTypedDict",
|
||||
"ChatCompletionCreateParamsPluginChainOfThought",
|
||||
"ChatCompletionCreateParamsPluginChainOfThoughtTypedDict",
|
||||
"ChatCompletionCreateParamsPluginFileParser",
|
||||
"ChatCompletionCreateParamsPluginFileParserTypedDict",
|
||||
"ChatCompletionCreateParamsPluginModeration",
|
||||
"ChatCompletionCreateParamsPluginModerationTypedDict",
|
||||
"ChatCompletionCreateParamsPluginUnion",
|
||||
"ChatCompletionCreateParamsPluginUnionTypedDict",
|
||||
"ChatCompletionCreateParamsPluginWeb",
|
||||
"ChatCompletionCreateParamsPluginWebTypedDict",
|
||||
"ChatCompletionCreateParamsPrompt",
|
||||
"ChatCompletionCreateParamsPromptTypedDict",
|
||||
"ChatCompletionCreateParamsProvider",
|
||||
"ChatCompletionCreateParamsProviderTypedDict",
|
||||
"ChatCompletionCreateParamsQuantization",
|
||||
"ChatCompletionCreateParamsReasoning",
|
||||
"ChatCompletionCreateParamsReasoningEffort",
|
||||
"ChatCompletionCreateParamsReasoningTypedDict",
|
||||
"ChatCompletionCreateParamsRequest",
|
||||
"ChatCompletionCreateParamsRequestTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatGrammar",
|
||||
"ChatCompletionCreateParamsResponseFormatGrammarTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONObject",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONSchema",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatPython",
|
||||
"ChatCompletionCreateParamsResponseFormatPythonTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatText",
|
||||
"ChatCompletionCreateParamsResponseFormatTextTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatUnion",
|
||||
"ChatCompletionCreateParamsResponseFormatUnionTypedDict",
|
||||
"ChatCompletionCreateParamsSort",
|
||||
"ChatCompletionCreateParamsStop",
|
||||
"ChatCompletionCreateParamsStopTypedDict",
|
||||
"ChatCompletionCreateParamsStreamOptions",
|
||||
"ChatCompletionCreateParamsStreamOptionsTypedDict",
|
||||
"ChatCompletionCreateParamsTypeGrammar",
|
||||
"ChatCompletionCreateParamsTypeJSONObject",
|
||||
"ChatCompletionCreateParamsTypeJSONSchema",
|
||||
"ChatCompletionCreateParamsTypePython",
|
||||
"ChatCompletionCreateParamsTypeText",
|
||||
"ChatCompletionCreateParamsTypedDict",
|
||||
"ChatCompletionMessage",
|
||||
@@ -375,10 +522,81 @@ __all__ = [
|
||||
"ChatCompletionUserMessageParamContentTypedDict",
|
||||
"ChatCompletionUserMessageParamRole",
|
||||
"ChatCompletionUserMessageParamTypedDict",
|
||||
"Completion",
|
||||
"ChatStreamCompletionCreateParams",
|
||||
"ChatStreamCompletionCreateParamsAudio",
|
||||
"ChatStreamCompletionCreateParamsAudioTypedDict",
|
||||
"ChatStreamCompletionCreateParamsCompletion",
|
||||
"ChatStreamCompletionCreateParamsCompletionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsDataCollection",
|
||||
"ChatStreamCompletionCreateParamsEffort",
|
||||
"ChatStreamCompletionCreateParamsEngine",
|
||||
"ChatStreamCompletionCreateParamsIDChainOfThought",
|
||||
"ChatStreamCompletionCreateParamsIDFileParser",
|
||||
"ChatStreamCompletionCreateParamsIDModeration",
|
||||
"ChatStreamCompletionCreateParamsIDWeb",
|
||||
"ChatStreamCompletionCreateParamsIgnoreEnum",
|
||||
"ChatStreamCompletionCreateParamsIgnoreUnion",
|
||||
"ChatStreamCompletionCreateParamsIgnoreUnionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsImage",
|
||||
"ChatStreamCompletionCreateParamsImageTypedDict",
|
||||
"ChatStreamCompletionCreateParamsJSONSchema",
|
||||
"ChatStreamCompletionCreateParamsJSONSchemaTypedDict",
|
||||
"ChatStreamCompletionCreateParamsMaxPrice",
|
||||
"ChatStreamCompletionCreateParamsMaxPriceTypedDict",
|
||||
"ChatStreamCompletionCreateParamsOnlyEnum",
|
||||
"ChatStreamCompletionCreateParamsOnlyUnion",
|
||||
"ChatStreamCompletionCreateParamsOnlyUnionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsOrderEnum",
|
||||
"ChatStreamCompletionCreateParamsOrderUnion",
|
||||
"ChatStreamCompletionCreateParamsOrderUnionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPdf",
|
||||
"ChatStreamCompletionCreateParamsPdfEngine",
|
||||
"ChatStreamCompletionCreateParamsPdfTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPluginChainOfThought",
|
||||
"ChatStreamCompletionCreateParamsPluginChainOfThoughtTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPluginFileParser",
|
||||
"ChatStreamCompletionCreateParamsPluginFileParserTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPluginModeration",
|
||||
"ChatStreamCompletionCreateParamsPluginModerationTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPluginUnion",
|
||||
"ChatStreamCompletionCreateParamsPluginUnionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPluginWeb",
|
||||
"ChatStreamCompletionCreateParamsPluginWebTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPrompt",
|
||||
"ChatStreamCompletionCreateParamsPromptTypedDict",
|
||||
"ChatStreamCompletionCreateParamsProvider",
|
||||
"ChatStreamCompletionCreateParamsProviderTypedDict",
|
||||
"ChatStreamCompletionCreateParamsQuantization",
|
||||
"ChatStreamCompletionCreateParamsReasoning",
|
||||
"ChatStreamCompletionCreateParamsReasoningEffort",
|
||||
"ChatStreamCompletionCreateParamsReasoningTypedDict",
|
||||
"ChatStreamCompletionCreateParamsRequest",
|
||||
"ChatStreamCompletionCreateParamsRequestTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatGrammar",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatGrammarTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONObject",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONObjectTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONSchema",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONSchemaTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatPython",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatPythonTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatText",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatTextTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatUnion",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsSort",
|
||||
"ChatStreamCompletionCreateParamsStop",
|
||||
"ChatStreamCompletionCreateParamsStopTypedDict",
|
||||
"ChatStreamCompletionCreateParamsStreamOptions",
|
||||
"ChatStreamCompletionCreateParamsStreamOptionsTypedDict",
|
||||
"ChatStreamCompletionCreateParamsTypeGrammar",
|
||||
"ChatStreamCompletionCreateParamsTypeJSONObject",
|
||||
"ChatStreamCompletionCreateParamsTypeJSONSchema",
|
||||
"ChatStreamCompletionCreateParamsTypePython",
|
||||
"ChatStreamCompletionCreateParamsTypeText",
|
||||
"ChatStreamCompletionCreateParamsTypedDict",
|
||||
"CompletionTokensDetails",
|
||||
"CompletionTokensDetailsTypedDict",
|
||||
"CompletionTypedDict",
|
||||
"CompletionUsage",
|
||||
"CompletionUsageTypedDict",
|
||||
"ContentImageURL",
|
||||
@@ -389,10 +607,7 @@ __all__ = [
|
||||
"ContentTypeText",
|
||||
"CreateChatCompletionResponse",
|
||||
"CreateChatCompletionResponseTypedDict",
|
||||
"DataCollection",
|
||||
"Detail",
|
||||
"Effort",
|
||||
"Engine",
|
||||
"Error",
|
||||
"ErrorTypedDict",
|
||||
"File",
|
||||
@@ -403,50 +618,12 @@ __all__ = [
|
||||
"FileAnnotationDetailImageURLTypedDict",
|
||||
"FileAnnotationDetailTypedDict",
|
||||
"FileTypedDict",
|
||||
"IDChainOfThought",
|
||||
"IDFileParser",
|
||||
"IDModeration",
|
||||
"IDWeb",
|
||||
"Ignore",
|
||||
"IgnoreEnum",
|
||||
"IgnoreTypedDict",
|
||||
"Image",
|
||||
"ImageTypedDict",
|
||||
"InputAudio",
|
||||
"InputAudioTypedDict",
|
||||
"JSONSchema",
|
||||
"JSONSchemaTypedDict",
|
||||
"MaxPrice",
|
||||
"MaxPriceTypedDict",
|
||||
"Only",
|
||||
"OnlyEnum",
|
||||
"OnlyTypedDict",
|
||||
"Order",
|
||||
"OrderEnum",
|
||||
"OrderTypedDict",
|
||||
"Parameters",
|
||||
"ParametersTypedDict",
|
||||
"Pdf",
|
||||
"PdfEngine",
|
||||
"PdfTypedDict",
|
||||
"Plugin",
|
||||
"PluginChainOfThought",
|
||||
"PluginChainOfThoughtTypedDict",
|
||||
"PluginFileParser",
|
||||
"PluginFileParserTypedDict",
|
||||
"PluginModeration",
|
||||
"PluginModerationTypedDict",
|
||||
"PluginTypedDict",
|
||||
"PluginWeb",
|
||||
"PluginWebTypedDict",
|
||||
"Prompt",
|
||||
"PromptTokensDetails",
|
||||
"PromptTokensDetailsTypedDict",
|
||||
"PromptTypedDict",
|
||||
"Provider",
|
||||
"ProviderTypedDict",
|
||||
"Quantization",
|
||||
"Reasoning",
|
||||
"ReasoningDetail",
|
||||
"ReasoningDetailEncrypted",
|
||||
"ReasoningDetailEncryptedFormat",
|
||||
@@ -461,38 +638,15 @@ __all__ = [
|
||||
"ReasoningDetailTextType",
|
||||
"ReasoningDetailTextTypedDict",
|
||||
"ReasoningDetailTypedDict",
|
||||
"ReasoningEffort",
|
||||
"ReasoningTypedDict",
|
||||
"Request",
|
||||
"RequestTypedDict",
|
||||
"ResponseFormat",
|
||||
"ResponseFormatGrammar",
|
||||
"ResponseFormatGrammarTypedDict",
|
||||
"ResponseFormatJSONObject",
|
||||
"ResponseFormatJSONObjectTypedDict",
|
||||
"ResponseFormatJSONSchema",
|
||||
"ResponseFormatJSONSchemaSchema",
|
||||
"ResponseFormatJSONSchemaSchemaTypedDict",
|
||||
"ResponseFormatJSONSchemaTypedDict",
|
||||
"ResponseFormatPython",
|
||||
"ResponseFormatPythonTypedDict",
|
||||
"ResponseFormatText",
|
||||
"ResponseFormatTextTypedDict",
|
||||
"ResponseFormatTypedDict",
|
||||
"Security",
|
||||
"SecurityTypedDict",
|
||||
"Sort",
|
||||
"Stop",
|
||||
"StopTypedDict",
|
||||
"StreamOptions",
|
||||
"StreamOptionsTypedDict",
|
||||
"StreamChatCompletionResponseBody",
|
||||
"StreamChatCompletionResponseBodyTypedDict",
|
||||
"TopLogprob",
|
||||
"TopLogprobTypedDict",
|
||||
"TypeFile",
|
||||
"TypeGrammar",
|
||||
"TypeJSONObject",
|
||||
"TypeJSONSchema",
|
||||
"TypePython",
|
||||
"URLCitation",
|
||||
"URLCitationAnnotationDetail",
|
||||
"URLCitationAnnotationDetailType",
|
||||
@@ -547,79 +701,79 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatCompletionContentPartText": ".chatcompletioncontentparttext",
|
||||
"ChatCompletionContentPartTextType": ".chatcompletioncontentparttext",
|
||||
"ChatCompletionContentPartTextTypedDict": ".chatcompletioncontentparttext",
|
||||
"Audio": ".chatcompletioncreateparams",
|
||||
"AudioTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParams": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsAudio": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsAudioTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsCompletion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsCompletionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsDataCollection": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsEffort": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsEngine": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIDChainOfThought": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIDFileParser": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIDModeration": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIDWeb": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIgnoreEnum": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIgnoreUnion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIgnoreUnionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsImage": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsImageTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsJSONSchema": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsJSONSchemaTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsMaxPrice": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsMaxPriceTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOnlyEnum": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOnlyUnion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOnlyUnionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOrderEnum": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOrderUnion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOrderUnionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPdf": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPdfEngine": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPdfTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginChainOfThought": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginChainOfThoughtTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginFileParser": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginFileParserTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginModeration": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginModerationTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginUnion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginUnionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginWeb": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginWebTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPrompt": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPromptTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsProvider": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsProviderTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsQuantization": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsReasoning": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsReasoningEffort": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsReasoningTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsRequest": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsRequestTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatGrammar": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatGrammarTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONObject": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONSchema": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatPython": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatPythonTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatText": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatTextTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatUnion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatUnionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsSort": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsStop": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsStopTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsStreamOptions": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsStreamOptionsTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypeGrammar": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypeJSONObject": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypeJSONSchema": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypePython": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypeText": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypedDict": ".chatcompletioncreateparams",
|
||||
"Completion": ".chatcompletioncreateparams",
|
||||
"CompletionTypedDict": ".chatcompletioncreateparams",
|
||||
"DataCollection": ".chatcompletioncreateparams",
|
||||
"Effort": ".chatcompletioncreateparams",
|
||||
"Engine": ".chatcompletioncreateparams",
|
||||
"IDChainOfThought": ".chatcompletioncreateparams",
|
||||
"IDFileParser": ".chatcompletioncreateparams",
|
||||
"IDModeration": ".chatcompletioncreateparams",
|
||||
"IDWeb": ".chatcompletioncreateparams",
|
||||
"Ignore": ".chatcompletioncreateparams",
|
||||
"IgnoreEnum": ".chatcompletioncreateparams",
|
||||
"IgnoreTypedDict": ".chatcompletioncreateparams",
|
||||
"Image": ".chatcompletioncreateparams",
|
||||
"ImageTypedDict": ".chatcompletioncreateparams",
|
||||
"JSONSchema": ".chatcompletioncreateparams",
|
||||
"JSONSchemaTypedDict": ".chatcompletioncreateparams",
|
||||
"MaxPrice": ".chatcompletioncreateparams",
|
||||
"MaxPriceTypedDict": ".chatcompletioncreateparams",
|
||||
"Only": ".chatcompletioncreateparams",
|
||||
"OnlyEnum": ".chatcompletioncreateparams",
|
||||
"OnlyTypedDict": ".chatcompletioncreateparams",
|
||||
"Order": ".chatcompletioncreateparams",
|
||||
"OrderEnum": ".chatcompletioncreateparams",
|
||||
"OrderTypedDict": ".chatcompletioncreateparams",
|
||||
"Pdf": ".chatcompletioncreateparams",
|
||||
"PdfEngine": ".chatcompletioncreateparams",
|
||||
"PdfTypedDict": ".chatcompletioncreateparams",
|
||||
"Plugin": ".chatcompletioncreateparams",
|
||||
"PluginChainOfThought": ".chatcompletioncreateparams",
|
||||
"PluginChainOfThoughtTypedDict": ".chatcompletioncreateparams",
|
||||
"PluginFileParser": ".chatcompletioncreateparams",
|
||||
"PluginFileParserTypedDict": ".chatcompletioncreateparams",
|
||||
"PluginModeration": ".chatcompletioncreateparams",
|
||||
"PluginModerationTypedDict": ".chatcompletioncreateparams",
|
||||
"PluginTypedDict": ".chatcompletioncreateparams",
|
||||
"PluginWeb": ".chatcompletioncreateparams",
|
||||
"PluginWebTypedDict": ".chatcompletioncreateparams",
|
||||
"Prompt": ".chatcompletioncreateparams",
|
||||
"PromptTypedDict": ".chatcompletioncreateparams",
|
||||
"Provider": ".chatcompletioncreateparams",
|
||||
"ProviderTypedDict": ".chatcompletioncreateparams",
|
||||
"Quantization": ".chatcompletioncreateparams",
|
||||
"Reasoning": ".chatcompletioncreateparams",
|
||||
"ReasoningEffort": ".chatcompletioncreateparams",
|
||||
"ReasoningTypedDict": ".chatcompletioncreateparams",
|
||||
"Request": ".chatcompletioncreateparams",
|
||||
"RequestTypedDict": ".chatcompletioncreateparams",
|
||||
"ResponseFormat": ".chatcompletioncreateparams",
|
||||
"ResponseFormatGrammar": ".chatcompletioncreateparams",
|
||||
"ResponseFormatGrammarTypedDict": ".chatcompletioncreateparams",
|
||||
"ResponseFormatJSONObject": ".chatcompletioncreateparams",
|
||||
"ResponseFormatJSONObjectTypedDict": ".chatcompletioncreateparams",
|
||||
"ResponseFormatJSONSchema": ".chatcompletioncreateparams",
|
||||
"ResponseFormatJSONSchemaTypedDict": ".chatcompletioncreateparams",
|
||||
"ResponseFormatPython": ".chatcompletioncreateparams",
|
||||
"ResponseFormatPythonTypedDict": ".chatcompletioncreateparams",
|
||||
"ResponseFormatText": ".chatcompletioncreateparams",
|
||||
"ResponseFormatTextTypedDict": ".chatcompletioncreateparams",
|
||||
"ResponseFormatTypedDict": ".chatcompletioncreateparams",
|
||||
"Sort": ".chatcompletioncreateparams",
|
||||
"Stop": ".chatcompletioncreateparams",
|
||||
"StopTypedDict": ".chatcompletioncreateparams",
|
||||
"StreamOptions": ".chatcompletioncreateparams",
|
||||
"StreamOptionsTypedDict": ".chatcompletioncreateparams",
|
||||
"TypeGrammar": ".chatcompletioncreateparams",
|
||||
"TypeJSONObject": ".chatcompletioncreateparams",
|
||||
"TypeJSONSchema": ".chatcompletioncreateparams",
|
||||
"TypePython": ".chatcompletioncreateparams",
|
||||
"Error": ".chatcompletionerror",
|
||||
"ErrorTypedDict": ".chatcompletionerror",
|
||||
"ChatCompletionMessage": ".chatcompletionmessage",
|
||||
@@ -670,6 +824,79 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatCompletionUserMessageParamContentTypedDict": ".chatcompletionusermessageparam",
|
||||
"ChatCompletionUserMessageParamRole": ".chatcompletionusermessageparam",
|
||||
"ChatCompletionUserMessageParamTypedDict": ".chatcompletionusermessageparam",
|
||||
"ChatStreamCompletionCreateParams": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsAudio": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsAudioTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsCompletion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsCompletionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsDataCollection": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsEffort": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsEngine": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIDChainOfThought": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIDFileParser": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIDModeration": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIDWeb": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIgnoreEnum": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIgnoreUnion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIgnoreUnionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsImage": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsImageTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsJSONSchema": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsJSONSchemaTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsMaxPrice": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsMaxPriceTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOnlyEnum": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOnlyUnion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOnlyUnionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOrderEnum": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOrderUnion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOrderUnionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPdf": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPdfEngine": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPdfTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginChainOfThought": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginChainOfThoughtTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginFileParser": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginFileParserTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginModeration": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginModerationTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginUnion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginUnionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginWeb": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginWebTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPrompt": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPromptTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsProvider": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsProviderTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsQuantization": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsReasoning": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsReasoningEffort": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsReasoningTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsRequest": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsRequestTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatGrammar": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatGrammarTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONObject": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONObjectTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONSchema": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONSchemaTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatPython": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatPythonTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatText": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatTextTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatUnion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsSort": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsStop": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsStopTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsStreamOptions": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsStreamOptionsTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypeGrammar": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypeJSONObject": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypeJSONSchema": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypePython": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypeText": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"CompletionTokensDetails": ".completionusage",
|
||||
"CompletionTokensDetailsTypedDict": ".completionusage",
|
||||
"CompletionUsage": ".completionusage",
|
||||
@@ -711,6 +938,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ResponseFormatJSONSchemaSchemaTypedDict": ".responseformatjsonschemaschema",
|
||||
"Security": ".security",
|
||||
"SecurityTypedDict": ".security",
|
||||
"StreamChatCompletionResponseBody": ".streamchatcompletionop",
|
||||
"StreamChatCompletionResponseBodyTypedDict": ".streamchatcompletionop",
|
||||
"URLCitation": ".urlcitationannotationdetail",
|
||||
"URLCitationAnnotationDetail": ".urlcitationannotationdetail",
|
||||
"URLCitationAnnotationDetailType": ".urlcitationannotationdetail",
|
||||
|
||||
@@ -27,29 +27,29 @@ from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
Effort = Literal["high", "medium", "low", "minimal"]
|
||||
ChatCompletionCreateParamsEffort = Literal["high", "medium", "low", "minimal"]
|
||||
r"""OpenAI-style reasoning effort setting"""
|
||||
|
||||
|
||||
class ReasoningTypedDict(TypedDict):
|
||||
class ChatCompletionCreateParamsReasoningTypedDict(TypedDict):
|
||||
r"""Reasoning configuration"""
|
||||
|
||||
enabled: NotRequired[bool]
|
||||
r"""Enables reasoning with default settings. Only work for some models."""
|
||||
effort: NotRequired[Nullable[Effort]]
|
||||
effort: NotRequired[Nullable[ChatCompletionCreateParamsEffort]]
|
||||
r"""OpenAI-style reasoning effort setting"""
|
||||
max_tokens: NotRequired[Nullable[float]]
|
||||
r"""non-OpenAI-style reasoning effort setting"""
|
||||
exclude: NotRequired[bool]
|
||||
|
||||
|
||||
class Reasoning(BaseModel):
|
||||
class ChatCompletionCreateParamsReasoning(BaseModel):
|
||||
r"""Reasoning configuration"""
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
r"""Enables reasoning with default settings. Only work for some models."""
|
||||
|
||||
effort: OptionalNullable[Effort] = UNSET
|
||||
effort: OptionalNullable[ChatCompletionCreateParamsEffort] = UNSET
|
||||
r"""OpenAI-style reasoning effort setting"""
|
||||
|
||||
max_tokens: OptionalNullable[float] = UNSET
|
||||
@@ -88,45 +88,45 @@ class Reasoning(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
TypePython = Literal["python"]
|
||||
ChatCompletionCreateParamsTypePython = Literal["python"]
|
||||
|
||||
|
||||
class ResponseFormatPythonTypedDict(TypedDict):
|
||||
class ChatCompletionCreateParamsResponseFormatPythonTypedDict(TypedDict):
|
||||
r"""Python code response format"""
|
||||
|
||||
type: TypePython
|
||||
type: ChatCompletionCreateParamsTypePython
|
||||
|
||||
|
||||
class ResponseFormatPython(BaseModel):
|
||||
class ChatCompletionCreateParamsResponseFormatPython(BaseModel):
|
||||
r"""Python code response format"""
|
||||
|
||||
type: TypePython
|
||||
type: ChatCompletionCreateParamsTypePython
|
||||
|
||||
|
||||
TypeGrammar = Literal["grammar"]
|
||||
ChatCompletionCreateParamsTypeGrammar = Literal["grammar"]
|
||||
|
||||
|
||||
class ResponseFormatGrammarTypedDict(TypedDict):
|
||||
class ChatCompletionCreateParamsResponseFormatGrammarTypedDict(TypedDict):
|
||||
r"""Custom grammar response format"""
|
||||
|
||||
type: TypeGrammar
|
||||
type: ChatCompletionCreateParamsTypeGrammar
|
||||
grammar: str
|
||||
r"""Custom grammar for text generation"""
|
||||
|
||||
|
||||
class ResponseFormatGrammar(BaseModel):
|
||||
class ChatCompletionCreateParamsResponseFormatGrammar(BaseModel):
|
||||
r"""Custom grammar response format"""
|
||||
|
||||
type: TypeGrammar
|
||||
type: ChatCompletionCreateParamsTypeGrammar
|
||||
|
||||
grammar: str
|
||||
r"""Custom grammar for text generation"""
|
||||
|
||||
|
||||
TypeJSONSchema = Literal["json_schema"]
|
||||
ChatCompletionCreateParamsTypeJSONSchema = Literal["json_schema"]
|
||||
|
||||
|
||||
class JSONSchemaTypedDict(TypedDict):
|
||||
class ChatCompletionCreateParamsJSONSchemaTypedDict(TypedDict):
|
||||
name: str
|
||||
r"""Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)"""
|
||||
description: NotRequired[str]
|
||||
@@ -137,7 +137,7 @@ class JSONSchemaTypedDict(TypedDict):
|
||||
r"""Enable strict schema adherence"""
|
||||
|
||||
|
||||
class JSONSchema(BaseModel):
|
||||
class ChatCompletionCreateParamsJSONSchema(BaseModel):
|
||||
name: str
|
||||
r"""Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)"""
|
||||
|
||||
@@ -183,110 +183,114 @@ class JSONSchema(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
class ResponseFormatJSONSchemaTypedDict(TypedDict):
|
||||
class ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict(TypedDict):
|
||||
r"""JSON Schema response format for structured outputs"""
|
||||
|
||||
type: TypeJSONSchema
|
||||
json_schema: JSONSchemaTypedDict
|
||||
type: ChatCompletionCreateParamsTypeJSONSchema
|
||||
json_schema: ChatCompletionCreateParamsJSONSchemaTypedDict
|
||||
|
||||
|
||||
class ResponseFormatJSONSchema(BaseModel):
|
||||
class ChatCompletionCreateParamsResponseFormatJSONSchema(BaseModel):
|
||||
r"""JSON Schema response format for structured outputs"""
|
||||
|
||||
type: TypeJSONSchema
|
||||
type: ChatCompletionCreateParamsTypeJSONSchema
|
||||
|
||||
json_schema: JSONSchema
|
||||
json_schema: ChatCompletionCreateParamsJSONSchema
|
||||
|
||||
|
||||
TypeJSONObject = Literal["json_object"]
|
||||
ChatCompletionCreateParamsTypeJSONObject = Literal["json_object"]
|
||||
|
||||
|
||||
class ResponseFormatJSONObjectTypedDict(TypedDict):
|
||||
class ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict(TypedDict):
|
||||
r"""JSON object response format"""
|
||||
|
||||
type: TypeJSONObject
|
||||
type: ChatCompletionCreateParamsTypeJSONObject
|
||||
|
||||
|
||||
class ResponseFormatJSONObject(BaseModel):
|
||||
class ChatCompletionCreateParamsResponseFormatJSONObject(BaseModel):
|
||||
r"""JSON object response format"""
|
||||
|
||||
type: TypeJSONObject
|
||||
type: ChatCompletionCreateParamsTypeJSONObject
|
||||
|
||||
|
||||
ChatCompletionCreateParamsTypeText = Literal["text"]
|
||||
|
||||
|
||||
class ResponseFormatTextTypedDict(TypedDict):
|
||||
class ChatCompletionCreateParamsResponseFormatTextTypedDict(TypedDict):
|
||||
r"""Default text response format"""
|
||||
|
||||
type: ChatCompletionCreateParamsTypeText
|
||||
|
||||
|
||||
class ResponseFormatText(BaseModel):
|
||||
class ChatCompletionCreateParamsResponseFormatText(BaseModel):
|
||||
r"""Default text response format"""
|
||||
|
||||
type: ChatCompletionCreateParamsTypeText
|
||||
|
||||
|
||||
ResponseFormatTypedDict = TypeAliasType(
|
||||
"ResponseFormatTypedDict",
|
||||
ChatCompletionCreateParamsResponseFormatUnionTypedDict = TypeAliasType(
|
||||
"ChatCompletionCreateParamsResponseFormatUnionTypedDict",
|
||||
Union[
|
||||
ResponseFormatTextTypedDict,
|
||||
ResponseFormatJSONObjectTypedDict,
|
||||
ResponseFormatPythonTypedDict,
|
||||
ResponseFormatJSONSchemaTypedDict,
|
||||
ResponseFormatGrammarTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatTextTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatPythonTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatGrammarTypedDict,
|
||||
],
|
||||
)
|
||||
r"""Response format configuration"""
|
||||
|
||||
|
||||
ResponseFormat = TypeAliasType(
|
||||
"ResponseFormat",
|
||||
ChatCompletionCreateParamsResponseFormatUnion = TypeAliasType(
|
||||
"ChatCompletionCreateParamsResponseFormatUnion",
|
||||
Union[
|
||||
ResponseFormatText,
|
||||
ResponseFormatJSONObject,
|
||||
ResponseFormatPython,
|
||||
ResponseFormatJSONSchema,
|
||||
ResponseFormatGrammar,
|
||||
ChatCompletionCreateParamsResponseFormatText,
|
||||
ChatCompletionCreateParamsResponseFormatJSONObject,
|
||||
ChatCompletionCreateParamsResponseFormatPython,
|
||||
ChatCompletionCreateParamsResponseFormatJSONSchema,
|
||||
ChatCompletionCreateParamsResponseFormatGrammar,
|
||||
],
|
||||
)
|
||||
r"""Response format configuration"""
|
||||
|
||||
|
||||
StopTypedDict = TypeAliasType("StopTypedDict", Union[str, List[str], Any])
|
||||
ChatCompletionCreateParamsStopTypedDict = TypeAliasType(
|
||||
"ChatCompletionCreateParamsStopTypedDict", Union[str, List[str], Any]
|
||||
)
|
||||
r"""Stop sequences (up to 4)"""
|
||||
|
||||
|
||||
Stop = TypeAliasType("Stop", Union[str, List[str], Any])
|
||||
ChatCompletionCreateParamsStop = TypeAliasType(
|
||||
"ChatCompletionCreateParamsStop", Union[str, List[str], Any]
|
||||
)
|
||||
r"""Stop sequences (up to 4)"""
|
||||
|
||||
|
||||
class StreamOptionsTypedDict(TypedDict):
|
||||
class ChatCompletionCreateParamsStreamOptionsTypedDict(TypedDict):
|
||||
r"""Streaming configuration options"""
|
||||
|
||||
include_usage: NotRequired[bool]
|
||||
r"""Include usage information in streaming response"""
|
||||
|
||||
|
||||
class StreamOptions(BaseModel):
|
||||
class ChatCompletionCreateParamsStreamOptions(BaseModel):
|
||||
r"""Streaming configuration options"""
|
||||
|
||||
include_usage: Optional[bool] = None
|
||||
r"""Include usage information in streaming response"""
|
||||
|
||||
|
||||
ReasoningEffort = Literal["high", "medium", "low", "minimal"]
|
||||
ChatCompletionCreateParamsReasoningEffort = Literal["high", "medium", "low", "minimal"]
|
||||
r"""Reasoning effort"""
|
||||
|
||||
DataCollection = Literal["deny", "allow"]
|
||||
ChatCompletionCreateParamsDataCollection = Literal["deny", "allow"]
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
"""
|
||||
|
||||
OrderEnum = Literal[
|
||||
ChatCompletionCreateParamsOrderEnum = Literal[
|
||||
"AnyScale",
|
||||
"Cent-ML",
|
||||
"HuggingFace",
|
||||
@@ -367,13 +371,19 @@ OrderEnum = Literal[
|
||||
"Z.AI",
|
||||
]
|
||||
|
||||
OrderTypedDict = TypeAliasType("OrderTypedDict", Union[OrderEnum, str])
|
||||
ChatCompletionCreateParamsOrderUnionTypedDict = TypeAliasType(
|
||||
"ChatCompletionCreateParamsOrderUnionTypedDict",
|
||||
Union[ChatCompletionCreateParamsOrderEnum, str],
|
||||
)
|
||||
|
||||
|
||||
Order = TypeAliasType("Order", Union[OrderEnum, str])
|
||||
ChatCompletionCreateParamsOrderUnion = TypeAliasType(
|
||||
"ChatCompletionCreateParamsOrderUnion",
|
||||
Union[ChatCompletionCreateParamsOrderEnum, str],
|
||||
)
|
||||
|
||||
|
||||
OnlyEnum = Literal[
|
||||
ChatCompletionCreateParamsOnlyEnum = Literal[
|
||||
"AnyScale",
|
||||
"Cent-ML",
|
||||
"HuggingFace",
|
||||
@@ -454,13 +464,19 @@ OnlyEnum = Literal[
|
||||
"Z.AI",
|
||||
]
|
||||
|
||||
OnlyTypedDict = TypeAliasType("OnlyTypedDict", Union[OnlyEnum, str])
|
||||
ChatCompletionCreateParamsOnlyUnionTypedDict = TypeAliasType(
|
||||
"ChatCompletionCreateParamsOnlyUnionTypedDict",
|
||||
Union[ChatCompletionCreateParamsOnlyEnum, str],
|
||||
)
|
||||
|
||||
|
||||
Only = TypeAliasType("Only", Union[OnlyEnum, str])
|
||||
ChatCompletionCreateParamsOnlyUnion = TypeAliasType(
|
||||
"ChatCompletionCreateParamsOnlyUnion",
|
||||
Union[ChatCompletionCreateParamsOnlyEnum, str],
|
||||
)
|
||||
|
||||
|
||||
IgnoreEnum = Literal[
|
||||
ChatCompletionCreateParamsIgnoreEnum = Literal[
|
||||
"AnyScale",
|
||||
"Cent-ML",
|
||||
"HuggingFace",
|
||||
@@ -541,74 +557,100 @@ IgnoreEnum = Literal[
|
||||
"Z.AI",
|
||||
]
|
||||
|
||||
IgnoreTypedDict = TypeAliasType("IgnoreTypedDict", Union[IgnoreEnum, str])
|
||||
ChatCompletionCreateParamsIgnoreUnionTypedDict = TypeAliasType(
|
||||
"ChatCompletionCreateParamsIgnoreUnionTypedDict",
|
||||
Union[ChatCompletionCreateParamsIgnoreEnum, str],
|
||||
)
|
||||
|
||||
|
||||
Ignore = TypeAliasType("Ignore", Union[IgnoreEnum, str])
|
||||
ChatCompletionCreateParamsIgnoreUnion = TypeAliasType(
|
||||
"ChatCompletionCreateParamsIgnoreUnion",
|
||||
Union[ChatCompletionCreateParamsIgnoreEnum, str],
|
||||
)
|
||||
|
||||
|
||||
Quantization = Literal[
|
||||
ChatCompletionCreateParamsQuantization = Literal[
|
||||
"int4", "int8", "fp4", "fp6", "fp8", "fp16", "bf16", "fp32", "unknown"
|
||||
]
|
||||
|
||||
Sort = Literal["price", "throughput", "latency"]
|
||||
ChatCompletionCreateParamsSort = Literal["price", "throughput", "latency"]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
|
||||
PromptTypedDict = TypeAliasType("PromptTypedDict", Union[float, str, Any])
|
||||
ChatCompletionCreateParamsPromptTypedDict = TypeAliasType(
|
||||
"ChatCompletionCreateParamsPromptTypedDict", Union[float, str, Any]
|
||||
)
|
||||
|
||||
|
||||
Prompt = TypeAliasType("Prompt", Union[float, str, Any])
|
||||
ChatCompletionCreateParamsPrompt = TypeAliasType(
|
||||
"ChatCompletionCreateParamsPrompt", Union[float, str, Any]
|
||||
)
|
||||
|
||||
|
||||
CompletionTypedDict = TypeAliasType("CompletionTypedDict", Union[float, str, Any])
|
||||
ChatCompletionCreateParamsCompletionTypedDict = TypeAliasType(
|
||||
"ChatCompletionCreateParamsCompletionTypedDict", Union[float, str, Any]
|
||||
)
|
||||
|
||||
|
||||
Completion = TypeAliasType("Completion", Union[float, str, Any])
|
||||
ChatCompletionCreateParamsCompletion = TypeAliasType(
|
||||
"ChatCompletionCreateParamsCompletion", Union[float, str, Any]
|
||||
)
|
||||
|
||||
|
||||
ImageTypedDict = TypeAliasType("ImageTypedDict", Union[float, str, Any])
|
||||
ChatCompletionCreateParamsImageTypedDict = TypeAliasType(
|
||||
"ChatCompletionCreateParamsImageTypedDict", Union[float, str, Any]
|
||||
)
|
||||
|
||||
|
||||
Image = TypeAliasType("Image", Union[float, str, Any])
|
||||
ChatCompletionCreateParamsImage = TypeAliasType(
|
||||
"ChatCompletionCreateParamsImage", Union[float, str, Any]
|
||||
)
|
||||
|
||||
|
||||
AudioTypedDict = TypeAliasType("AudioTypedDict", Union[float, str, Any])
|
||||
ChatCompletionCreateParamsAudioTypedDict = TypeAliasType(
|
||||
"ChatCompletionCreateParamsAudioTypedDict", Union[float, str, Any]
|
||||
)
|
||||
|
||||
|
||||
Audio = TypeAliasType("Audio", Union[float, str, Any])
|
||||
ChatCompletionCreateParamsAudio = TypeAliasType(
|
||||
"ChatCompletionCreateParamsAudio", Union[float, str, Any]
|
||||
)
|
||||
|
||||
|
||||
RequestTypedDict = TypeAliasType("RequestTypedDict", Union[float, str, Any])
|
||||
ChatCompletionCreateParamsRequestTypedDict = TypeAliasType(
|
||||
"ChatCompletionCreateParamsRequestTypedDict", Union[float, str, Any]
|
||||
)
|
||||
|
||||
|
||||
Request = TypeAliasType("Request", Union[float, str, Any])
|
||||
ChatCompletionCreateParamsRequest = TypeAliasType(
|
||||
"ChatCompletionCreateParamsRequest", Union[float, str, Any]
|
||||
)
|
||||
|
||||
|
||||
class MaxPriceTypedDict(TypedDict):
|
||||
class ChatCompletionCreateParamsMaxPriceTypedDict(TypedDict):
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
prompt: NotRequired[PromptTypedDict]
|
||||
completion: NotRequired[CompletionTypedDict]
|
||||
image: NotRequired[ImageTypedDict]
|
||||
audio: NotRequired[AudioTypedDict]
|
||||
request: NotRequired[RequestTypedDict]
|
||||
prompt: NotRequired[ChatCompletionCreateParamsPromptTypedDict]
|
||||
completion: NotRequired[ChatCompletionCreateParamsCompletionTypedDict]
|
||||
image: NotRequired[ChatCompletionCreateParamsImageTypedDict]
|
||||
audio: NotRequired[ChatCompletionCreateParamsAudioTypedDict]
|
||||
request: NotRequired[ChatCompletionCreateParamsRequestTypedDict]
|
||||
|
||||
|
||||
class MaxPrice(BaseModel):
|
||||
class ChatCompletionCreateParamsMaxPrice(BaseModel):
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
prompt: Optional[Prompt] = None
|
||||
prompt: Optional[ChatCompletionCreateParamsPrompt] = None
|
||||
|
||||
completion: Optional[Completion] = None
|
||||
completion: Optional[ChatCompletionCreateParamsCompletion] = None
|
||||
|
||||
image: Optional[Image] = None
|
||||
image: Optional[ChatCompletionCreateParamsImage] = None
|
||||
|
||||
audio: Optional[Audio] = None
|
||||
audio: Optional[ChatCompletionCreateParamsAudio] = None
|
||||
|
||||
request: Optional[Request] = None
|
||||
request: Optional[ChatCompletionCreateParamsRequest] = None
|
||||
|
||||
|
||||
class ProviderTypedDict(TypedDict):
|
||||
class ChatCompletionCreateParamsProviderTypedDict(TypedDict):
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
|
||||
allow_fallbacks: NotRequired[Nullable[bool]]
|
||||
@@ -619,27 +661,27 @@ class ProviderTypedDict(TypedDict):
|
||||
"""
|
||||
require_parameters: NotRequired[Nullable[bool]]
|
||||
r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
|
||||
data_collection: NotRequired[Nullable[DataCollection]]
|
||||
data_collection: NotRequired[Nullable[ChatCompletionCreateParamsDataCollection]]
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
"""
|
||||
order: NotRequired[Nullable[List[OrderTypedDict]]]
|
||||
order: NotRequired[Nullable[List[ChatCompletionCreateParamsOrderUnionTypedDict]]]
|
||||
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
|
||||
only: NotRequired[Nullable[List[OnlyTypedDict]]]
|
||||
only: NotRequired[Nullable[List[ChatCompletionCreateParamsOnlyUnionTypedDict]]]
|
||||
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
|
||||
ignore: NotRequired[Nullable[List[IgnoreTypedDict]]]
|
||||
ignore: NotRequired[Nullable[List[ChatCompletionCreateParamsIgnoreUnionTypedDict]]]
|
||||
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
|
||||
quantizations: NotRequired[Nullable[List[Quantization]]]
|
||||
quantizations: NotRequired[Nullable[List[ChatCompletionCreateParamsQuantization]]]
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
sort: NotRequired[Nullable[Sort]]
|
||||
sort: NotRequired[Nullable[ChatCompletionCreateParamsSort]]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
max_price: NotRequired[MaxPriceTypedDict]
|
||||
max_price: NotRequired[ChatCompletionCreateParamsMaxPriceTypedDict]
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
|
||||
class Provider(BaseModel):
|
||||
class ChatCompletionCreateParamsProvider(BaseModel):
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
|
||||
allow_fallbacks: OptionalNullable[bool] = UNSET
|
||||
@@ -652,29 +694,31 @@ class Provider(BaseModel):
|
||||
require_parameters: OptionalNullable[bool] = UNSET
|
||||
r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
|
||||
|
||||
data_collection: OptionalNullable[DataCollection] = UNSET
|
||||
data_collection: OptionalNullable[ChatCompletionCreateParamsDataCollection] = UNSET
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
"""
|
||||
|
||||
order: OptionalNullable[List[Order]] = UNSET
|
||||
order: OptionalNullable[List[ChatCompletionCreateParamsOrderUnion]] = UNSET
|
||||
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
|
||||
|
||||
only: OptionalNullable[List[Only]] = UNSET
|
||||
only: OptionalNullable[List[ChatCompletionCreateParamsOnlyUnion]] = UNSET
|
||||
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
|
||||
|
||||
ignore: OptionalNullable[List[Ignore]] = UNSET
|
||||
ignore: OptionalNullable[List[ChatCompletionCreateParamsIgnoreUnion]] = UNSET
|
||||
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
|
||||
|
||||
quantizations: OptionalNullable[List[Quantization]] = UNSET
|
||||
quantizations: OptionalNullable[List[ChatCompletionCreateParamsQuantization]] = (
|
||||
UNSET
|
||||
)
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
|
||||
sort: OptionalNullable[Sort] = UNSET
|
||||
sort: OptionalNullable[ChatCompletionCreateParamsSort] = UNSET
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
|
||||
max_price: Optional[MaxPrice] = None
|
||||
max_price: Optional[ChatCompletionCreateParamsMaxPrice] = None
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
@@ -727,90 +771,96 @@ class Provider(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
IDFileParser = Literal["file-parser"]
|
||||
ChatCompletionCreateParamsIDFileParser = Literal["file-parser"]
|
||||
|
||||
PdfEngine = Literal["mistral-ocr", "pdf-text", "native"]
|
||||
ChatCompletionCreateParamsPdfEngine = Literal["mistral-ocr", "pdf-text", "native"]
|
||||
|
||||
|
||||
class PdfTypedDict(TypedDict):
|
||||
engine: NotRequired[PdfEngine]
|
||||
class ChatCompletionCreateParamsPdfTypedDict(TypedDict):
|
||||
engine: NotRequired[ChatCompletionCreateParamsPdfEngine]
|
||||
|
||||
|
||||
class Pdf(BaseModel):
|
||||
engine: Optional[PdfEngine] = None
|
||||
class ChatCompletionCreateParamsPdf(BaseModel):
|
||||
engine: Optional[ChatCompletionCreateParamsPdfEngine] = None
|
||||
|
||||
|
||||
class PluginFileParserTypedDict(TypedDict):
|
||||
id: IDFileParser
|
||||
class ChatCompletionCreateParamsPluginFileParserTypedDict(TypedDict):
|
||||
id: ChatCompletionCreateParamsIDFileParser
|
||||
max_files: NotRequired[float]
|
||||
pdf: NotRequired[PdfTypedDict]
|
||||
pdf: NotRequired[ChatCompletionCreateParamsPdfTypedDict]
|
||||
|
||||
|
||||
class PluginFileParser(BaseModel):
|
||||
id: IDFileParser
|
||||
class ChatCompletionCreateParamsPluginFileParser(BaseModel):
|
||||
id: ChatCompletionCreateParamsIDFileParser
|
||||
|
||||
max_files: Optional[float] = None
|
||||
|
||||
pdf: Optional[Pdf] = None
|
||||
pdf: Optional[ChatCompletionCreateParamsPdf] = None
|
||||
|
||||
|
||||
IDChainOfThought = Literal["chain-of-thought"]
|
||||
ChatCompletionCreateParamsIDChainOfThought = Literal["chain-of-thought"]
|
||||
|
||||
|
||||
class PluginChainOfThoughtTypedDict(TypedDict):
|
||||
id: IDChainOfThought
|
||||
class ChatCompletionCreateParamsPluginChainOfThoughtTypedDict(TypedDict):
|
||||
id: ChatCompletionCreateParamsIDChainOfThought
|
||||
|
||||
|
||||
class PluginChainOfThought(BaseModel):
|
||||
id: IDChainOfThought
|
||||
class ChatCompletionCreateParamsPluginChainOfThought(BaseModel):
|
||||
id: ChatCompletionCreateParamsIDChainOfThought
|
||||
|
||||
|
||||
IDWeb = Literal["web"]
|
||||
ChatCompletionCreateParamsIDWeb = Literal["web"]
|
||||
|
||||
Engine = Literal["native", "exa"]
|
||||
ChatCompletionCreateParamsEngine = Literal["native", "exa"]
|
||||
|
||||
|
||||
class PluginWebTypedDict(TypedDict):
|
||||
id: IDWeb
|
||||
class ChatCompletionCreateParamsPluginWebTypedDict(TypedDict):
|
||||
id: ChatCompletionCreateParamsIDWeb
|
||||
max_results: NotRequired[float]
|
||||
search_prompt: NotRequired[str]
|
||||
engine: NotRequired[Engine]
|
||||
engine: NotRequired[ChatCompletionCreateParamsEngine]
|
||||
|
||||
|
||||
class PluginWeb(BaseModel):
|
||||
id: IDWeb
|
||||
class ChatCompletionCreateParamsPluginWeb(BaseModel):
|
||||
id: ChatCompletionCreateParamsIDWeb
|
||||
|
||||
max_results: Optional[float] = None
|
||||
|
||||
search_prompt: Optional[str] = None
|
||||
|
||||
engine: Optional[Engine] = None
|
||||
engine: Optional[ChatCompletionCreateParamsEngine] = None
|
||||
|
||||
|
||||
IDModeration = Literal["moderation"]
|
||||
ChatCompletionCreateParamsIDModeration = Literal["moderation"]
|
||||
|
||||
|
||||
class PluginModerationTypedDict(TypedDict):
|
||||
id: IDModeration
|
||||
class ChatCompletionCreateParamsPluginModerationTypedDict(TypedDict):
|
||||
id: ChatCompletionCreateParamsIDModeration
|
||||
|
||||
|
||||
class PluginModeration(BaseModel):
|
||||
id: IDModeration
|
||||
class ChatCompletionCreateParamsPluginModeration(BaseModel):
|
||||
id: ChatCompletionCreateParamsIDModeration
|
||||
|
||||
|
||||
PluginTypedDict = TypeAliasType(
|
||||
"PluginTypedDict",
|
||||
ChatCompletionCreateParamsPluginUnionTypedDict = TypeAliasType(
|
||||
"ChatCompletionCreateParamsPluginUnionTypedDict",
|
||||
Union[
|
||||
PluginModerationTypedDict,
|
||||
PluginChainOfThoughtTypedDict,
|
||||
PluginFileParserTypedDict,
|
||||
PluginWebTypedDict,
|
||||
ChatCompletionCreateParamsPluginModerationTypedDict,
|
||||
ChatCompletionCreateParamsPluginChainOfThoughtTypedDict,
|
||||
ChatCompletionCreateParamsPluginFileParserTypedDict,
|
||||
ChatCompletionCreateParamsPluginWebTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
Plugin = TypeAliasType(
|
||||
"Plugin", Union[PluginModeration, PluginChainOfThought, PluginFileParser, PluginWeb]
|
||||
ChatCompletionCreateParamsPluginUnion = TypeAliasType(
|
||||
"ChatCompletionCreateParamsPluginUnion",
|
||||
Union[
|
||||
ChatCompletionCreateParamsPluginModeration,
|
||||
ChatCompletionCreateParamsPluginChainOfThought,
|
||||
ChatCompletionCreateParamsPluginFileParser,
|
||||
ChatCompletionCreateParamsPluginWeb,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -837,17 +887,19 @@ class ChatCompletionCreateParamsTypedDict(TypedDict):
|
||||
r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)"""
|
||||
presence_penalty: NotRequired[Nullable[float]]
|
||||
r"""Presence penalty (-2.0 to 2.0)"""
|
||||
reasoning: NotRequired[Nullable[ReasoningTypedDict]]
|
||||
reasoning: NotRequired[Nullable[ChatCompletionCreateParamsReasoningTypedDict]]
|
||||
r"""Reasoning configuration"""
|
||||
response_format: NotRequired[ResponseFormatTypedDict]
|
||||
response_format: NotRequired[ChatCompletionCreateParamsResponseFormatUnionTypedDict]
|
||||
r"""Response format configuration"""
|
||||
seed: NotRequired[Nullable[int]]
|
||||
r"""Random seed for deterministic outputs"""
|
||||
stop: NotRequired[Nullable[StopTypedDict]]
|
||||
stop: NotRequired[Nullable[ChatCompletionCreateParamsStopTypedDict]]
|
||||
r"""Stop sequences (up to 4)"""
|
||||
stream: NotRequired[Nullable[bool]]
|
||||
r"""Enable streaming response"""
|
||||
stream_options: NotRequired[Nullable[StreamOptionsTypedDict]]
|
||||
stream_options: NotRequired[
|
||||
Nullable[ChatCompletionCreateParamsStreamOptionsTypedDict]
|
||||
]
|
||||
temperature: NotRequired[Nullable[float]]
|
||||
r"""Sampling temperature (0-2)"""
|
||||
tool_choice: NotRequired[ChatCompletionToolChoiceOptionTypedDict]
|
||||
@@ -858,13 +910,13 @@ class ChatCompletionCreateParamsTypedDict(TypedDict):
|
||||
r"""Nucleus sampling parameter (0-1)"""
|
||||
user: NotRequired[str]
|
||||
r"""Unique user identifier"""
|
||||
model_list: NotRequired[Nullable[List[str]]]
|
||||
fallback_models: NotRequired[Nullable[List[str]]]
|
||||
r"""Order of models to fallback to for this request"""
|
||||
reasoning_effort: NotRequired[Nullable[ReasoningEffort]]
|
||||
reasoning_effort: NotRequired[Nullable[ChatCompletionCreateParamsReasoningEffort]]
|
||||
r"""Reasoning effort"""
|
||||
provider: NotRequired[Nullable[ProviderTypedDict]]
|
||||
provider: NotRequired[Nullable[ChatCompletionCreateParamsProviderTypedDict]]
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
plugins: NotRequired[List[PluginTypedDict]]
|
||||
plugins: NotRequired[List[ChatCompletionCreateParamsPluginUnionTypedDict]]
|
||||
r"""Plugins you want to enable for this request, including their settings."""
|
||||
|
||||
|
||||
@@ -901,22 +953,22 @@ class ChatCompletionCreateParams(BaseModel):
|
||||
presence_penalty: OptionalNullable[float] = UNSET
|
||||
r"""Presence penalty (-2.0 to 2.0)"""
|
||||
|
||||
reasoning: OptionalNullable[Reasoning] = UNSET
|
||||
reasoning: OptionalNullable[ChatCompletionCreateParamsReasoning] = UNSET
|
||||
r"""Reasoning configuration"""
|
||||
|
||||
response_format: Optional[ResponseFormat] = None
|
||||
response_format: Optional[ChatCompletionCreateParamsResponseFormatUnion] = None
|
||||
r"""Response format configuration"""
|
||||
|
||||
seed: OptionalNullable[int] = UNSET
|
||||
r"""Random seed for deterministic outputs"""
|
||||
|
||||
stop: OptionalNullable[Stop] = UNSET
|
||||
stop: OptionalNullable[ChatCompletionCreateParamsStop] = UNSET
|
||||
r"""Stop sequences (up to 4)"""
|
||||
|
||||
stream: OptionalNullable[bool] = False
|
||||
r"""Enable streaming response"""
|
||||
|
||||
stream_options: OptionalNullable[StreamOptions] = UNSET
|
||||
stream_options: OptionalNullable[ChatCompletionCreateParamsStreamOptions] = UNSET
|
||||
|
||||
temperature: OptionalNullable[float] = 1
|
||||
r"""Sampling temperature (0-2)"""
|
||||
@@ -933,18 +985,20 @@ class ChatCompletionCreateParams(BaseModel):
|
||||
user: Optional[str] = None
|
||||
r"""Unique user identifier"""
|
||||
|
||||
model_list: Annotated[
|
||||
fallback_models: Annotated[
|
||||
OptionalNullable[List[str]], pydantic.Field(alias="models")
|
||||
] = UNSET
|
||||
r"""Order of models to fallback to for this request"""
|
||||
|
||||
reasoning_effort: OptionalNullable[ReasoningEffort] = UNSET
|
||||
reasoning_effort: OptionalNullable[ChatCompletionCreateParamsReasoningEffort] = (
|
||||
UNSET
|
||||
)
|
||||
r"""Reasoning effort"""
|
||||
|
||||
provider: OptionalNullable[Provider] = UNSET
|
||||
provider: OptionalNullable[ChatCompletionCreateParamsProvider] = UNSET
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
|
||||
plugins: Optional[List[Plugin]] = None
|
||||
plugins: Optional[List[ChatCompletionCreateParamsPluginUnion]] = None
|
||||
r"""Plugins you want to enable for this request, including their settings."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
@@ -970,7 +1024,7 @@ class ChatCompletionCreateParams(BaseModel):
|
||||
"tools",
|
||||
"top_p",
|
||||
"user",
|
||||
"model_list",
|
||||
"fallback_models",
|
||||
"reasoning_effort",
|
||||
"provider",
|
||||
"plugins",
|
||||
@@ -990,7 +1044,7 @@ class ChatCompletionCreateParams(BaseModel):
|
||||
"stream_options",
|
||||
"temperature",
|
||||
"top_p",
|
||||
"model_list",
|
||||
"fallback_models",
|
||||
"reasoning_effort",
|
||||
"provider",
|
||||
]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletionchunk import ChatCompletionChunk, ChatCompletionChunkTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class StreamChatCompletionResponseBodyTypedDict(TypedDict):
|
||||
r"""Successful chat completion response"""
|
||||
|
||||
data: ChatCompletionChunkTypedDict
|
||||
r"""Streaming chat completion chunk"""
|
||||
|
||||
|
||||
class StreamChatCompletionResponseBody(BaseModel):
|
||||
r"""Successful chat completion response"""
|
||||
|
||||
data: ChatCompletionChunk
|
||||
r"""Streaming chat completion chunk"""
|
||||
@@ -24,6 +24,7 @@ class OpenRouter(BaseSDK):
|
||||
"""
|
||||
|
||||
chat: "Chat"
|
||||
r"""Chat completion operations"""
|
||||
_sub_sdk_map = {
|
||||
"chat": ("openrouter.chat", "Chat"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user