refactor: Remove redundant transcription callback methods

As suggested in PR review, removed the _on_transcription_stopped and
_on_transcription_error method definitions. Now using the consistent
partial(self._on_handle_callback, ...) pattern for these callbacks,
matching how all other callbacks are handled.

This simplifies the code while maintaining the same functionality.
This commit is contained in:
Designedforusers
2025-08-02 15:02:54 -04:00
parent 62319021f8
commit 5e338ecaf1

View File

@@ -245,8 +245,8 @@ class TavusTransportClient:
on_recording_started=partial(self._on_handle_callback, "on_recording_started"),
on_recording_stopped=partial(self._on_handle_callback, "on_recording_stopped"),
on_recording_error=partial(self._on_handle_callback, "on_recording_error"),
on_transcription_stopped=self._on_transcription_stopped,
on_transcription_error=self._on_transcription_error,
on_transcription_stopped=partial(self._on_handle_callback, "on_transcription_stopped"),
on_transcription_error=partial(self._on_handle_callback, "on_transcription_error"),
)
self._client = DailyTransportClient(
room_url, None, "Pipecat", self._params, daily_callbacks, self._bot_name
@@ -276,20 +276,6 @@ class TavusTransportClient:
"""Handle generic callback events."""
logger.trace(f"[Callback] {event_name} called with args={args}, kwargs={kwargs}")
async def _on_transcription_stopped(self, stopped_by: str, stopped_by_error: bool):
"""
Placeholder for transcription stopped callback.
Required by DailyCallbacks in Pipecat 0.0.77+ but not used by Tavus.
"""
pass
async def _on_transcription_error(self, message: str):
"""
Placeholder for transcription error callback.
Required by DailyCallbacks in Pipecat 0.0.77+ but not used by Tavus.
"""
pass
async def get_persona_name(self) -> str:
"""Get the persona name from the API.