mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
119 lines
4.1 KiB
Python
119 lines
4.1 KiB
Python
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
from __future__ import annotations
|
|
from openrouter.types import (
|
|
BaseModel,
|
|
Nullable,
|
|
OptionalNullable,
|
|
UNSET,
|
|
UNSET_SENTINEL,
|
|
)
|
|
from pydantic import model_serializer
|
|
from typing import List, Optional
|
|
from typing_extensions import NotRequired, TypedDict
|
|
|
|
|
|
class CreateWorkspaceRequestTypedDict(TypedDict):
|
|
name: str
|
|
r"""Name for the new workspace"""
|
|
slug: str
|
|
r"""URL-friendly slug (lowercase alphanumeric segments separated by single hyphens, no leading/trailing hyphens)"""
|
|
default_image_model: NotRequired[Nullable[str]]
|
|
r"""Default image model for this workspace"""
|
|
default_provider_sort: NotRequired[Nullable[str]]
|
|
r"""Default provider sort preference (price, throughput, latency, exacto)"""
|
|
default_text_model: NotRequired[Nullable[str]]
|
|
r"""Default text model for this workspace"""
|
|
description: NotRequired[Nullable[str]]
|
|
r"""Description of the workspace"""
|
|
io_logging_api_key_ids: NotRequired[Nullable[List[int]]]
|
|
r"""Optional array of API key IDs to filter I/O logging"""
|
|
io_logging_sampling_rate: NotRequired[float]
|
|
r"""Sampling rate for I/O logging (0.0001-1)"""
|
|
is_data_discount_logging_enabled: NotRequired[bool]
|
|
r"""Whether data discount logging is enabled"""
|
|
is_observability_broadcast_enabled: NotRequired[bool]
|
|
r"""Whether broadcast is enabled"""
|
|
is_observability_io_logging_enabled: NotRequired[bool]
|
|
r"""Whether private logging is enabled"""
|
|
|
|
|
|
class CreateWorkspaceRequest(BaseModel):
|
|
name: str
|
|
r"""Name for the new workspace"""
|
|
|
|
slug: str
|
|
r"""URL-friendly slug (lowercase alphanumeric segments separated by single hyphens, no leading/trailing hyphens)"""
|
|
|
|
default_image_model: OptionalNullable[str] = UNSET
|
|
r"""Default image model for this workspace"""
|
|
|
|
default_provider_sort: OptionalNullable[str] = UNSET
|
|
r"""Default provider sort preference (price, throughput, latency, exacto)"""
|
|
|
|
default_text_model: OptionalNullable[str] = UNSET
|
|
r"""Default text model for this workspace"""
|
|
|
|
description: OptionalNullable[str] = UNSET
|
|
r"""Description of the workspace"""
|
|
|
|
io_logging_api_key_ids: OptionalNullable[List[int]] = UNSET
|
|
r"""Optional array of API key IDs to filter I/O logging"""
|
|
|
|
io_logging_sampling_rate: Optional[float] = None
|
|
r"""Sampling rate for I/O logging (0.0001-1)"""
|
|
|
|
is_data_discount_logging_enabled: Optional[bool] = None
|
|
r"""Whether data discount logging is enabled"""
|
|
|
|
is_observability_broadcast_enabled: Optional[bool] = None
|
|
r"""Whether broadcast is enabled"""
|
|
|
|
is_observability_io_logging_enabled: Optional[bool] = None
|
|
r"""Whether private logging is enabled"""
|
|
|
|
@model_serializer(mode="wrap")
|
|
def serialize_model(self, handler):
|
|
optional_fields = set(
|
|
[
|
|
"default_image_model",
|
|
"default_provider_sort",
|
|
"default_text_model",
|
|
"description",
|
|
"io_logging_api_key_ids",
|
|
"io_logging_sampling_rate",
|
|
"is_data_discount_logging_enabled",
|
|
"is_observability_broadcast_enabled",
|
|
"is_observability_io_logging_enabled",
|
|
]
|
|
)
|
|
nullable_fields = set(
|
|
[
|
|
"default_image_model",
|
|
"default_provider_sort",
|
|
"default_text_model",
|
|
"description",
|
|
"io_logging_api_key_ids",
|
|
]
|
|
)
|
|
serialized = handler(self)
|
|
m = {}
|
|
|
|
for n, f in type(self).model_fields.items():
|
|
k = f.alias or n
|
|
val = serialized.get(k, serialized.get(n))
|
|
is_nullable_and_explicitly_set = (
|
|
k in nullable_fields
|
|
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
)
|
|
|
|
if val != UNSET_SENTINEL:
|
|
if (
|
|
val is not None
|
|
or k not in optional_fields
|
|
or is_nullable_and_explicitly_set
|
|
):
|
|
m[k] = val
|
|
|
|
return m
|