Defines Pydantic models for various LLM, STT, TTS, and related metrics.
# Source: https://github.com/livekit/agents | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations
from typing import Literal
from pydantic import BaseModel, model_validator
from typing_extensions import Self
class Metadata(BaseModel):
model_name: str | None = None
model_provider: str | None = None
class _BaseMetrics(BaseModel):
def __repr__(self) -> str:
fields = self.model_dump(exclude_defaults=True)
fields_str = ", ".join(f"{k}={v!r}" for k, v in fields.items())
return f"{self.__class__.__name__}({fields_str})"
class LLMMetrics(_BaseMetrics):
type: Literal["llm_metrics"] = "llm_metrics"
label: str
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key