finalize on DeepgramSTTService

This commit is contained in:
Vaibhav159
2025-01-15 20:43:23 +05:30
parent 5f402ad741
commit d1ac7751da
2 changed files with 14 additions and 0 deletions

View File

@@ -65,6 +65,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`src/pipecat/services/gemini_multimodal_live/gemini.py` to support different `src/pipecat/services/gemini_multimodal_live/gemini.py` to support different
modalities. modalities.
- Changed `DeepgramSTTService` to send `finalize` event whenever VAD detects
`UserStoppedSpeakingFrame`. This helps in faster transcriptions and clearing
the `Deepgram` audio buffer.
### Fixed ### Fixed
- Fixed an issue where websocket based TTS services could incorrectly terminate - Fixed an issue where websocket based TTS services could incorrectly terminate

View File

@@ -20,7 +20,9 @@ from pipecat.frames.frames import (
TTSAudioRawFrame, TTSAudioRawFrame,
TTSStartedFrame, TTSStartedFrame,
TTSStoppedFrame, TTSStoppedFrame,
UserStoppedSpeakingFrame,
) )
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.ai_services import STTService, TTSService from pipecat.services.ai_services import STTService, TTSService
from pipecat.transcriptions.language import Language from pipecat.transcriptions.language import Language
from pipecat.utils.time import time_now_iso8601 from pipecat.utils.time import time_now_iso8601
@@ -237,3 +239,11 @@ class DeepgramSTTService(STTService):
await self.push_frame( await self.push_frame(
InterimTranscriptionFrame(transcript, "", time_now_iso8601(), language) InterimTranscriptionFrame(transcript, "", time_now_iso8601(), language)
) )
async def process_frame(self, frame: Frame, direction: FrameDirection):
await super().process_frame(frame, direction)
if isinstance(frame, UserStoppedSpeakingFrame):
# https://developers.deepgram.com/docs/finalize
await self._connection.finalize()
logger.debug(f"Triggering finalize event on: {frame.name=}, {direction=}")