mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
155 lines
5.6 KiB
Python
155 lines
5.6 KiB
Python
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
from __future__ import annotations
|
|
from .observabilityfilterrulesconfig import (
|
|
ObservabilityFilterRulesConfig,
|
|
ObservabilityFilterRulesConfigTypedDict,
|
|
)
|
|
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
|
import pydantic
|
|
from pydantic import model_serializer
|
|
from typing import Dict, List, Literal, Optional
|
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
|
|
|
|
class ObservabilityS3DestinationConfigTypedDict(TypedDict):
|
|
access_key_id: str
|
|
bucket_name: str
|
|
secret_access_key: str
|
|
endpoint: NotRequired[str]
|
|
r"""Only for S3-compatible services like Cloudflare R2 (https://account-id.r2.cloudflarestorage.com) or MinIO. Leave blank for standard AWS S3."""
|
|
headers: NotRequired[Dict[str, str]]
|
|
r"""Custom HTTP headers to include in requests to this destination."""
|
|
path_template: NotRequired[str]
|
|
r"""Template for S3 object path. The filename ({traceId}-{timestamp}.json) is automatically appended. Available variables: {prefix}, {date}, {year}, {month}, {day}, {apiKeyName}"""
|
|
prefix: NotRequired[str]
|
|
region: NotRequired[str]
|
|
session_token: NotRequired[str]
|
|
|
|
|
|
class ObservabilityS3DestinationConfig(BaseModel):
|
|
access_key_id: Annotated[str, pydantic.Field(alias="accessKeyId")]
|
|
|
|
bucket_name: Annotated[str, pydantic.Field(alias="bucketName")]
|
|
|
|
secret_access_key: Annotated[str, pydantic.Field(alias="secretAccessKey")]
|
|
|
|
endpoint: Optional[str] = None
|
|
r"""Only for S3-compatible services like Cloudflare R2 (https://account-id.r2.cloudflarestorage.com) or MinIO. Leave blank for standard AWS S3."""
|
|
|
|
headers: Optional[Dict[str, str]] = None
|
|
r"""Custom HTTP headers to include in requests to this destination."""
|
|
|
|
path_template: Annotated[Optional[str], pydantic.Field(alias="pathTemplate")] = (
|
|
"{prefix}/{date}"
|
|
)
|
|
r"""Template for S3 object path. The filename ({traceId}-{timestamp}.json) is automatically appended. Available variables: {prefix}, {date}, {year}, {month}, {day}, {apiKeyName}"""
|
|
|
|
prefix: Optional[str] = "openrouter-traces"
|
|
|
|
region: Optional[str] = None
|
|
|
|
session_token: Annotated[Optional[str], pydantic.Field(alias="sessionToken")] = None
|
|
|
|
@model_serializer(mode="wrap")
|
|
def serialize_model(self, handler):
|
|
optional_fields = set(
|
|
["endpoint", "headers", "pathTemplate", "prefix", "region", "sessionToken"]
|
|
)
|
|
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))
|
|
|
|
if val != UNSET_SENTINEL:
|
|
if val is not None or k not in optional_fields:
|
|
m[k] = val
|
|
|
|
return m
|
|
|
|
|
|
ObservabilityS3DestinationType = Literal["s3",]
|
|
|
|
|
|
class ObservabilityS3DestinationTypedDict(TypedDict):
|
|
api_key_hashes: Nullable[List[str]]
|
|
r"""Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys."""
|
|
config: ObservabilityS3DestinationConfigTypedDict
|
|
created_at: str
|
|
r"""ISO timestamp of when the destination was created."""
|
|
enabled: bool
|
|
r"""Whether this destination is currently enabled."""
|
|
filter_rules: Nullable[ObservabilityFilterRulesConfigTypedDict]
|
|
r"""Optional structured filter rules controlling which events are forwarded."""
|
|
id: str
|
|
r"""Stable public identifier for this destination."""
|
|
name: Nullable[str]
|
|
r"""Human-readable name for the destination."""
|
|
privacy_mode: bool
|
|
r"""When true, request/response bodies are not forwarded to this destination — only metadata."""
|
|
sampling_rate: float
|
|
r"""Sampling rate for events sent to this destination, between 0.0001 and 1 (1 = 100%)."""
|
|
type: ObservabilityS3DestinationType
|
|
updated_at: str
|
|
r"""ISO timestamp of when the destination was last updated."""
|
|
workspace_id: str
|
|
r"""ID of the workspace this destination belongs to."""
|
|
|
|
|
|
class ObservabilityS3Destination(BaseModel):
|
|
api_key_hashes: Nullable[List[str]]
|
|
r"""Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys."""
|
|
|
|
config: ObservabilityS3DestinationConfig
|
|
|
|
created_at: str
|
|
r"""ISO timestamp of when the destination was created."""
|
|
|
|
enabled: bool
|
|
r"""Whether this destination is currently enabled."""
|
|
|
|
filter_rules: Nullable[ObservabilityFilterRulesConfig]
|
|
r"""Optional structured filter rules controlling which events are forwarded."""
|
|
|
|
id: str
|
|
r"""Stable public identifier for this destination."""
|
|
|
|
name: Nullable[str]
|
|
r"""Human-readable name for the destination."""
|
|
|
|
privacy_mode: bool
|
|
r"""When true, request/response bodies are not forwarded to this destination — only metadata."""
|
|
|
|
sampling_rate: float
|
|
r"""Sampling rate for events sent to this destination, between 0.0001 and 1 (1 = 100%)."""
|
|
|
|
type: ObservabilityS3DestinationType
|
|
|
|
updated_at: str
|
|
r"""ISO timestamp of when the destination was last updated."""
|
|
|
|
workspace_id: str
|
|
r"""ID of the workspace this destination belongs to."""
|
|
|
|
@model_serializer(mode="wrap")
|
|
def serialize_model(self, handler):
|
|
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))
|
|
|
|
if val != UNSET_SENTINEL:
|
|
m[k] = val
|
|
|
|
return m
|
|
|
|
|
|
try:
|
|
ObservabilityS3DestinationConfig.model_rebuild()
|
|
except NameError:
|
|
pass
|