diff --git a/examples/foundational/45-llm-hedge.py b/examples/foundational/45-llm-hedge.py index e5d1715df..b292e64e7 100644 --- a/examples/foundational/45-llm-hedge.py +++ b/examples/foundational/45-llm-hedge.py @@ -9,6 +9,7 @@ import os from dotenv import load_dotenv from loguru import logger +from openai.types.chat import ChatCompletionMessageParam from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import Frame, LLMMessagesFrame @@ -132,18 +133,17 @@ class LLMRaceProcessor(FrameProcessor): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): logger.info(f"Starting bot with parallel LLM racing") - stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) + stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY", "")) tts = CartesiaTTSService( - api_key=os.getenv("CARTESIA_API_KEY"), + api_key=os.getenv("CARTESIA_API_KEY", ""), voice_id="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady ) # Create two LLM instances for racing llm1 = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY")) llm2 = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY")) - - messages = [ + messages: list[ChatCompletionMessageParam] = [ { "role": "system", "content": "You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be converted to audio so don't include special characters in your answers. Respond to what the user said in a creative and helpful way.",