Module livekit.agents.metrics.base

Classes

class Error
Expand source code
@dataclass
class Error:
    pass

Error()

Subclasses

class LLMMetrics (request_id: str,
timestamp: float,
ttft: float,
duration: float,
label: str,
cancelled: bool,
completion_tokens: int,
prompt_tokens: int,
total_tokens: int,
tokens_per_second: float,
error: Error | None)
Expand source code
@dataclass
class LLMMetrics:
    request_id: str
    timestamp: float
    ttft: float
    duration: float
    label: str
    cancelled: bool
    completion_tokens: int
    prompt_tokens: int
    total_tokens: int
    tokens_per_second: float
    error: Error | None

LLMMetrics(request_id: 'str', timestamp: 'float', ttft: 'float', duration: 'float', label: 'str', cancelled: 'bool', completion_tokens: 'int', prompt_tokens: 'int', total_tokens: 'int', tokens_per_second: 'float', error: 'Error | None')

Subclasses

Class variables

var cancelled : bool
var completion_tokens : int
var duration : float
var errorError | None
var label : str
var prompt_tokens : int
var request_id : str
var timestamp : float
var tokens_per_second : float
var total_tokens : int
var ttft : float
class MultimodalLLMError (type: str | None,
reason: str | None = None,
code: str | None = None,
message: str | None = None)
Expand source code
@dataclass
class MultimodalLLMError(Error):
    type: str | None
    reason: str | None = None
    code: str | None = None
    message: str | None = None

MultimodalLLMError(type: 'str | None', reason: 'str | None' = None, code: 'str | None' = None, message: 'str | None' = None)

Ancestors

Class variables

var code : str | None
var message : str | None
var reason : str | None
var type : str | None
class MultimodalLLMMetrics (request_id: str,
timestamp: float,
ttft: float,
duration: float,
label: str,
cancelled: bool,
completion_tokens: int,
prompt_tokens: int,
total_tokens: int,
tokens_per_second: float,
error: Error | None,
input_token_details: InputTokenDetails,
output_token_details: OutputTokenDetails)
Expand source code
@dataclass
class MultimodalLLMMetrics(LLMMetrics):
    @dataclass
    class CachedTokenDetails:
        text_tokens: int
        audio_tokens: int

    @dataclass
    class InputTokenDetails:
        cached_tokens: int
        text_tokens: int
        audio_tokens: int
        cached_tokens_details: MultimodalLLMMetrics.CachedTokenDetails

    @dataclass
    class OutputTokenDetails:
        text_tokens: int
        audio_tokens: int

    input_token_details: InputTokenDetails
    output_token_details: OutputTokenDetails

MultimodalLLMMetrics(request_id: 'str', timestamp: 'float', ttft: 'float', duration: 'float', label: 'str', cancelled: 'bool', completion_tokens: 'int', prompt_tokens: 'int', total_tokens: 'int', tokens_per_second: 'float', error: 'Error | None', input_token_details: 'InputTokenDetails', output_token_details: 'OutputTokenDetails')

Ancestors

Class variables

var CachedTokenDetails
var InputTokenDetails
var OutputTokenDetails
var input_token_detailsMultimodalLLMMetrics.InputTokenDetails
var output_token_detailsMultimodalLLMMetrics.OutputTokenDetails
class PipelineEOUMetrics (sequence_id: str,
timestamp: float,
end_of_utterance_delay: float,
transcription_delay: float)
Expand source code
@dataclass
class PipelineEOUMetrics:
    sequence_id: str
    """Unique identifier shared across different metrics to combine related STT, LLM, and TTS metrics."""

    timestamp: float
    """Timestamp of when the event was recorded."""

    end_of_utterance_delay: float
    """Amount of time between the end of speech from VAD and the decision to end the user's turn."""

    transcription_delay: float
    """Time taken to obtain the transcript after the end of the user's speech.

    May be 0 if the transcript was already available.
    """

PipelineEOUMetrics(sequence_id: 'str', timestamp: 'float', end_of_utterance_delay: 'float', transcription_delay: 'float')

Class variables

var end_of_utterance_delay : float

Amount of time between the end of speech from VAD and the decision to end the user's turn.

var sequence_id : str

Unique identifier shared across different metrics to combine related STT, LLM, and TTS metrics.

var timestamp : float

Timestamp of when the event was recorded.

var transcription_delay : float

Time taken to obtain the transcript after the end of the user's speech.

May be 0 if the transcript was already available.

class PipelineLLMMetrics (request_id: str,
timestamp: float,
ttft: float,
duration: float,
label: str,
cancelled: bool,
completion_tokens: int,
prompt_tokens: int,
total_tokens: int,
tokens_per_second: float,
error: Error | None,
sequence_id: str)
Expand source code
@dataclass
class PipelineLLMMetrics(LLMMetrics):
    sequence_id: str
    """Unique identifier shared across different metrics to combine related STT, LLM, and TTS metrics."""

PipelineLLMMetrics(request_id: 'str', timestamp: 'float', ttft: 'float', duration: 'float', label: 'str', cancelled: 'bool', completion_tokens: 'int', prompt_tokens: 'int', total_tokens: 'int', tokens_per_second: 'float', error: 'Error | None', sequence_id: 'str')

Ancestors

Class variables

var sequence_id : str

Unique identifier shared across different metrics to combine related STT, LLM, and TTS metrics.

class PipelineSTTMetrics (request_id: str,
timestamp: float,
duration: float,
label: str,
audio_duration: float,
streamed: bool,
error: Error | None)
Expand source code
@dataclass
class PipelineSTTMetrics(STTMetrics):
    pass

PipelineSTTMetrics(request_id: 'str', timestamp: 'float', duration: 'float', label: 'str', audio_duration: 'float', streamed: 'bool', error: 'Error | None')

Ancestors

class PipelineTTSMetrics (request_id: str,
timestamp: float,
ttfb: float,
duration: float,
audio_duration: float,
cancelled: bool,
characters_count: int,
label: str,
streamed: bool,
error: Error | None,
sequence_id: str)
Expand source code
@dataclass
class PipelineTTSMetrics(TTSMetrics):
    sequence_id: str
    """Unique identifier shared across different metrics to combine related STT, LLM, and TTS metrics."""

PipelineTTSMetrics(request_id: 'str', timestamp: 'float', ttfb: 'float', duration: 'float', audio_duration: 'float', cancelled: 'bool', characters_count: 'int', label: 'str', streamed: 'bool', error: 'Error | None', sequence_id: 'str')

Ancestors

Class variables

var sequence_id : str

Unique identifier shared across different metrics to combine related STT, LLM, and TTS metrics.

class PipelineVADMetrics (timestamp: float,
idle_time: float,
inference_duration_total: float,
inference_count: int,
label: str)
Expand source code
@dataclass
class PipelineVADMetrics(VADMetrics):
    pass

PipelineVADMetrics(timestamp: 'float', idle_time: 'float', inference_duration_total: 'float', inference_count: 'int', label: 'str')

Ancestors

class STTMetrics (request_id: str,
timestamp: float,
duration: float,
label: str,
audio_duration: float,
streamed: bool,
error: Error | None)
Expand source code
@dataclass
class STTMetrics:
    request_id: str
    timestamp: float
    duration: float
    label: str
    audio_duration: float
    streamed: bool
    error: Error | None

STTMetrics(request_id: 'str', timestamp: 'float', duration: 'float', label: 'str', audio_duration: 'float', streamed: 'bool', error: 'Error | None')

Subclasses

Class variables

var audio_duration : float
var duration : float
var errorError | None
var label : str
var request_id : str
var streamed : bool
var timestamp : float
class TTSMetrics (request_id: str,
timestamp: float,
ttfb: float,
duration: float,
audio_duration: float,
cancelled: bool,
characters_count: int,
label: str,
streamed: bool,
error: Error | None)
Expand source code
@dataclass
class TTSMetrics:
    request_id: str
    timestamp: float
    ttfb: float
    duration: float
    audio_duration: float
    cancelled: bool
    characters_count: int
    label: str
    streamed: bool
    error: Error | None

TTSMetrics(request_id: 'str', timestamp: 'float', ttfb: 'float', duration: 'float', audio_duration: 'float', cancelled: 'bool', characters_count: 'int', label: 'str', streamed: 'bool', error: 'Error | None')

Subclasses

Class variables

var audio_duration : float
var cancelled : bool
var characters_count : int
var duration : float
var errorError | None
var label : str
var request_id : str
var streamed : bool
var timestamp : float
var ttfb : float
class VADMetrics (timestamp: float,
idle_time: float,
inference_duration_total: float,
inference_count: int,
label: str)
Expand source code
@dataclass
class VADMetrics:
    timestamp: float
    idle_time: float
    inference_duration_total: float
    inference_count: int
    label: str

VADMetrics(timestamp: 'float', idle_time: 'float', inference_duration_total: 'float', inference_count: 'int', label: 'str')

Subclasses

Class variables

var idle_time : float
var inference_count : int
var inference_duration_total : float
var label : str
var timestamp : float