diff --git a/examples/foundational/15a-switch-languages.py b/examples/foundational/15a-switch-languages.py index a6a7edfdf..4b8794ab8 100644 --- a/examples/foundational/15a-switch-languages.py +++ b/examples/foundational/15a-switch-languages.py @@ -9,8 +9,10 @@ import os import sys +from deepgram import LiveOptions + from pipecat.audio.vad.silero import SileroVADAnalyzer -from pipecat.frames.frames import LLMMessagesFrame, TTSUpdateSettingsFrame +from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.parallel_pipeline import ParallelPipeline from pipecat.pipeline.runner import PipelineRunner @@ -18,6 +20,7 @@ from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.processors.filters.function_filter import FunctionFilter 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 @@ -61,13 +64,16 @@ async def main(): "Pipecat", DailyParams( audio_out_enabled=True, - transcription_enabled=True, vad_enabled=True, vad_analyzer=SileroVADAnalyzer(), vad_audio_passthrough=True, ), ) + stt = DeepgramSTTService( + api_key=os.getenv("DEEPGRAM_API_KEY"), live_options=LiveOptions(language="multi") + ) + english_tts = CartesiaTTSService( api_key=os.getenv("CARTESIA_API_KEY"), voice_id="79a125e8-cd45-4c13-8a67-188112f4dd22", # British Lady @@ -113,6 +119,7 @@ async def main(): pipeline = Pipeline( [ transport.input(), # Transport user input + stt, # STT context_aggregator.user(), # User responses llm, # LLM ParallelPipeline( # TTS (bot will speak the chosen language)