add tracing

This commit is contained in:
Martin Schweiger
2025-05-30 10:55:19 +08:00
parent 8400539acf
commit e5da3f6e68

View File

@@ -26,6 +26,7 @@ from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.stt_service import STTService
from pipecat.transcriptions.language import Language
from pipecat.utils.time import time_now_iso8601
from pipecat.utils.tracing.service_decorators import traced_stt
from .models import (
AssemblyAIConnectionParams,
@@ -108,6 +109,11 @@ class AssemblyAISTTService(STTService):
await self._websocket.send(json.dumps({"type": "ForceEndpoint"}))
await self.start_processing_metrics()
@traced_stt
async def _trace_transcription(self, transcript: str, is_final: bool, language: Language):
"""Record transcription event for tracing."""
pass
def _build_ws_url(self) -> str:
"""Build WebSocket URL with query parameters using urllib.parse.urlencode."""
params = {
@@ -252,6 +258,7 @@ class AssemblyAISTTService(STTService):
message,
)
)
await self._trace_transcription(message.transcript, True, self._language)
await self.stop_processing_metrics()
else:
await self.push_frame(