Module livekit.agents.metrics.base
Classes
class Error-
Expand source code
@dataclass class Error: passError()
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 | NoneLLMMetrics(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
Instance variables
var cancelled : boolvar completion_tokens : intvar duration : floatvar error : Error | Nonevar label : strvar prompt_tokens : intvar request_id : strvar timestamp : floatvar tokens_per_second : floatvar total_tokens : intvar 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 = NoneMultimodalLLMError(type: 'str | None', reason: 'str | None' = None, code: 'str | None' = None, message: 'str | None' = None)
Ancestors
Instance variables
var code : str | Nonevar message : str | Nonevar reason : str | Nonevar 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: OutputTokenDetailsMultimodalLLMMetrics(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 CachedTokenDetailsvar InputTokenDetailsvar OutputTokenDetails
Instance variables
var input_token_details : MultimodalLLMMetrics.InputTokenDetailsvar output_token_details : MultimodalLLMMetrics.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')
Instance 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
Instance 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): passPipelineSTTMetrics(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
Instance 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): passPipelineVADMetrics(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 | NoneSTTMetrics(request_id: 'str', timestamp: 'float', duration: 'float', label: 'str', audio_duration: 'float', streamed: 'bool', error: 'Error | None')
Subclasses
Instance variables
var audio_duration : floatvar duration : floatvar error : Error | Nonevar label : strvar request_id : strvar streamed : boolvar 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 | NoneTTSMetrics(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
Instance variables
var audio_duration : floatvar cancelled : boolvar characters_count : intvar duration : floatvar error : Error | Nonevar label : strvar request_id : strvar streamed : boolvar timestamp : floatvar 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: strVADMetrics(timestamp: 'float', idle_time: 'float', inference_duration_total: 'float', inference_count: 'int', label: 'str')
Subclasses
Instance variables
var idle_time : floatvar inference_count : intvar inference_duration_total : floatvar label : strvar timestamp : float