From c1382b06911d32982807059fbb9a3ecef25a376f Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Sat, 15 Mar 2025 20:30:35 -0400 Subject: [PATCH] Update the 34-audio-recording.py example to include an STT processor --- CHANGELOG.md | 2 ++ examples/foundational/34-audio-recording.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e47f1010a..d0e9f8713 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -116,6 +116,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Other +- Update the `34-audio-recording.py` example to include an STT processor. + - Added a Pipecat Cloud deployment example to the `examples` directory. ## [0.0.58] - 2025-02-26 diff --git a/examples/foundational/34-audio-recording.py b/examples/foundational/34-audio-recording.py index 94877c722..24f009570 100644 --- a/examples/foundational/34-audio-recording.py +++ b/examples/foundational/34-audio-recording.py @@ -32,6 +32,7 @@ Requirements: OPENAI_API_KEY=your_openai_key CARTESIA_API_KEY=your_cartesia_key DAILY_API_KEY=your_daily_key + DEEPGRAM_API_KEY=your_deepgram_key The recordings will be saved in a 'recordings' directory with timestamps: recordings/ @@ -65,6 +66,7 @@ from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.processors.audio.audio_buffer_processor import AudioBufferProcessor from pipecat.services.cartesia import CartesiaTTSService +from pipecat.services.deepgram import DeepgramSTTService from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport @@ -98,13 +100,14 @@ async def main(): DailyParams( # audio_in_enabled=True, audio_out_enabled=True, - transcription_enabled=True, vad_enabled=True, vad_analyzer=SileroVADAnalyzer(), - vad_audio_passthrough=True, # Enable audio passthrough for recording + vad_audio_passthrough=True, ), ) + stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"), audio_passthrough=True) + tts = CartesiaTTSService( api_key=os.getenv("CARTESIA_API_KEY"), voice_id="71a7ad14-091c-4e8e-a314-022ece01c121", @@ -128,6 +131,7 @@ async def main(): pipeline = Pipeline( [ transport.input(), + stt, context_aggregator.user(), llm, tts,