From 3a7ea25077acfafa7a7123a690d8ced71d2e242b Mon Sep 17 00:00:00 2001 From: Designedforusers Date: Sat, 2 Aug 2025 05:56:46 -0400 Subject: [PATCH 1/4] fix: Add missing transcription callbacks to TavusTransport for 0.0.77 compatibility TavusTransport was broken in Pipecat 0.0.77 due to PR #2292 adding required callbacks (on_transcription_stopped, on_transcription_error) to DailyCallbacks. This fix adds placeholder implementations of these callbacks to TavusTransportClient, allowing TavusTransport to initialize properly. These callbacks are not used by Tavus (which handles avatar video, not transcription) but are required by the DailyCallbacks validation. Fixes initialization error: - 2 validation errors for DailyCallbacks - on_transcription_stopped: Field required - on_transcription_error: Field required --- src/pipecat/transports/services/tavus.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/pipecat/transports/services/tavus.py b/src/pipecat/transports/services/tavus.py index 10ae001e0..4d4eec7f0 100644 --- a/src/pipecat/transports/services/tavus.py +++ b/src/pipecat/transports/services/tavus.py @@ -245,6 +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, ) self._client = DailyTransportClient( room_url, None, "Pipecat", self._params, daily_callbacks, self._bot_name @@ -274,6 +276,20 @@ 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. From 62319021f8f406da718b274ff4061c845b3d06eb Mon Sep 17 00:00:00 2001 From: Designedforusers Date: Sat, 2 Aug 2025 14:53:44 -0400 Subject: [PATCH 2/4] docs: Add changelog entry for TavusVideoService fix Added changelog entry as requested by maintainers for the fix addressing missing transcription callbacks in TavusVideoService. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d31a76c75..84f7c7047 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed an issue in `LiveKitTransport` where empty `AudioRawFrame`s were pushed down the pipeline. This resulted in warnings by the STT processor. +- Fixed an issue with the `TavusVideoService` where an error was thrown due to + missing transcription callbacks. + ## [0.0.77] - 2025-07-31 ### Added From 5e338ecaf1301a84d578e01bee05f03ad9248741 Mon Sep 17 00:00:00 2001 From: Designedforusers Date: Sat, 2 Aug 2025 15:02:54 -0400 Subject: [PATCH 3/4] 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. --- src/pipecat/transports/services/tavus.py | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/pipecat/transports/services/tavus.py b/src/pipecat/transports/services/tavus.py index 4d4eec7f0..119ce2b8c 100644 --- a/src/pipecat/transports/services/tavus.py +++ b/src/pipecat/transports/services/tavus.py @@ -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. From 9d6d53629e4b0fd9af69f877e1b65ce8c1390c37 Mon Sep 17 00:00:00 2001 From: Designedforusers Date: Sat, 2 Aug 2025 18:27:09 -0400 Subject: [PATCH 4/4] style: Apply ruff formatting to fix line length Fixed a line length issue in tavus.py where the on_transcription_stopped callback was exceeding the maximum line length. Split the partial() call across multiple lines for better readability and compliance with project style guidelines. --- src/pipecat/transports/services/tavus.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pipecat/transports/services/tavus.py b/src/pipecat/transports/services/tavus.py index 119ce2b8c..e4e57717a 100644 --- a/src/pipecat/transports/services/tavus.py +++ b/src/pipecat/transports/services/tavus.py @@ -245,7 +245,9 @@ 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=partial(self._on_handle_callback, "on_transcription_stopped"), + 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(