mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
latest updates
This commit is contained in:
@@ -45,8 +45,6 @@ if TYPE_CHECKING:
|
||||
CreateEmbeddingsRequest,
|
||||
CreateEmbeddingsRequestTypedDict,
|
||||
CreateEmbeddingsResponse,
|
||||
CreateEmbeddingsResponseBody,
|
||||
CreateEmbeddingsResponseBodyTypedDict,
|
||||
CreateEmbeddingsResponseTypedDict,
|
||||
Embedding,
|
||||
EmbeddingTypedDict,
|
||||
@@ -100,7 +98,12 @@ if TYPE_CHECKING:
|
||||
ExchangeAuthCodeForAPIKeyResponse,
|
||||
ExchangeAuthCodeForAPIKeyResponseTypedDict,
|
||||
)
|
||||
from .getcredits import GetCreditsResponse, GetCreditsResponseTypedDict
|
||||
from .getcredits import (
|
||||
GetCreditsData,
|
||||
GetCreditsDataTypedDict,
|
||||
GetCreditsResponse,
|
||||
GetCreditsResponseTypedDict,
|
||||
)
|
||||
from .getcurrentkey import (
|
||||
GetCurrentKeyData,
|
||||
GetCurrentKeyDataTypedDict,
|
||||
@@ -216,8 +219,6 @@ __all__ = [
|
||||
"CreateEmbeddingsRequest",
|
||||
"CreateEmbeddingsRequestTypedDict",
|
||||
"CreateEmbeddingsResponse",
|
||||
"CreateEmbeddingsResponseBody",
|
||||
"CreateEmbeddingsResponseBodyTypedDict",
|
||||
"CreateEmbeddingsResponseTypedDict",
|
||||
"CreateKeysData",
|
||||
"CreateKeysDataTypedDict",
|
||||
@@ -242,6 +243,8 @@ __all__ = [
|
||||
"ExchangeAuthCodeForAPIKeyRequestTypedDict",
|
||||
"ExchangeAuthCodeForAPIKeyResponse",
|
||||
"ExchangeAuthCodeForAPIKeyResponseTypedDict",
|
||||
"GetCreditsData",
|
||||
"GetCreditsDataTypedDict",
|
||||
"GetCreditsResponse",
|
||||
"GetCreditsResponseTypedDict",
|
||||
"GetCurrentKeyData",
|
||||
@@ -370,8 +373,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"CreateEmbeddingsRequest": ".createembeddings",
|
||||
"CreateEmbeddingsRequestTypedDict": ".createembeddings",
|
||||
"CreateEmbeddingsResponse": ".createembeddings",
|
||||
"CreateEmbeddingsResponseBody": ".createembeddings",
|
||||
"CreateEmbeddingsResponseBodyTypedDict": ".createembeddings",
|
||||
"CreateEmbeddingsResponseTypedDict": ".createembeddings",
|
||||
"Embedding": ".createembeddings",
|
||||
"EmbeddingTypedDict": ".createembeddings",
|
||||
@@ -416,6 +417,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ExchangeAuthCodeForAPIKeyRequestTypedDict": ".exchangeauthcodeforapikey",
|
||||
"ExchangeAuthCodeForAPIKeyResponse": ".exchangeauthcodeforapikey",
|
||||
"ExchangeAuthCodeForAPIKeyResponseTypedDict": ".exchangeauthcodeforapikey",
|
||||
"GetCreditsData": ".getcredits",
|
||||
"GetCreditsDataTypedDict": ".getcredits",
|
||||
"GetCreditsResponse": ".getcredits",
|
||||
"GetCreditsResponseTypedDict": ".getcredits",
|
||||
"GetCurrentKeyData": ".getcurrentkey",
|
||||
|
||||
@@ -15,8 +15,8 @@ from openrouter.types import (
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from openrouter.utils import get_discriminator, validate_open_enum
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Any, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
@@ -63,7 +63,13 @@ ContentTypedDict = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
Content = TypeAliasType("Content", Union[ContentText, ContentImageURL])
|
||||
Content = Annotated[
|
||||
Union[
|
||||
Annotated[ContentText, Tag("text")],
|
||||
Annotated[ContentImageURL, Tag("image_url")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
|
||||
class InputTypedDict(TypedDict):
|
||||
@@ -389,7 +395,7 @@ class Usage(BaseModel):
|
||||
cost: Optional[float] = None
|
||||
|
||||
|
||||
class CreateEmbeddingsResponseBodyTypedDict(TypedDict):
|
||||
class CreateEmbeddingsResponseTypedDict(TypedDict):
|
||||
r"""Embedding response"""
|
||||
|
||||
object: Object
|
||||
@@ -399,7 +405,7 @@ class CreateEmbeddingsResponseBodyTypedDict(TypedDict):
|
||||
usage: NotRequired[UsageTypedDict]
|
||||
|
||||
|
||||
class CreateEmbeddingsResponseBody(BaseModel):
|
||||
class CreateEmbeddingsResponse(BaseModel):
|
||||
r"""Embedding response"""
|
||||
|
||||
object: Object
|
||||
@@ -411,14 +417,3 @@ class CreateEmbeddingsResponseBody(BaseModel):
|
||||
id: Optional[str] = None
|
||||
|
||||
usage: Optional[Usage] = None
|
||||
|
||||
|
||||
CreateEmbeddingsResponseTypedDict = TypeAliasType(
|
||||
"CreateEmbeddingsResponseTypedDict",
|
||||
Union[CreateEmbeddingsResponseBodyTypedDict, str],
|
||||
)
|
||||
|
||||
|
||||
CreateEmbeddingsResponse = TypeAliasType(
|
||||
"CreateEmbeddingsResponse", Union[CreateEmbeddingsResponseBody, str]
|
||||
)
|
||||
|
||||
@@ -5,9 +5,28 @@ from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class GetCreditsDataTypedDict(TypedDict):
|
||||
total_credits: float
|
||||
r"""Total credits purchased"""
|
||||
total_usage: float
|
||||
r"""Total credits used"""
|
||||
|
||||
|
||||
class GetCreditsData(BaseModel):
|
||||
total_credits: float
|
||||
r"""Total credits purchased"""
|
||||
|
||||
total_usage: float
|
||||
r"""Total credits used"""
|
||||
|
||||
|
||||
class GetCreditsResponseTypedDict(TypedDict):
|
||||
r"""Total credits purchased and used"""
|
||||
|
||||
data: GetCreditsDataTypedDict
|
||||
|
||||
|
||||
class GetCreditsResponse(BaseModel):
|
||||
r"""Total credits purchased and used"""
|
||||
|
||||
data: GetCreditsData
|
||||
|
||||
@@ -38,12 +38,14 @@ GetParametersProvider = Union[
|
||||
"AionLabs",
|
||||
"Alibaba",
|
||||
"Amazon Bedrock",
|
||||
"Amazon Nova",
|
||||
"Anthropic",
|
||||
"Arcee",
|
||||
"Arcee AI",
|
||||
"AtlasCloud",
|
||||
"Avian",
|
||||
"Azure",
|
||||
"BaseTen",
|
||||
"BytePlus",
|
||||
"Black Forest Labs",
|
||||
"Cerebras",
|
||||
"Chutes",
|
||||
@@ -58,6 +60,7 @@ GetParametersProvider = Union[
|
||||
"Fireworks",
|
||||
"Friendli",
|
||||
"GMICloud",
|
||||
"GoPomelo",
|
||||
"Google",
|
||||
"Google AI Studio",
|
||||
"Groq",
|
||||
@@ -88,6 +91,7 @@ GetParametersProvider = Union[
|
||||
"SambaNova",
|
||||
"SiliconFlow",
|
||||
"Stealth",
|
||||
"StreamLake",
|
||||
"Switchpoint",
|
||||
"Targon",
|
||||
"Together",
|
||||
|
||||
Reference in New Issue
Block a user