openinference-instrumentation-pipecat 2.0.2
“OpenInference Pipecat Instrumentation”
Accesses Python class base or MROTar extraction guards member paths
SHA-256a1c36d7be057e20ef88f4a610ba71579bd59f161dfa01bb7bdadfb431ecf69b6
MaleculeH₂(Db₂F)
Evidence
1"""OpenInference observer for Pipecat pipelines."""
2
3import logging
4import time
5from contextvars import Token
6from datetime import datetime
7from typing import Any, Dict, List, Optional, Set, TextIO
8
9from opentelemetry import trace as trace_api
10from opentelemetry.context import Context
11from opentelemetry.trace import Span
12
13from openinference.instrumentation import OITracer, TraceConfig
14from openinference.instrumentation.helpers import safe_json_dumps
15from openinference.semconv.trace import (
16 OpenInferenceSpanKindValues,
17 SpanAttributes,
18)
19from pipecat.frames.frames import (
20 Frame,
21 FunctionCallResultFrame,
22 LLMContextFrame,
23 LLMFullResponseEndFrame,
24 LLMFullResponseStartFrame,
25 LLMTextFrame,
26 MetricsFrame,
27 StartFrame,
28 STTMuteFrame,
29 TranscriptionFrame,
30 TTSStartedFrame,
31 TTSTextFrame,
32 VADUserStartedSpeakingFrame,
33 VADUserStoppedSpeakingFrame,
34)
35from pipecat.observers.base_observer import FramePushed
36from pipecat.observers.turn_tracking_observer import TurnTrackingObserver
37from pipecat.observers.user_bot_latency_observer import UserBotLatencyObserver
38from pipecat.processors.frame_processor import FrameProcessor
39from pipecat.services.ai_service import AIService
40from pipecat.services.llm_service import LLMService
41from pipecat.services.stt_service import STTService
42from pipecat.services.tts_service import TTSService
43from pipecat.transports.base_output import BaseOutputTransport
44
45from ._attributes import ( # noqa: F401
46 detect_service_type,
47 detect_service_type_from_class_string,
48 extract_attributes_from_frame,
118:14… bug_log_filename:
119 # Write log to current working directory (where the script is running)
120 try:
121 self._debug_log_file = open(debug_log_filename, "w")
122 self._log_debug(f"=== Observer initialized for conversation {conversation_id} ===")
123 self._log_debug(f"=== Log file: {debug_log_filename} ===")
124 except Exception as e:
125 logger.error(f"Could not open debug log file: {e}")
126
127 self._active_spans: Dict[int | str, Dict[str, Any] …
282:40… }, service_type: {service_type}")
283
284 if service_type in ("llm", "stt", "tts"):
285 # only these frame types will start a span:
286 ## LLMContextFrame (LLM)
287 ## ST …
403:36… ted_output:
404 # No text output means this LLM call likely triggered tool calls
405 # Store a reference to this span so tool calls can be parented under it
406 …
406:10… self._log_debug(
407 f" LLM response ended with no text output - "
408 f"storing span {service_id} as potential tool call parent"
409 …
No evidence locations were recorded for this file. Raw result