mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
chore: regenerate SDK to v0.0.19 with speakeasy
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
import importlib.metadata
|
||||
|
||||
__title__: str = "openrouter"
|
||||
__version__: str = "0.0.18"
|
||||
__version__: str = "0.0.19"
|
||||
__openapi_doc_version__: str = "1.0.0"
|
||||
__gen_version__: str = "2.755.9"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.0.18 2.755.9 1.0.0 openrouter"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.0.19 2.755.9 1.0.0 openrouter"
|
||||
|
||||
try:
|
||||
if __package__ is not None:
|
||||
|
||||
@@ -21,7 +21,6 @@ if TYPE_CHECKING:
|
||||
BadRequestResponseErrorData,
|
||||
BadRequestResponseErrorDataTypedDict,
|
||||
)
|
||||
from .chatcompletionfinishreason import ChatCompletionFinishReason
|
||||
from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict
|
||||
from .chatgenerationparams import (
|
||||
ChatGenerationParams,
|
||||
@@ -72,9 +71,15 @@ if TYPE_CHECKING:
|
||||
)
|
||||
from .chatmessagecontentitemvideo import (
|
||||
ChatMessageContentItemVideo,
|
||||
ChatMessageContentItemVideoInputVideo,
|
||||
ChatMessageContentItemVideoInputVideoTypedDict,
|
||||
ChatMessageContentItemVideoTypedDict,
|
||||
VideoURL,
|
||||
VideoURLTypedDict,
|
||||
ChatMessageContentItemVideoVideoURL,
|
||||
ChatMessageContentItemVideoVideoURLTypedDict,
|
||||
VideoURL1,
|
||||
VideoURL1TypedDict,
|
||||
VideoURL2,
|
||||
VideoURL2TypedDict,
|
||||
)
|
||||
from .chatmessagetokenlogprob import (
|
||||
ChatMessageTokenLogprob,
|
||||
@@ -93,8 +98,13 @@ if TYPE_CHECKING:
|
||||
ChatMessageToolCallTypedDict,
|
||||
)
|
||||
from .chatresponse import ChatResponse, ChatResponseTypedDict
|
||||
from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict
|
||||
from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
|
||||
from .chatresponsechoice import (
|
||||
ChatCompletionFinishReason,
|
||||
ChatResponseChoice,
|
||||
ChatResponseChoiceTypedDict,
|
||||
ChatStreamingChoice,
|
||||
ChatStreamingChoiceTypedDict,
|
||||
)
|
||||
from .chatstreamingmessagechunk import (
|
||||
ChatStreamingMessageChunk,
|
||||
ChatStreamingMessageChunkRole,
|
||||
@@ -146,6 +156,7 @@ if TYPE_CHECKING:
|
||||
CreateChargeRequest,
|
||||
CreateChargeRequestTypedDict,
|
||||
)
|
||||
from .datacollection import DataCollection
|
||||
from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
|
||||
from .edgenetworktimeoutresponseerrordata import (
|
||||
EdgeNetworkTimeoutResponseErrorData,
|
||||
@@ -408,7 +419,6 @@ if TYPE_CHECKING:
|
||||
OpenResponsesReasoningSummaryTextDoneEventTypedDict,
|
||||
)
|
||||
from .openresponsesrequest import (
|
||||
DataCollection,
|
||||
Engine,
|
||||
IDFileParser,
|
||||
IDModeration,
|
||||
@@ -442,7 +452,6 @@ if TYPE_CHECKING:
|
||||
Provider,
|
||||
ProviderTypedDict,
|
||||
ServiceTier,
|
||||
Sort,
|
||||
Truncation,
|
||||
)
|
||||
from .openresponsesresponsetext import (
|
||||
@@ -581,6 +590,7 @@ if TYPE_CHECKING:
|
||||
ProviderOverloadedResponseErrorData,
|
||||
ProviderOverloadedResponseErrorDataTypedDict,
|
||||
)
|
||||
from .providersort import ProviderSort
|
||||
from .publicendpoint import (
|
||||
Pricing,
|
||||
PricingTypedDict,
|
||||
@@ -821,7 +831,11 @@ __all__ = [
|
||||
"ChatMessageContentItemTextTypedDict",
|
||||
"ChatMessageContentItemTypedDict",
|
||||
"ChatMessageContentItemVideo",
|
||||
"ChatMessageContentItemVideoInputVideo",
|
||||
"ChatMessageContentItemVideoInputVideoTypedDict",
|
||||
"ChatMessageContentItemVideoTypedDict",
|
||||
"ChatMessageContentItemVideoVideoURL",
|
||||
"ChatMessageContentItemVideoVideoURLTypedDict",
|
||||
"ChatMessageTokenLogprob",
|
||||
"ChatMessageTokenLogprobTypedDict",
|
||||
"ChatMessageTokenLogprobs",
|
||||
@@ -1205,6 +1219,7 @@ __all__ = [
|
||||
"ProviderName",
|
||||
"ProviderOverloadedResponseErrorData",
|
||||
"ProviderOverloadedResponseErrorDataTypedDict",
|
||||
"ProviderSort",
|
||||
"ProviderTypedDict",
|
||||
"PublicEndpoint",
|
||||
"PublicEndpointQuantization",
|
||||
@@ -1310,7 +1325,6 @@ __all__ = [
|
||||
"ServiceTier",
|
||||
"ServiceUnavailableResponseErrorData",
|
||||
"ServiceUnavailableResponseErrorDataTypedDict",
|
||||
"Sort",
|
||||
"StreamOptions",
|
||||
"StreamOptionsTypedDict",
|
||||
"SystemMessage",
|
||||
@@ -1366,8 +1380,10 @@ __all__ = [
|
||||
"UserMessageTypedDict",
|
||||
"Variables",
|
||||
"VariablesTypedDict",
|
||||
"VideoURL",
|
||||
"VideoURLTypedDict",
|
||||
"VideoURL1",
|
||||
"VideoURL1TypedDict",
|
||||
"VideoURL2",
|
||||
"VideoURL2TypedDict",
|
||||
"WebSearchPreviewToolUserLocation",
|
||||
"WebSearchPreviewToolUserLocationType",
|
||||
"WebSearchPreviewToolUserLocationTypedDict",
|
||||
@@ -1385,7 +1401,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata",
|
||||
"BadRequestResponseErrorData": ".badrequestresponseerrordata",
|
||||
"BadRequestResponseErrorDataTypedDict": ".badrequestresponseerrordata",
|
||||
"ChatCompletionFinishReason": ".chatcompletionfinishreason",
|
||||
"ChatErrorError": ".chaterror",
|
||||
"ChatErrorErrorTypedDict": ".chaterror",
|
||||
"Code": ".chaterror",
|
||||
@@ -1426,9 +1441,15 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatMessageContentItemText": ".chatmessagecontentitemtext",
|
||||
"ChatMessageContentItemTextTypedDict": ".chatmessagecontentitemtext",
|
||||
"ChatMessageContentItemVideo": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoInputVideo": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoInputVideoTypedDict": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoTypedDict": ".chatmessagecontentitemvideo",
|
||||
"VideoURL": ".chatmessagecontentitemvideo",
|
||||
"VideoURLTypedDict": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoVideoURL": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoVideoURLTypedDict": ".chatmessagecontentitemvideo",
|
||||
"VideoURL1": ".chatmessagecontentitemvideo",
|
||||
"VideoURL1TypedDict": ".chatmessagecontentitemvideo",
|
||||
"VideoURL2": ".chatmessagecontentitemvideo",
|
||||
"VideoURL2TypedDict": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageTokenLogprob": ".chatmessagetokenlogprob",
|
||||
"ChatMessageTokenLogprobTypedDict": ".chatmessagetokenlogprob",
|
||||
"TopLogprob": ".chatmessagetokenlogprob",
|
||||
@@ -1441,10 +1462,11 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatMessageToolCallTypedDict": ".chatmessagetoolcall",
|
||||
"ChatResponse": ".chatresponse",
|
||||
"ChatResponseTypedDict": ".chatresponse",
|
||||
"ChatCompletionFinishReason": ".chatresponsechoice",
|
||||
"ChatResponseChoice": ".chatresponsechoice",
|
||||
"ChatResponseChoiceTypedDict": ".chatresponsechoice",
|
||||
"ChatStreamingChoice": ".chatstreamingchoice",
|
||||
"ChatStreamingChoiceTypedDict": ".chatstreamingchoice",
|
||||
"ChatStreamingChoice": ".chatresponsechoice",
|
||||
"ChatStreamingChoiceTypedDict": ".chatresponsechoice",
|
||||
"ChatStreamingMessageChunk": ".chatstreamingmessagechunk",
|
||||
"ChatStreamingMessageChunkRole": ".chatstreamingmessagechunk",
|
||||
"ChatStreamingMessageChunkTypedDict": ".chatstreamingmessagechunk",
|
||||
@@ -1488,6 +1510,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChainID": ".createchargerequest",
|
||||
"CreateChargeRequest": ".createchargerequest",
|
||||
"CreateChargeRequestTypedDict": ".createchargerequest",
|
||||
"DataCollection": ".datacollection",
|
||||
"DefaultParameters": ".defaultparameters",
|
||||
"DefaultParametersTypedDict": ".defaultparameters",
|
||||
"EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponseerrordata",
|
||||
@@ -1687,7 +1710,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"DataCollection": ".openresponsesrequest",
|
||||
"Engine": ".openresponsesrequest",
|
||||
"IDFileParser": ".openresponsesrequest",
|
||||
"IDModeration": ".openresponsesrequest",
|
||||
@@ -1721,7 +1743,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"Provider": ".openresponsesrequest",
|
||||
"ProviderTypedDict": ".openresponsesrequest",
|
||||
"ServiceTier": ".openresponsesrequest",
|
||||
"Sort": ".openresponsesrequest",
|
||||
"Truncation": ".openresponsesrequest",
|
||||
"OpenResponsesResponseText": ".openresponsesresponsetext",
|
||||
"OpenResponsesResponseTextTypedDict": ".openresponsesresponsetext",
|
||||
@@ -1834,6 +1855,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ProviderName": ".providername",
|
||||
"ProviderOverloadedResponseErrorData": ".provideroverloadedresponseerrordata",
|
||||
"ProviderOverloadedResponseErrorDataTypedDict": ".provideroverloadedresponseerrordata",
|
||||
"ProviderSort": ".providersort",
|
||||
"Pricing": ".publicendpoint",
|
||||
"PricingTypedDict": ".publicendpoint",
|
||||
"PublicEndpoint": ".publicendpoint",
|
||||
|
||||
@@ -31,6 +31,7 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
Effort = Union[
|
||||
Literal[
|
||||
"none",
|
||||
"minimal",
|
||||
"low",
|
||||
"medium",
|
||||
|
||||
@@ -40,6 +40,7 @@ ChatMessageContentItem = Annotated[
|
||||
Annotated[ChatMessageContentItemImage, Tag("image_url")],
|
||||
Annotated[ChatMessageContentItemAudio, Tag("input_audio")],
|
||||
Annotated[ChatMessageContentItemVideo, Tag("input_video")],
|
||||
Annotated[ChatMessageContentItemVideo, Tag("video_url")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
@@ -5,25 +5,47 @@ from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_const
|
||||
import pydantic
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import Literal
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
class VideoURLTypedDict(TypedDict):
|
||||
class VideoURL2TypedDict(TypedDict):
|
||||
url: str
|
||||
|
||||
|
||||
class VideoURL(BaseModel):
|
||||
class VideoURL2(BaseModel):
|
||||
url: str
|
||||
|
||||
|
||||
class ChatMessageContentItemVideoTypedDict(TypedDict):
|
||||
video_url: VideoURLTypedDict
|
||||
class ChatMessageContentItemVideoVideoURLTypedDict(TypedDict):
|
||||
video_url: VideoURL2TypedDict
|
||||
type: Literal["video_url"]
|
||||
|
||||
|
||||
class ChatMessageContentItemVideoVideoURL(BaseModel):
|
||||
video_url: VideoURL2
|
||||
|
||||
TYPE: Annotated[
|
||||
Annotated[Literal["video_url"], AfterValidator(validate_const("video_url"))],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "video_url"
|
||||
|
||||
|
||||
class VideoURL1TypedDict(TypedDict):
|
||||
url: str
|
||||
|
||||
|
||||
class VideoURL1(BaseModel):
|
||||
url: str
|
||||
|
||||
|
||||
class ChatMessageContentItemVideoInputVideoTypedDict(TypedDict):
|
||||
video_url: VideoURL1TypedDict
|
||||
type: Literal["input_video"]
|
||||
|
||||
|
||||
class ChatMessageContentItemVideo(BaseModel):
|
||||
video_url: VideoURL
|
||||
class ChatMessageContentItemVideoInputVideo(BaseModel):
|
||||
video_url: VideoURL1
|
||||
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
@@ -31,3 +53,18 @@ class ChatMessageContentItemVideo(BaseModel):
|
||||
],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "input_video"
|
||||
|
||||
|
||||
ChatMessageContentItemVideoTypedDict = TypeAliasType(
|
||||
"ChatMessageContentItemVideoTypedDict",
|
||||
Union[
|
||||
ChatMessageContentItemVideoInputVideoTypedDict,
|
||||
ChatMessageContentItemVideoVideoURLTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
ChatMessageContentItemVideo = TypeAliasType(
|
||||
"ChatMessageContentItemVideo",
|
||||
Union[ChatMessageContentItemVideoInputVideo, ChatMessageContentItemVideoVideoURL],
|
||||
)
|
||||
|
||||
@@ -2,24 +2,41 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
|
||||
from .chatcompletionfinishreason import ChatCompletionFinishReason
|
||||
from .chatmessagetokenlogprobs import (
|
||||
ChatMessageTokenLogprobs,
|
||||
ChatMessageTokenLogprobsTypedDict,
|
||||
)
|
||||
from .chatstreamingmessagechunk import (
|
||||
ChatStreamingMessageChunk,
|
||||
ChatStreamingMessageChunkTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
ChatCompletionFinishReason = Union[
|
||||
Literal[
|
||||
"tool_calls",
|
||||
"stop",
|
||||
"length",
|
||||
"content_filter",
|
||||
"error",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class ChatResponseChoiceTypedDict(TypedDict):
|
||||
finish_reason: Nullable[ChatCompletionFinishReason]
|
||||
index: float
|
||||
@@ -67,3 +84,52 @@ class ChatResponseChoice(BaseModel):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class ChatStreamingChoiceTypedDict(TypedDict):
|
||||
delta: ChatStreamingMessageChunkTypedDict
|
||||
finish_reason: Nullable[ChatCompletionFinishReason]
|
||||
index: float
|
||||
logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
|
||||
|
||||
|
||||
class ChatStreamingChoice(BaseModel):
|
||||
delta: ChatStreamingMessageChunk
|
||||
|
||||
finish_reason: Annotated[
|
||||
Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
|
||||
index: float
|
||||
|
||||
logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["logprobs"]
|
||||
nullable_fields = ["finish_reason", "logprobs"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletionfinishreason import ChatCompletionFinishReason
|
||||
from .chatmessagetokenlogprobs import (
|
||||
ChatMessageTokenLogprobs,
|
||||
ChatMessageTokenLogprobsTypedDict,
|
||||
)
|
||||
from .chatstreamingmessagechunk import (
|
||||
ChatStreamingMessageChunk,
|
||||
ChatStreamingMessageChunkTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatStreamingChoiceTypedDict(TypedDict):
|
||||
delta: ChatStreamingMessageChunkTypedDict
|
||||
finish_reason: Nullable[ChatCompletionFinishReason]
|
||||
index: float
|
||||
logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
|
||||
|
||||
|
||||
class ChatStreamingChoice(BaseModel):
|
||||
delta: ChatStreamingMessageChunk
|
||||
|
||||
finish_reason: Annotated[
|
||||
Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
|
||||
index: float
|
||||
|
||||
logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["logprobs"]
|
||||
nullable_fields = ["finish_reason", "logprobs"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -5,7 +5,7 @@ from .chatgenerationtokenusage import (
|
||||
ChatGenerationTokenUsage,
|
||||
ChatGenerationTokenUsageTypedDict,
|
||||
)
|
||||
from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
|
||||
from .chatresponsechoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
DataCollection = Union[
|
||||
Literal[
|
||||
"deny",
|
||||
"allow",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
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.
|
||||
"""
|
||||
@@ -11,6 +11,7 @@ OpenAIResponsesReasoningEffort = Union[
|
||||
"medium",
|
||||
"low",
|
||||
"minimal",
|
||||
"none",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
@@ -57,6 +57,7 @@ OpenResponsesReasoningFormat = Union[
|
||||
"openai-responses-v1",
|
||||
"xai-responses-v1",
|
||||
"anthropic-claude-v1",
|
||||
"google-gemini-v1",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .datacollection import DataCollection
|
||||
from .openairesponsesincludable import OpenAIResponsesIncludable
|
||||
from .openairesponsesprompt import OpenAIResponsesPrompt, OpenAIResponsesPromptTypedDict
|
||||
from .openairesponsestoolchoice_union import (
|
||||
@@ -33,6 +34,7 @@ from .openresponseswebsearchtool import (
|
||||
OpenResponsesWebSearchToolTypedDict,
|
||||
)
|
||||
from .providername import ProviderName
|
||||
from .providersort import ProviderSort
|
||||
from .quantization import Quantization
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
@@ -151,20 +153,6 @@ Truncation = Union[
|
||||
]
|
||||
|
||||
|
||||
DataCollection = Union[
|
||||
Literal[
|
||||
"deny",
|
||||
"allow",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
OrderTypedDict = TypeAliasType("OrderTypedDict", Union[ProviderName, str])
|
||||
|
||||
|
||||
@@ -192,17 +180,6 @@ Ignore = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
Sort = Union[
|
||||
Literal[
|
||||
"price",
|
||||
"throughput",
|
||||
"latency",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
|
||||
|
||||
class MaxPriceTypedDict(TypedDict):
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
@@ -251,8 +228,8 @@ class ProviderTypedDict(TypedDict):
|
||||
data_collection: NotRequired[Nullable[DataCollection]]
|
||||
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.
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
zdr: NotRequired[Nullable[bool]]
|
||||
r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used."""
|
||||
@@ -266,7 +243,7 @@ class ProviderTypedDict(TypedDict):
|
||||
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]]]
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
sort: NotRequired[Nullable[Sort]]
|
||||
sort: NotRequired[Nullable[ProviderSort]]
|
||||
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]
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
@@ -290,8 +267,8 @@ class Provider(BaseModel):
|
||||
] = 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.
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
|
||||
zdr: OptionalNullable[bool] = UNSET
|
||||
@@ -315,7 +292,7 @@ class Provider(BaseModel):
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
|
||||
sort: Annotated[
|
||||
OptionalNullable[Sort], PlainValidator(validate_open_enum(False))
|
||||
OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False))
|
||||
] = UNSET
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
|
||||
|
||||
@@ -7,44 +7,26 @@ from typing import Literal, Union
|
||||
|
||||
ProviderName = Union[
|
||||
Literal[
|
||||
"AnyScale",
|
||||
"Cent-ML",
|
||||
"HuggingFace",
|
||||
"Hyperbolic 2",
|
||||
"Lepton",
|
||||
"Lynn 2",
|
||||
"Lynn",
|
||||
"Mancer",
|
||||
"Modal",
|
||||
"OctoAI",
|
||||
"Recursal",
|
||||
"Reflection",
|
||||
"Replicate",
|
||||
"SambaNova 2",
|
||||
"SF Compute",
|
||||
"Together 2",
|
||||
"01.AI",
|
||||
"AI21",
|
||||
"AionLabs",
|
||||
"Alibaba",
|
||||
"Amazon Bedrock",
|
||||
"Anthropic",
|
||||
"Arcee",
|
||||
"AtlasCloud",
|
||||
"Atoma",
|
||||
"Avian",
|
||||
"Azure",
|
||||
"BaseTen",
|
||||
"Black Forest Labs",
|
||||
"Cerebras",
|
||||
"Chutes",
|
||||
"Cirrascale",
|
||||
"Clarifai",
|
||||
"Cloudflare",
|
||||
"Cohere",
|
||||
"CrofAI",
|
||||
"Crusoe",
|
||||
"DeepInfra",
|
||||
"DeepSeek",
|
||||
"Enfer",
|
||||
"Featherless",
|
||||
"Fireworks",
|
||||
"Friendli",
|
||||
@@ -57,12 +39,8 @@ ProviderName = Union[
|
||||
"InferenceNet",
|
||||
"Infermatic",
|
||||
"Inflection",
|
||||
"InoCloud",
|
||||
"Kluster",
|
||||
"Lambda",
|
||||
"Liquid",
|
||||
"Mancer 2",
|
||||
"Meta",
|
||||
"Minimax",
|
||||
"ModelRun",
|
||||
"Mistral",
|
||||
@@ -72,7 +50,6 @@ ProviderName = Union[
|
||||
"NCompass",
|
||||
"Nebius",
|
||||
"NextBit",
|
||||
"Nineteen",
|
||||
"Novita",
|
||||
"Nvidia",
|
||||
"OpenAI",
|
||||
@@ -87,7 +64,6 @@ ProviderName = Union[
|
||||
"Switchpoint",
|
||||
"Targon",
|
||||
"Together",
|
||||
"Ubicloud",
|
||||
"Venice",
|
||||
"WandB",
|
||||
"xAI",
|
||||
|
||||
+5
-6
@@ -5,13 +5,12 @@ from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
ChatCompletionFinishReason = Union[
|
||||
ProviderSort = Union[
|
||||
Literal[
|
||||
"tool_calls",
|
||||
"stop",
|
||||
"length",
|
||||
"content_filter",
|
||||
"error",
|
||||
"price",
|
||||
"throughput",
|
||||
"latency",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
@@ -21,6 +21,8 @@ class PricingTypedDict(TypedDict):
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_token: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_output: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
audio: NotRequired[Any]
|
||||
@@ -51,6 +53,9 @@ class Pricing(BaseModel):
|
||||
image: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_token: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_output: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ class PublicPricingTypedDict(TypedDict):
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_token: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_output: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
audio: NotRequired[Any]
|
||||
@@ -49,6 +51,9 @@ class PublicPricing(BaseModel):
|
||||
image: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_token: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_output: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
|
||||
@@ -21,18 +21,18 @@ class Embeddings(BaseSDK):
|
||||
def generate(
|
||||
self,
|
||||
*,
|
||||
input: Union[operations.Input, operations.InputTypedDict],
|
||||
input: Union[operations.InputUnion, operations.InputUnionTypedDict],
|
||||
model: str,
|
||||
encoding_format: Optional[operations.EncodingFormat] = None,
|
||||
dimensions: Optional[int] = None,
|
||||
user: Optional[str] = None,
|
||||
provider: Optional[
|
||||
Union[
|
||||
operations.CreateEmbeddingsProvider,
|
||||
operations.CreateEmbeddingsProviderTypedDict,
|
||||
]
|
||||
] = None,
|
||||
encoding_format: Optional[
|
||||
Union[operations.EncodingFormat, operations.EncodingFormatTypedDict]
|
||||
] = None,
|
||||
user: Optional[str] = None,
|
||||
input_type: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -45,9 +45,11 @@ class Embeddings(BaseSDK):
|
||||
|
||||
:param input:
|
||||
:param model:
|
||||
:param provider:
|
||||
:param encoding_format:
|
||||
:param dimensions:
|
||||
:param user:
|
||||
:param provider:
|
||||
:param input_type:
|
||||
: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
|
||||
@@ -65,13 +67,15 @@ class Embeddings(BaseSDK):
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.CreateEmbeddingsRequest(
|
||||
input=input,
|
||||
input=utils.get_pydantic_model(input, operations.InputUnion),
|
||||
model=model,
|
||||
encoding_format=encoding_format,
|
||||
dimensions=dimensions,
|
||||
user=user,
|
||||
provider=utils.get_pydantic_model(
|
||||
provider, Optional[operations.CreateEmbeddingsProvider]
|
||||
),
|
||||
encoding_format=encoding_format,
|
||||
user=user,
|
||||
input_type=input_type,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
@@ -204,18 +208,18 @@ class Embeddings(BaseSDK):
|
||||
async def generate_async(
|
||||
self,
|
||||
*,
|
||||
input: Union[operations.Input, operations.InputTypedDict],
|
||||
input: Union[operations.InputUnion, operations.InputUnionTypedDict],
|
||||
model: str,
|
||||
encoding_format: Optional[operations.EncodingFormat] = None,
|
||||
dimensions: Optional[int] = None,
|
||||
user: Optional[str] = None,
|
||||
provider: Optional[
|
||||
Union[
|
||||
operations.CreateEmbeddingsProvider,
|
||||
operations.CreateEmbeddingsProviderTypedDict,
|
||||
]
|
||||
] = None,
|
||||
encoding_format: Optional[
|
||||
Union[operations.EncodingFormat, operations.EncodingFormatTypedDict]
|
||||
] = None,
|
||||
user: Optional[str] = None,
|
||||
input_type: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -228,9 +232,11 @@ class Embeddings(BaseSDK):
|
||||
|
||||
:param input:
|
||||
:param model:
|
||||
:param provider:
|
||||
:param encoding_format:
|
||||
:param dimensions:
|
||||
:param user:
|
||||
:param provider:
|
||||
:param input_type:
|
||||
: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
|
||||
@@ -248,13 +254,15 @@ class Embeddings(BaseSDK):
|
||||
base_url = self._get_url(base_url, url_variables)
|
||||
|
||||
request = operations.CreateEmbeddingsRequest(
|
||||
input=input,
|
||||
input=utils.get_pydantic_model(input, operations.InputUnion),
|
||||
model=model,
|
||||
encoding_format=encoding_format,
|
||||
dimensions=dimensions,
|
||||
user=user,
|
||||
provider=utils.get_pydantic_model(
|
||||
provider, Optional[operations.CreateEmbeddingsProvider]
|
||||
),
|
||||
encoding_format=encoding_format,
|
||||
user=user,
|
||||
input_type=input_type,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
|
||||
@@ -32,6 +32,12 @@ if TYPE_CHECKING:
|
||||
Web3DataTypedDict,
|
||||
)
|
||||
from .createembeddings import (
|
||||
Content,
|
||||
ContentImageURL,
|
||||
ContentImageURLTypedDict,
|
||||
ContentText,
|
||||
ContentTextTypedDict,
|
||||
ContentTypedDict,
|
||||
CreateEmbeddingsData,
|
||||
CreateEmbeddingsDataTypedDict,
|
||||
CreateEmbeddingsProvider,
|
||||
@@ -42,17 +48,17 @@ if TYPE_CHECKING:
|
||||
CreateEmbeddingsResponseBody,
|
||||
CreateEmbeddingsResponseBodyTypedDict,
|
||||
CreateEmbeddingsResponseTypedDict,
|
||||
DataCollection,
|
||||
Embedding,
|
||||
EmbeddingTypedDict,
|
||||
EncodingFormat,
|
||||
EncodingFormatBase64,
|
||||
EncodingFormatFloat,
|
||||
EncodingFormatTypedDict,
|
||||
Ignore,
|
||||
IgnoreTypedDict,
|
||||
ImageURL,
|
||||
ImageURLTypedDict,
|
||||
Input,
|
||||
InputTypedDict,
|
||||
InputUnion,
|
||||
InputUnionTypedDict,
|
||||
MaxPrice,
|
||||
MaxPriceTypedDict,
|
||||
Object,
|
||||
@@ -61,7 +67,8 @@ if TYPE_CHECKING:
|
||||
OnlyTypedDict,
|
||||
Order,
|
||||
OrderTypedDict,
|
||||
Sort,
|
||||
TypeImageURL,
|
||||
TypeText,
|
||||
Usage,
|
||||
UsageTypedDict,
|
||||
)
|
||||
@@ -183,6 +190,12 @@ __all__ = [
|
||||
"APIType",
|
||||
"CallData",
|
||||
"CallDataTypedDict",
|
||||
"Content",
|
||||
"ContentImageURL",
|
||||
"ContentImageURLTypedDict",
|
||||
"ContentText",
|
||||
"ContentTextTypedDict",
|
||||
"ContentTypedDict",
|
||||
"CreateAuthKeysCodeCodeChallengeMethod",
|
||||
"CreateAuthKeysCodeData",
|
||||
"CreateAuthKeysCodeDataTypedDict",
|
||||
@@ -217,7 +230,6 @@ __all__ = [
|
||||
"CreateResponsesResponseBody",
|
||||
"CreateResponsesResponseBodyTypedDict",
|
||||
"CreateResponsesResponseTypedDict",
|
||||
"DataCollection",
|
||||
"DeleteKeysRequest",
|
||||
"DeleteKeysRequestTypedDict",
|
||||
"DeleteKeysResponse",
|
||||
@@ -225,9 +237,6 @@ __all__ = [
|
||||
"Embedding",
|
||||
"EmbeddingTypedDict",
|
||||
"EncodingFormat",
|
||||
"EncodingFormatBase64",
|
||||
"EncodingFormatFloat",
|
||||
"EncodingFormatTypedDict",
|
||||
"ExchangeAuthCodeForAPIKeyCodeChallengeMethod",
|
||||
"ExchangeAuthCodeForAPIKeyRequest",
|
||||
"ExchangeAuthCodeForAPIKeyRequestTypedDict",
|
||||
@@ -268,8 +277,12 @@ __all__ = [
|
||||
"GetUserActivityResponseTypedDict",
|
||||
"Ignore",
|
||||
"IgnoreTypedDict",
|
||||
"ImageURL",
|
||||
"ImageURLTypedDict",
|
||||
"Input",
|
||||
"InputTypedDict",
|
||||
"InputUnion",
|
||||
"InputUnionTypedDict",
|
||||
"ListData",
|
||||
"ListDataTypedDict",
|
||||
"ListEndpointsRequest",
|
||||
@@ -302,10 +315,11 @@ __all__ = [
|
||||
"RateLimitTypedDict",
|
||||
"SendChatCompletionRequestResponse",
|
||||
"SendChatCompletionRequestResponseTypedDict",
|
||||
"Sort",
|
||||
"SupportedParameter",
|
||||
"TransferIntent",
|
||||
"TransferIntentTypedDict",
|
||||
"TypeImageURL",
|
||||
"TypeText",
|
||||
"UpdateKeysData",
|
||||
"UpdateKeysDataTypedDict",
|
||||
"UpdateKeysLimitReset",
|
||||
@@ -343,6 +357,12 @@ _dynamic_imports: dict[str, str] = {
|
||||
"TransferIntentTypedDict": ".createcoinbasecharge",
|
||||
"Web3Data": ".createcoinbasecharge",
|
||||
"Web3DataTypedDict": ".createcoinbasecharge",
|
||||
"Content": ".createembeddings",
|
||||
"ContentImageURL": ".createembeddings",
|
||||
"ContentImageURLTypedDict": ".createembeddings",
|
||||
"ContentText": ".createembeddings",
|
||||
"ContentTextTypedDict": ".createembeddings",
|
||||
"ContentTypedDict": ".createembeddings",
|
||||
"CreateEmbeddingsData": ".createembeddings",
|
||||
"CreateEmbeddingsDataTypedDict": ".createembeddings",
|
||||
"CreateEmbeddingsProvider": ".createembeddings",
|
||||
@@ -353,17 +373,17 @@ _dynamic_imports: dict[str, str] = {
|
||||
"CreateEmbeddingsResponseBody": ".createembeddings",
|
||||
"CreateEmbeddingsResponseBodyTypedDict": ".createembeddings",
|
||||
"CreateEmbeddingsResponseTypedDict": ".createembeddings",
|
||||
"DataCollection": ".createembeddings",
|
||||
"Embedding": ".createembeddings",
|
||||
"EmbeddingTypedDict": ".createembeddings",
|
||||
"EncodingFormat": ".createembeddings",
|
||||
"EncodingFormatBase64": ".createembeddings",
|
||||
"EncodingFormatFloat": ".createembeddings",
|
||||
"EncodingFormatTypedDict": ".createembeddings",
|
||||
"Ignore": ".createembeddings",
|
||||
"IgnoreTypedDict": ".createembeddings",
|
||||
"ImageURL": ".createembeddings",
|
||||
"ImageURLTypedDict": ".createembeddings",
|
||||
"Input": ".createembeddings",
|
||||
"InputTypedDict": ".createembeddings",
|
||||
"InputUnion": ".createembeddings",
|
||||
"InputUnionTypedDict": ".createembeddings",
|
||||
"MaxPrice": ".createembeddings",
|
||||
"MaxPriceTypedDict": ".createembeddings",
|
||||
"Object": ".createembeddings",
|
||||
@@ -372,7 +392,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"OnlyTypedDict": ".createembeddings",
|
||||
"Order": ".createembeddings",
|
||||
"OrderTypedDict": ".createembeddings",
|
||||
"Sort": ".createembeddings",
|
||||
"TypeImageURL": ".createembeddings",
|
||||
"TypeText": ".createembeddings",
|
||||
"Usage": ".createembeddings",
|
||||
"UsageTypedDict": ".createembeddings",
|
||||
"CreateKeysData": ".createkeys",
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.components import (
|
||||
datacollection as components_datacollection,
|
||||
providername as components_providername,
|
||||
providersort as components_providersort,
|
||||
quantization as components_quantization,
|
||||
)
|
||||
from openrouter.types import (
|
||||
@@ -20,26 +22,76 @@ from typing import Any, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
InputTypedDict = TypeAliasType(
|
||||
"InputTypedDict", Union[str, List[str], List[float], List[List[float]]]
|
||||
TypeImageURL = Literal["image_url",]
|
||||
|
||||
|
||||
class ImageURLTypedDict(TypedDict):
|
||||
url: str
|
||||
|
||||
|
||||
class ImageURL(BaseModel):
|
||||
url: str
|
||||
|
||||
|
||||
class ContentImageURLTypedDict(TypedDict):
|
||||
type: TypeImageURL
|
||||
image_url: ImageURLTypedDict
|
||||
|
||||
|
||||
class ContentImageURL(BaseModel):
|
||||
type: TypeImageURL
|
||||
|
||||
image_url: ImageURL
|
||||
|
||||
|
||||
TypeText = Literal["text",]
|
||||
|
||||
|
||||
class ContentTextTypedDict(TypedDict):
|
||||
type: TypeText
|
||||
text: str
|
||||
|
||||
|
||||
class ContentText(BaseModel):
|
||||
type: TypeText
|
||||
|
||||
text: str
|
||||
|
||||
|
||||
ContentTypedDict = TypeAliasType(
|
||||
"ContentTypedDict", Union[ContentTextTypedDict, ContentImageURLTypedDict]
|
||||
)
|
||||
|
||||
|
||||
Input = TypeAliasType("Input", Union[str, List[str], List[float], List[List[float]]])
|
||||
Content = TypeAliasType("Content", Union[ContentText, ContentImageURL])
|
||||
|
||||
|
||||
DataCollection = Union[
|
||||
class InputTypedDict(TypedDict):
|
||||
content: List[ContentTypedDict]
|
||||
|
||||
|
||||
class Input(BaseModel):
|
||||
content: List[Content]
|
||||
|
||||
|
||||
InputUnionTypedDict = TypeAliasType(
|
||||
"InputUnionTypedDict",
|
||||
Union[str, List[str], List[float], List[List[float]], List[InputTypedDict]],
|
||||
)
|
||||
|
||||
|
||||
InputUnion = TypeAliasType(
|
||||
"InputUnion", Union[str, List[str], List[float], List[List[float]], List[Input]]
|
||||
)
|
||||
|
||||
|
||||
EncodingFormat = Union[
|
||||
Literal[
|
||||
"deny",
|
||||
"allow",
|
||||
"float",
|
||||
"base64",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
OrderTypedDict = TypeAliasType(
|
||||
@@ -93,17 +145,6 @@ Ignore = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
Sort = Union[
|
||||
Literal[
|
||||
"price",
|
||||
"throughput",
|
||||
"latency",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
|
||||
|
||||
class MaxPriceTypedDict(TypedDict):
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
@@ -147,11 +188,11 @@ class CreateEmbeddingsProviderTypedDict(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[components_datacollection.DataCollection]]
|
||||
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.
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
zdr: NotRequired[Nullable[bool]]
|
||||
r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used."""
|
||||
@@ -165,7 +206,7 @@ class CreateEmbeddingsProviderTypedDict(TypedDict):
|
||||
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[components_quantization.Quantization]]]
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
sort: NotRequired[Nullable[Sort]]
|
||||
sort: NotRequired[Nullable[components_providersort.ProviderSort]]
|
||||
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]
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
@@ -183,12 +224,13 @@ class CreateEmbeddingsProvider(BaseModel):
|
||||
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: Annotated[
|
||||
OptionalNullable[DataCollection], PlainValidator(validate_open_enum(False))
|
||||
OptionalNullable[components_datacollection.DataCollection],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = 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.
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
|
||||
zdr: OptionalNullable[bool] = UNSET
|
||||
@@ -217,7 +259,8 @@ class CreateEmbeddingsProvider(BaseModel):
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
|
||||
sort: Annotated[
|
||||
OptionalNullable[Sort], PlainValidator(validate_open_enum(False))
|
||||
OptionalNullable[components_providersort.ProviderSort],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = UNSET
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
|
||||
@@ -278,41 +321,33 @@ class CreateEmbeddingsProvider(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
EncodingFormatBase64 = Literal["base64",]
|
||||
|
||||
|
||||
EncodingFormatFloat = Literal["float",]
|
||||
|
||||
|
||||
EncodingFormatTypedDict = TypeAliasType(
|
||||
"EncodingFormatTypedDict", Union[EncodingFormatFloat, EncodingFormatBase64]
|
||||
)
|
||||
|
||||
|
||||
EncodingFormat = TypeAliasType(
|
||||
"EncodingFormat", Union[EncodingFormatFloat, EncodingFormatBase64]
|
||||
)
|
||||
|
||||
|
||||
class CreateEmbeddingsRequestTypedDict(TypedDict):
|
||||
input: InputTypedDict
|
||||
input: InputUnionTypedDict
|
||||
model: str
|
||||
provider: NotRequired[CreateEmbeddingsProviderTypedDict]
|
||||
encoding_format: NotRequired[EncodingFormatTypedDict]
|
||||
encoding_format: NotRequired[EncodingFormat]
|
||||
dimensions: NotRequired[int]
|
||||
user: NotRequired[str]
|
||||
provider: NotRequired[CreateEmbeddingsProviderTypedDict]
|
||||
input_type: NotRequired[str]
|
||||
|
||||
|
||||
class CreateEmbeddingsRequest(BaseModel):
|
||||
input: Input
|
||||
input: InputUnion
|
||||
|
||||
model: str
|
||||
|
||||
provider: Optional[CreateEmbeddingsProvider] = None
|
||||
encoding_format: Annotated[
|
||||
Optional[EncodingFormat], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
|
||||
encoding_format: Optional[EncodingFormat] = None
|
||||
dimensions: Optional[int] = None
|
||||
|
||||
user: Optional[str] = None
|
||||
|
||||
provider: Optional[CreateEmbeddingsProvider] = None
|
||||
|
||||
input_type: Optional[str] = None
|
||||
|
||||
|
||||
Object = Literal["list",]
|
||||
|
||||
|
||||
@@ -39,22 +39,21 @@ GetParametersProvider = Union[
|
||||
"Alibaba",
|
||||
"Amazon Bedrock",
|
||||
"Anthropic",
|
||||
"Arcee",
|
||||
"AtlasCloud",
|
||||
"Atoma",
|
||||
"Avian",
|
||||
"Azure",
|
||||
"BaseTen",
|
||||
"Black Forest Labs",
|
||||
"Cerebras",
|
||||
"Chutes",
|
||||
"Cirrascale",
|
||||
"Clarifai",
|
||||
"Cloudflare",
|
||||
"Cohere",
|
||||
"CrofAI",
|
||||
"Crusoe",
|
||||
"DeepInfra",
|
||||
"DeepSeek",
|
||||
"Enfer",
|
||||
"Featherless",
|
||||
"Fireworks",
|
||||
"Friendli",
|
||||
@@ -67,11 +66,8 @@ GetParametersProvider = Union[
|
||||
"InferenceNet",
|
||||
"Infermatic",
|
||||
"Inflection",
|
||||
"Kluster",
|
||||
"Lambda",
|
||||
"Liquid",
|
||||
"Mancer 2",
|
||||
"Meta",
|
||||
"Minimax",
|
||||
"ModelRun",
|
||||
"Mistral",
|
||||
@@ -81,7 +77,6 @@ GetParametersProvider = Union[
|
||||
"NCompass",
|
||||
"Nebius",
|
||||
"NextBit",
|
||||
"Nineteen",
|
||||
"Novita",
|
||||
"Nvidia",
|
||||
"OpenAI",
|
||||
@@ -96,7 +91,6 @@ GetParametersProvider = Union[
|
||||
"Switchpoint",
|
||||
"Targon",
|
||||
"Together",
|
||||
"Ubicloud",
|
||||
"Venice",
|
||||
"WandB",
|
||||
"xAI",
|
||||
|
||||
Reference in New Issue
Block a user