ServiceAttributes
Functions for adding attributes to OpenTelemetry spans.
- pipecat.utils.tracing.service_attributes.add_tts_span_attributes(span, service_name, model, voice_id, text=None, settings=None, character_count=None, operation_name='tts', ttfb=None, **kwargs)[source]
Add TTS-specific attributes to a span.
- Parameters:
span (Span) – The span to add attributes to
service_name (str) – Name of the TTS service (e.g., “cartesia”)
model (str) – Model name/identifier
voice_id (str) – Voice identifier
text (str | None) – The text being synthesized
settings (Dict[str, Any] | None) – Service configuration settings
character_count (int | None) – Number of characters in the text
operation_name (str) – Name of the operation (default: “tts”)
ttfb (float | None) – Time to first byte in seconds
**kwargs – Additional attributes to add
- Return type:
None
- pipecat.utils.tracing.service_attributes.add_stt_span_attributes(span, service_name, model, operation_name='stt', transcript=None, is_final=None, language=None, settings=None, vad_enabled=False, ttfb=None, **kwargs)[source]
Add STT-specific attributes to a span.
- Parameters:
span (Span) – The span to add attributes to
service_name (str) – Name of the STT service (e.g., “deepgram”)
model (str) – Model name/identifier
operation_name (str) – Name of the operation (default: “stt”)
transcript (str | None) – The transcribed text
is_final (bool | None) – Whether this is a final transcript
language (str | None) – Detected or configured language
settings (Dict[str, Any] | None) – Service configuration settings
vad_enabled (bool) – Whether voice activity detection is enabled
ttfb (float | None) – Time to first byte in seconds
**kwargs – Additional attributes to add
- Return type:
None
- pipecat.utils.tracing.service_attributes.add_llm_span_attributes(span, service_name, model, stream=True, messages=None, output=None, tools=None, tool_count=None, tool_choice=None, system=None, parameters=None, extra_parameters=None, ttfb=None, **kwargs)[source]
Add LLM-specific attributes to a span.
- Parameters:
span (Span) – The span to add attributes to
service_name (str) – Name of the LLM service (e.g., “openai”)
model (str) – Model name/identifier
stream (bool) – Whether streaming is enabled
messages (str | None) – JSON-serialized messages
output (str | None) – Aggregated output text from the LLM
tools (str | None) – JSON-serialized tools configuration
tool_count (int | None) – Number of tools available
tool_choice (str | None) – Tool selection configuration
system (str | None) – System message
parameters (Dict[str, Any] | None) – Service parameters
extra_parameters (Dict[str, Any] | None) – Additional parameters
ttfb (float | None) – Time to first byte in seconds
**kwargs – Additional attributes to add
- Return type:
None
- pipecat.utils.tracing.service_attributes.add_gemini_live_span_attributes(span, service_name, model, operation_name, voice_id=None, language=None, modalities=None, settings=None, tools=None, tools_serialized=None, transcript=None, is_input=None, text_output=None, audio_data_size=None, **kwargs)[source]
Add Gemini Live specific attributes to a span.
- Parameters:
span (Span) – The span to add attributes to
service_name (str) – Name of the service
model (str) – Model name/identifier
operation_name (str) – Name of the operation (setup, model_turn, tool_call, etc.)
voice_id (str | None) – Voice identifier used for output
language (str | None) – Language code for the session
modalities (str | None) – Supported modalities (e.g., “AUDIO”, “TEXT”)
settings (Dict[str, Any] | None) – Service configuration settings
tools (List[Dict] | None) – Available tools/functions list
tools_serialized (str | None) – JSON-serialized tools for detailed inspection
transcript (str | None) – Transcription text
is_input (bool | None) – Whether transcript is input (True) or output (False)
text_output (str | None) – Text output from model
audio_data_size (int | None) – Size of audio data in bytes
**kwargs – Additional attributes to add
- Return type:
None
- pipecat.utils.tracing.service_attributes.add_openai_realtime_span_attributes(span, service_name, model, operation_name, session_properties=None, transcript=None, is_input=None, context_messages=None, function_calls=None, tools=None, tools_serialized=None, audio_data_size=None, **kwargs)[source]
Add OpenAI Realtime specific attributes to a span.
- Parameters:
span (Span) – The span to add attributes to
service_name (str) – Name of the service
model (str) – Model name/identifier
operation_name (str) – Name of the operation (setup, transcription, response, etc.)
session_properties (Dict[str, Any] | None) – Session configuration properties
transcript (str | None) – Transcription text
is_input (bool | None) – Whether transcript is input (True) or output (False)
context_messages (str | None) – JSON-serialized context messages
function_calls (List[Dict] | None) – Function calls being made
tools (List[Dict] | None) – Available tools/functions list
tools_serialized (str | None) – JSON-serialized tools for detailed inspection
audio_data_size (int | None) – Size of audio data in bytes
**kwargs – Additional attributes to add
- Return type:
None