Files
openrouter-python-sdk-retry…/src/openrouter/components/observabilitylangsmithdestination.py
T

139 lines
4.9 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 ObservabilityLangsmithDestinationConfigTypedDict(TypedDict):
api_key: str
endpoint: NotRequired[str]
headers: NotRequired[Dict[str, str]]
r"""Custom HTTP headers to include in requests to this destination."""
project: NotRequired[str]
r"""The name for this project, such as pr-openrouter-demo. Defaults to \"main\" if not set."""
workspace_id: NotRequired[str]
r"""Required for org-scoped API keys. Find this in your LangSmith workspace settings."""
class ObservabilityLangsmithDestinationConfig(BaseModel):
api_key: Annotated[str, pydantic.Field(alias="apiKey")]
endpoint: Optional[str] = "https://api.smith.langchain.com"
headers: Optional[Dict[str, str]] = None
r"""Custom HTTP headers to include in requests to this destination."""
project: Optional[str] = "main"
r"""The name for this project, such as pr-openrouter-demo. Defaults to \"main\" if not set."""
workspace_id: Annotated[Optional[str], pydantic.Field(alias="workspaceId")] = None
r"""Required for org-scoped API keys. Find this in your LangSmith workspace settings."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["endpoint", "headers", "project", "workspaceId"])
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
ObservabilityLangsmithDestinationType = Literal["langsmith",]
class ObservabilityLangsmithDestinationTypedDict(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: ObservabilityLangsmithDestinationConfigTypedDict
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: ObservabilityLangsmithDestinationType
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 ObservabilityLangsmithDestination(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: ObservabilityLangsmithDestinationConfig
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: ObservabilityLangsmithDestinationType
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:
ObservabilityLangsmithDestinationConfig.model_rebuild()
except NameError:
pass