Documentation
¶
Index ¶
- Constants
- Variables
- func InitLoggerProvider(ctx context.Context, endpoint string, headers map[string]string) error
- func LogMetrics(metrics AgentMetrics)
- func NewLLMSpan(ctx context.Context, model, provider string) (context.Context, trace.Span)
- func NewSTTStreamSpan(ctx context.Context, model, provider string) (context.Context, trace.Span)
- func NewTTSStreamSpan(ctx context.Context, model, provider string) (context.Context, trace.Span)
- func RecordChatEvent(ctx context.Context, eventType string, body string, ...)
- func ShutdownLoggerProvider(ctx context.Context) error
- func StartSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- type AgentMetrics
- type CachedTokenDetails
- type EOUMetrics
- type HttpServer
- type InputTokenDetails
- type LLMMetrics
- type Metadata
- type MetricLabels
- type MetricRegistry
- type OutputTokenDetails
- type RealtimeModelMetrics
- type STTMetrics
- type SpanContext
- type TTSMetrics
- type UsageCollector
- type UsageSummary
- type VADMetrics
Constants ¶
View Source
const ( AttrSpeechID = "lk.speech_id" AttrAgentLabel = "lk.agent_label" AttrStartTime = "lk.start_time" AttrEndTime = "lk.end_time" AttrRetryCount = "lk.retry_count" AttrParticipantID = "lk.participant_id" AttrParticipantIdentity = "lk.participant_identity" AttrParticipantKind = "lk.participant_kind" AttrJobID = "lk.job_id" AttrAgentName = "lk.agent_name" AttrRoomName = "lk.room_name" AttrSessionOptions = "lk.session_options" AttrAgentTurnID = "lk.generation_id" AttrAgentParentTurnID = "lk.parent_generation_id" AttrUserInput = "lk.user_input" AttrInstructions = "lk.instructions" AttrSpeechInterrupted = "lk.interrupted" AttrChatCtx = "lk.chat_ctx" AttrFunctionTools = "lk.function_tools" AttrProviderTools = "lk.provider_tools" AttrToolSets = "lk.tool_sets" AttrResponseText = "lk.response.text" AttrResponseFunctionCalls = "lk.response.function_calls" AttrFunctionToolID = "lk.function_tool.id" AttrFunctionToolName = "lk.function_tool.name" AttrFunctionToolArgs = "lk.function_tool.arguments" AttrFunctionToolIsError = "lk.function_tool.is_error" AttrFunctionToolOutput = "lk.function_tool.output" AttrTTSInputText = "lk.input_text" AttrTTSStreaming = "lk.tts.streaming" AttrTTSLabel = "lk.tts.label" AttrEOUProbability = "lk.eou.probability" AttrEOUUnlikelyThreshold = "lk.eou.unlikely_threshold" AttrEOUDelay = "lk.eou.endpointing_delay" AttrEOULanguage = "lk.eou.language" AttrUserTranscript = "lk.user_transcript" AttrTranscriptConfidence = "lk.transcript_confidence" AttrTranscriptionDelay = "lk.transcription_delay" AttrEndOfTurnDelay = "lk.end_of_turn_delay" AttrGenAIOperationName = "gen_ai.operation.name" AttrGenAIProviderName = "gen_ai.provider.name" AttrGenAIRequestModel = "gen_ai.request.model" AttrGenAIUsageInputTokens = "gen_ai.usage.input_tokens" AttrGenAIUsageOutputTokens = "gen_ai.usage.output_tokens" )
Variables ¶
View Source
var ChatLogger log.Logger
View Source
var Tracer = otel.Tracer("livekit-agents")
Functions ¶
func InitLoggerProvider ¶
func LogMetrics ¶
func LogMetrics(metrics AgentMetrics)
func NewLLMSpan ¶
func NewSTTStreamSpan ¶
func NewTTSStreamSpan ¶
func RecordChatEvent ¶
func ShutdownLoggerProvider ¶
Types ¶
type AgentMetrics ¶
type AgentMetrics interface {
GetType() string
}
type CachedTokenDetails ¶
type EOUMetrics ¶
type EOUMetrics struct {
Timestamp time.Time
EndOfUtteranceDelay float64
TranscriptionDelay float64
OnUserTurnCompletedDelay float64
SpeechID string
Metadata *Metadata
}
func (*EOUMetrics) GetType ¶
func (m *EOUMetrics) GetType() string
type HttpServer ¶
func NewHttpServer ¶
func NewHttpServer(host string, port int) *HttpServer
func (*HttpServer) Start ¶
func (s *HttpServer) Start() error
type InputTokenDetails ¶
type InputTokenDetails struct {
AudioTokens int
TextTokens int
ImageTokens int
CachedTokens int
CachedTokensDetails *CachedTokenDetails
}
type LLMMetrics ¶
type LLMMetrics struct {
Label string
RequestID string
Timestamp time.Time
Duration float64
TTFT float64
Cancelled bool
CompletionTokens int
PromptTokens int
PromptCachedTokens int
TotalTokens int
TokensPerSecond float64
SpeechID string
Metadata *Metadata
}
func (*LLMMetrics) GetType ¶
func (m *LLMMetrics) GetType() string
type MetricLabels ¶
type MetricRegistry ¶
type MetricRegistry struct {
// contains filtered or unexported fields
}
func NewMetricRegistry ¶
func NewMetricRegistry() *MetricRegistry
func (*MetricRegistry) GetUsageCollector ¶
func (r *MetricRegistry) GetUsageCollector(labels MetricLabels) *UsageCollector
type OutputTokenDetails ¶
type RealtimeModelMetrics ¶
type RealtimeModelMetrics struct {
Label string
RequestID string
Timestamp time.Time
Duration float64
TTFT float64
Cancelled bool
InputTokens int
OutputTokens int
TotalTokens int
TokensPerSecond float64
InputTokenDetails InputTokenDetails
OutputTokenDetails OutputTokenDetails
Metadata *Metadata
}
func (*RealtimeModelMetrics) GetType ¶
func (m *RealtimeModelMetrics) GetType() string
type STTMetrics ¶
type STTMetrics struct {
Label string
RequestID string
Timestamp time.Time
Duration float64
AudioDuration float64
Streamed bool
Metadata *Metadata
}
func (*STTMetrics) GetType ¶
func (m *STTMetrics) GetType() string
type SpanContext ¶
type TTSMetrics ¶
type TTSMetrics struct {
Label string
RequestID string
Timestamp time.Time
TTFB float64
Duration float64
AudioDuration float64
Cancelled bool
CharactersCount int
Streamed bool
SegmentID string
SpeechID string
Metadata *Metadata
}
func (*TTSMetrics) GetType ¶
func (m *TTSMetrics) GetType() string
type UsageCollector ¶
type UsageCollector struct {
// contains filtered or unexported fields
}
func NewUsageCollector ¶
func NewUsageCollector() *UsageCollector
func (*UsageCollector) Collect ¶
func (c *UsageCollector) Collect(metrics AgentMetrics)
func (*UsageCollector) GetSummary ¶
func (c *UsageCollector) GetSummary() UsageSummary
type UsageSummary ¶
type UsageSummary struct {
LLMPromptTokens int
LLMPromptCachedTokens int
LLMInputAudioTokens int
LLMInputCachedAudioTokens int
LLMInputTextTokens int
LLMInputCachedTextTokens int
LLMInputImageTokens int
LLMInputCachedImageTokens int
LLMCompletionTokens int
LLMOutputAudioTokens int
LLMOutputImageTokens int
LLMOutputTextTokens int
TTSCharactersCount int
TTSAudioDuration float64
STTAudioDuration float64
}
Click to show internal directories.
Click to hide internal directories.