Merge pull request #4338 from pipecat-ai/mb/fix-examples-types

Include examples in type checking
This commit is contained in:
Mark Backman
2026-04-21 15:47:10 -04:00
committed by GitHub
293 changed files with 884 additions and 1006 deletions

View File

@@ -71,17 +71,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -108,17 +108,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"), audio_passthrough=True) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"], audio_passthrough=True)
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", voice="71a7ad14-091c-4e8e-a314-022ece01c121",
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -102,17 +102,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),
) )
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),

View File

@@ -89,10 +89,10 @@ async def get_current_weather(params: FunctionCallParams):
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info("Starting bot") logger.info("Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -109,7 +109,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Primary LLM for conversation (could be any provider) # Primary LLM for conversation (could be any provider)
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction=system_prompt, system_instruction=system_prompt,
), ),
@@ -117,7 +117,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Dedicated cheap/fast LLM for summarization only # Dedicated cheap/fast LLM for summarization only
summarization_llm = GoogleLLMService( summarization_llm = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GoogleLLMService.Settings( settings=GoogleLLMService.Settings(
model="gemini-2.5-flash", model="gemini-2.5-flash",
), ),

View File

@@ -77,17 +77,17 @@ async def get_current_weather(params: FunctionCallParams):
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info("Starting bot") logger.info("Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = GoogleLLMService( llm = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GoogleLLMService.Settings( settings=GoogleLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You have access to tools to get the current weather - use them when relevant.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You have access to tools to get the current weather - use them when relevant.",
), ),

View File

@@ -72,10 +72,10 @@ async def summarize_conversation(params: FunctionCallParams):
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info("Starting bot") logger.info("Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -91,7 +91,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
""" """
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction=system_prompt, system_instruction=system_prompt,
), ),

View File

@@ -77,17 +77,17 @@ async def get_current_weather(params: FunctionCallParams):
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info("Starting bot") logger.info("Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You have access to tools to get the current weather - use them when relevant.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You have access to tools to get the current weather - use them when relevant.",
), ),

View File

@@ -63,17 +63,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -58,24 +58,24 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
openai_llm = OpenAILLMService( openai_llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),
) )
groq_llm = GroqLLMService( groq_llm = GroqLLMService(
api_key=os.getenv("GROQ_API_KEY"), api_key=os.environ["GROQ_API_KEY"],
settings=GroqLLMService.Settings( settings=GroqLLMService.Settings(
system_instruction="You are a very helpful assistant. Your goal is to demonstrate your capabilities in detail in a creative and helpful way.", system_instruction="You are a very helpful assistant. Your goal is to demonstrate your capabilities in detail in a creative and helpful way.",
), ),

View File

@@ -63,10 +63,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info("Starting bot") logger.info("Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -74,7 +74,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Main LLM — drives the conversation. Its RTVI events reach the client. # Main LLM — drives the conversation. Its RTVI events reach the client.
main_llm = OpenAILLMService( main_llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),
@@ -83,7 +83,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Evaluator LLM — silently grades the user's message in the background. # Evaluator LLM — silently grades the user's message in the background.
# Its RTVI events will be suppressed so the client is unaware of this branch. # Its RTVI events will be suppressed so the client is unaware of this branch.
evaluator_llm = OpenAILLMService( evaluator_llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
name="EvaluatorLLM", name="EvaluatorLLM",
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a silent quality evaluator. When given a user message, respond with a single JSON object: {'score': <1-5>, 'reason': '<brief reason>'}. Do not respond conversationally.", system_instruction="You are a silent quality evaluator. When given a user message, respond with a single JSON object: {'score': <1-5>, 'reason': '<brief reason>'}. Do not respond conversationally.",

View File

@@ -91,17 +91,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -56,10 +56,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = DeepgramTTSService( tts = DeepgramTTSService(
api_key=os.getenv("DEEPGRAM_API_KEY"), api_key=os.environ["DEEPGRAM_API_KEY"],
settings=DeepgramTTSService.Settings( settings=DeepgramTTSService.Settings(
voice="aura-asteria-en", voice="aura-asteria-en",
), ),
@@ -68,7 +68,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
llm = OpenAILLMService( llm = OpenAILLMService(
# To use OpenAI # To use OpenAI
# api_key=os.getenv("OPENAI_API_KEY"), # api_key=os.environ["OPENAI_API_KEY"],
# Or, to use a local vLLM (or similar) api server # Or, to use a local vLLM (or similar) api server
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
model="meta-llama/Meta-Llama-3-8B-Instruct", model="meta-llama/Meta-Llama-3-8B-Instruct",

View File

@@ -55,17 +55,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="d4db5fb9-f44b-4bd1-85fa-192e0f0d75f9", # Spanish-speaking Lady voice="d4db5fb9-f44b-4bd1-85fa-192e0f0d75f9", # Spanish-speaking Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a live translation assistant. Your sole purpose is to translate English text into Spanish. When you receive English text from the user, immediately translate it into natural, fluent Spanish. Do not add explanations, commentary, or extra information—only provide the Spanish translation of the text you receive.", system_instruction="You are a live translation assistant. Your sole purpose is to translate English text into Spanish. When you receive English text from the user, immediately translate it into natural, fluent Spanish. Do not add explanations, commentary, or extra information—only provide the Spanish translation of the text you receive.",
), ),

View File

@@ -126,14 +126,14 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
llm_text_aggregator.on_pattern_match("voice", on_voice_tag) llm_text_aggregator.on_pattern_match("voice", on_voice_tag)
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
# Process LLM text through the pattern aggregator before TTS # Process LLM text through the pattern aggregator before TTS
llm_text_processor = LLMTextProcessor(text_aggregator=llm_text_aggregator) llm_text_processor = LLMTextProcessor(text_aggregator=llm_text_aggregator)
# Initialize TTS with narrator voice as default # Initialize TTS with narrator voice as default
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice=VOICE_IDS["narrator"], voice=VOICE_IDS["narrator"],
), ),
@@ -190,7 +190,7 @@ Remember: Use narrator voice for EVERYTHING except the actual quoted dialogue.""
# Initialize LLM # Initialize LLM
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction=system_prompt, system_instruction=system_prompt,
), ),

View File

@@ -94,19 +94,19 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
required=["location", "format"], required=["location", "format"],
) )
stt_cartesia = CartesiaSTTService(api_key=os.getenv("CARTESIA_API_KEY")) stt_cartesia = CartesiaSTTService(api_key=os.environ["CARTESIA_API_KEY"])
stt_deepgram = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt_deepgram = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
# Uses ServiceSwitcherStrategyManual by default # Uses ServiceSwitcherStrategyManual by default
stt_switcher = ServiceSwitcher(services=[stt_cartesia, stt_deepgram]) stt_switcher = ServiceSwitcher(services=[stt_cartesia, stt_deepgram])
tts_cartesia = CartesiaTTSService( tts_cartesia = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
tts_deepgram = DeepgramTTSService( tts_deepgram = DeepgramTTSService(
api_key=os.getenv("DEEPGRAM_API_KEY"), api_key=os.environ["DEEPGRAM_API_KEY"],
settings=DeepgramTTSService.Settings( settings=DeepgramTTSService.Settings(
voice="aura-2-helena-en", voice="aura-2-helena-en",
), ),
@@ -117,11 +117,11 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
system_prompt = "You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way." system_prompt = "You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way."
llm_openai = OpenAILLMService( llm_openai = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings(system_instruction=system_prompt), settings=OpenAILLMService.Settings(system_instruction=system_prompt),
) )
llm_google = GoogleLLMService( llm_google = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GoogleLLMService.Settings(system_instruction=system_prompt), settings=GoogleLLMService.Settings(system_instruction=system_prompt),
) )
# Uses ServiceSwitcherStrategyManual by default # Uses ServiceSwitcherStrategyManual by default

View File

@@ -42,14 +42,14 @@ class SwitchLanguage(ParallelPipeline):
self._current_language = "English" self._current_language = "English"
english_tts = CartesiaTTSService( english_tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
spanish_tts = CartesiaTTSService( spanish_tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="d4db5fb9-f44b-4bd1-85fa-192e0f0d75f9", # Spanish-speaking Lady voice="d4db5fb9-f44b-4bd1-85fa-192e0f0d75f9", # Spanish-speaking Lady
), ),
@@ -101,7 +101,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService( stt = DeepgramSTTService(
api_key=os.getenv("DEEPGRAM_API_KEY"), api_key=os.environ["DEEPGRAM_API_KEY"],
settings=DeepgramSTTService.Settings( settings=DeepgramSTTService.Settings(
language="multi", language="multi",
), ),
@@ -110,7 +110,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
tts = SwitchLanguage() tts = SwitchLanguage()
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You can speak the following languages: 'English' and 'Spanish'.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You can speak the following languages: 'English' and 'Spanish'.",
), ),

View File

@@ -42,21 +42,21 @@ class SwitchVoices(ParallelPipeline):
self._current_voice = "News Lady" self._current_voice = "News Lady"
news_lady = CartesiaTTSService( news_lady = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="bf991597-6c13-47e4-8411-91ec2de5c466", # Newslady voice="bf991597-6c13-47e4-8411-91ec2de5c466", # Newslady
), ),
) )
british_lady = CartesiaTTSService( british_lady = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
barbershop_man = CartesiaTTSService( barbershop_man = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="a0e99841-438c-4a64-b679-ae501e7d6091", # Barbershop Man voice="a0e99841-438c-4a64-b679-ae501e7d6091", # Barbershop Man
), ),
@@ -114,12 +114,12 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = SwitchVoices() tts = SwitchVoices()
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative and helpful way. You can do the following voices: 'News Lady', 'British Lady' and 'Barbershop Man'.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative and helpful way. You can do the following voices: 'News Lady', 'British Lady' and 'Barbershop Man'.",
), ),

View File

@@ -60,13 +60,13 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
# Cartesia offers a `<spell></spell>` tags that we can use to ask the user # Cartesia offers a `<spell></spell>` tags that we can use to ask the user
# to confirm the emails. # to confirm the emails.
# (see https://docs.cartesia.ai/build-with-sonic/formatting-text-for-sonic/spelling-out-input-text) # (see https://docs.cartesia.ai/build-with-sonic/formatting-text-for-sonic/spelling-out-input-text)
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -84,7 +84,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# ) # )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You need to gather a valid email or emails from the user. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. If the user provides one or more email addresses confirm them with the user. Enclose all emails with <spell> tags, for example <spell>a@a.com</spell>.", system_instruction="You need to gather a valid email or emails from the user. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. If the user provides one or more email addresses confirm them with the user. Enclose all emails with <spell> tags, for example <spell>a@a.com</spell>.",
), ),

View File

@@ -52,22 +52,22 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),
) )
classifier_llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY")) classifier_llm = OpenAILLMService(api_key=os.environ["OPENAI_API_KEY"])
voicemail = VoicemailDetector(llm=classifier_llm) voicemail = VoicemailDetector(llm=classifier_llm)

View File

@@ -57,21 +57,21 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService( stt = DeepgramSTTService(
api_key=os.getenv("DEEPGRAM_API_KEY"), api_key=os.environ["DEEPGRAM_API_KEY"],
settings=DeepgramSTTService.Settings( settings=DeepgramSTTService.Settings(
keyterm=["pipecat"], keyterm=["pipecat"],
), ),
) )
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -107,17 +107,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = AnthropicLLMService( llm = AnthropicLLMService(
api_key=os.getenv("ANTHROPIC_API_KEY"), api_key=os.environ["ANTHROPIC_API_KEY"],
enable_async_tool_cancellation=True, enable_async_tool_cancellation=True,
settings=AnthropicLLMService.Settings( settings=AnthropicLLMService.Settings(
system_instruction=( system_instruction=(

View File

@@ -66,17 +66,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = AnthropicLLMService( llm = AnthropicLLMService(
api_key=os.getenv("ANTHROPIC_API_KEY"), api_key=os.environ["ANTHROPIC_API_KEY"],
enable_async_tool_cancellation=True, enable_async_tool_cancellation=True,
settings=AnthropicLLMService.Settings( settings=AnthropicLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",

View File

@@ -86,10 +86,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -97,7 +97,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Anthropic for vision analysis # Anthropic for vision analysis
llm = AnthropicLLMService( llm = AnthropicLLMService(
api_key=os.getenv("ANTHROPIC_API_KEY"), api_key=os.environ["ANTHROPIC_API_KEY"],
settings=AnthropicLLMService.Settings( settings=AnthropicLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.",
), ),

View File

@@ -65,17 +65,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = AnthropicLLMService( llm = AnthropicLLMService(
api_key=os.getenv("ANTHROPIC_API_KEY"), api_key=os.environ["ANTHROPIC_API_KEY"],
settings=AnthropicLLMService.Settings( settings=AnthropicLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -86,10 +86,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),

View File

@@ -60,18 +60,18 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = AzureLLMService( llm = AzureLLMService(
api_key=os.getenv("AZURE_CHATGPT_API_KEY"), api_key=os.environ["AZURE_CHATGPT_API_KEY"],
endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), endpoint=os.environ["AZURE_CHATGPT_ENDPOINT"],
settings=AzureLLMService.Settings( settings=AzureLLMService.Settings(
model=os.getenv("AZURE_CHATGPT_MODEL"), model=os.getenv("AZURE_CHATGPT_MODEL"),
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",

View File

@@ -60,17 +60,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = CerebrasLLMService( llm = CerebrasLLMService(
api_key=os.getenv("CEREBRAS_API_KEY"), api_key=os.environ["CEREBRAS_API_KEY"],
settings=CerebrasLLMService.Settings( settings=CerebrasLLMService.Settings(
system_instruction="""You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. system_instruction="""You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.

View File

@@ -60,17 +60,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = DeepSeekLLMService( llm = DeepSeekLLMService(
api_key=os.getenv("DEEPSEEK_API_KEY"), api_key=os.environ["DEEPSEEK_API_KEY"],
settings=DeepSeekLLMService.Settings( settings=DeepSeekLLMService.Settings(
model="deepseek-chat", model="deepseek-chat",
system_instruction="""You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. system_instruction="""You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.

View File

@@ -76,17 +76,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -60,17 +60,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = FireworksLLMService( llm = FireworksLLMService(
api_key=os.getenv("FIREWORKS_API_KEY"), api_key=os.environ["FIREWORKS_API_KEY"],
settings=FireworksLLMService.Settings( settings=FireworksLLMService.Settings(
model="accounts/fireworks/models/gpt-oss-20b", model="accounts/fireworks/models/gpt-oss-20b",
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",

View File

@@ -107,17 +107,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = GoogleLLMService( llm = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
enable_async_tool_cancellation=True, enable_async_tool_cancellation=True,
settings=GoogleLLMService.Settings( settings=GoogleLLMService.Settings(
system_instruction=( system_instruction=(

View File

@@ -98,10 +98,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -127,7 +127,7 @@ indicate you should use the get_image tool are:
""" """
llm = GoogleLLMService( llm = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
enable_async_tool_cancellation=True, enable_async_tool_cancellation=True,
settings=GoogleLLMService.Settings( settings=GoogleLLMService.Settings(
system_instruction=system_prompt, system_instruction=system_prompt,

View File

@@ -60,19 +60,19 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = ElevenLabsTTSService( tts = ElevenLabsTTSService(
api_key=os.getenv("ELEVENLABS_API_KEY", ""), api_key=os.environ["ELEVENLABS_API_KEY"],
settings=ElevenLabsTTSService.Settings( settings=ElevenLabsTTSService.Settings(
voice=os.getenv("ELEVENLABS_VOICE_ID", ""), voice=os.getenv("ELEVENLABS_VOICE_ID", "Xb7hH8MSUJpSbSDYk0k2"),
), ),
) )
llm = GoogleVertexLLMService( llm = GoogleVertexLLMService(
credentials=os.getenv("GOOGLE_VERTEX_TEST_CREDENTIALS"), credentials=os.environ["GOOGLE_VERTEX_TEST_CREDENTIALS"],
project_id=os.getenv("GOOGLE_CLOUD_PROJECT_ID"), project_id=os.environ["GOOGLE_CLOUD_PROJECT_ID"],
location=os.getenv("GOOGLE_CLOUD_LOCATION"), location=os.environ["GOOGLE_CLOUD_LOCATION"],
settings=GoogleVertexLLMService.Settings( settings=GoogleVertexLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),
@@ -103,14 +103,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
tools = ToolsSchema(standard_tools=[weather_function]) tools = ToolsSchema(standard_tools=[weather_function])
messages = [ context = LLMContext(tools=tools)
{
"role": "developer",
"content": "Start a conversation with 'Hey there' to get the current weather.",
},
]
context = LLMContext(messages, tools)
user_aggregator, assistant_aggregator = LLMContextAggregatorPair( user_aggregator, assistant_aggregator = LLMContextAggregatorPair(
context, context,
user_params=LLMUserAggregatorParams(vad_analyzer=SileroVADAnalyzer()), user_params=LLMUserAggregatorParams(vad_analyzer=SileroVADAnalyzer()),
@@ -141,6 +134,12 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
async def on_client_connected(transport, client): async def on_client_connected(transport, client):
logger.info(f"Client connected") logger.info(f"Client connected")
# Kick off the conversation. # Kick off the conversation.
context.add_message(
{
"role": "developer",
"content": "Please introduce yourself to the user.",
}
)
await task.queue_frames([LLMRunFrame()]) await task.queue_frames([LLMRunFrame()])
@transport.event_handler("on_client_disconnected") @transport.event_handler("on_client_disconnected")

View File

@@ -86,10 +86,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -97,7 +97,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Google Gemini model for vision analysis # Google Gemini model for vision analysis
llm = GoogleLLMService( llm = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GoogleLLMService.Settings( settings=GoogleLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.",
), ),

View File

@@ -96,10 +96,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -125,7 +125,7 @@ indicate you should use the get_image tool are:
""" """
llm = GoogleLLMService( llm = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GoogleLLMService.Settings( settings=GoogleLLMService.Settings(
system_instruction=system_prompt, system_instruction=system_prompt,
), ),

View File

@@ -62,10 +62,10 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = XAIHttpTTSService( tts = XAIHttpTTSService(
api_key=os.getenv("XAI_API_KEY"), api_key=os.environ["XAI_API_KEY"],
aiohttp_session=session, aiohttp_session=session,
settings=XAIHttpTTSService.Settings( settings=XAIHttpTTSService.Settings(
voice="eve", voice="eve",
@@ -73,7 +73,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
llm = GrokLLMService( llm = GrokLLMService(
api_key=os.getenv("XAI_API_KEY"), api_key=os.environ["XAI_API_KEY"],
settings=GrokLLMService.Settings( settings=GrokLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -60,17 +60,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = GroqSTTService(api_key=os.getenv("GROQ_API_KEY")) stt = GroqSTTService(api_key=os.environ["GROQ_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = GroqLLMService( llm = GroqLLMService(
api_key=os.getenv("GROQ_API_KEY"), api_key=os.environ["GROQ_API_KEY"],
settings=GroqLLMService.Settings( settings=GroqLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -63,17 +63,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = MistralLLMService( llm = MistralLLMService(
api_key=os.getenv("MISTRAL_API_KEY"), api_key=os.environ["MISTRAL_API_KEY"],
settings=MistralLLMService.Settings( settings=MistralLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -117,17 +117,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.",
), ),

View File

@@ -63,17 +63,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = NebiusLLMService( llm = NebiusLLMService(
api_key=os.getenv("NEBIUS_API_KEY"), api_key=os.environ["NEBIUS_API_KEY"],
settings=NebiusLLMService.Settings( settings=NebiusLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -63,17 +63,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = NovitaLLMService( llm = NovitaLLMService(
api_key=os.getenv("NOVITA_API_KEY"), api_key=os.environ["NOVITA_API_KEY"],
settings=NovitaLLMService.Settings( settings=NovitaLLMService.Settings(
model="openai/gpt-oss-120b", model="openai/gpt-oss-120b",
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",

View File

@@ -60,17 +60,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = NvidiaLLMService( llm = NvidiaLLMService(
api_key=os.getenv("NVIDIA_API_KEY"), api_key=os.environ["NVIDIA_API_KEY"],
settings=NvidiaLLMService.Settings( settings=NvidiaLLMService.Settings(
model="nvidia/llama-3.3-nemotron-super-49b-v1.5", model="nvidia/llama-3.3-nemotron-super-49b-v1.5",
# Recommended when turning thinking off # Recommended when turning thinking off

View File

@@ -64,10 +64,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),

View File

@@ -107,17 +107,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
enable_async_tool_cancellation=True, enable_async_tool_cancellation=True,
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction=( system_instruction=(

View File

@@ -70,7 +70,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = OpenAISTTService( stt = OpenAISTTService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAISTTService.Settings( settings=OpenAISTTService.Settings(
model="gpt-4o-transcribe", model="gpt-4o-transcribe",
prompt="Expect words related weather, such as temperature and conditions. And restaurant names.", prompt="Expect words related weather, such as temperature and conditions. And restaurant names.",
@@ -78,7 +78,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
tts = OpenAITTSService( tts = OpenAITTSService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAITTSService.Settings( settings=OpenAITTSService.Settings(
voice="ballad", voice="ballad",
), ),
@@ -86,7 +86,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
enable_async_tool_cancellation=True, enable_async_tool_cancellation=True,
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",

View File

@@ -107,17 +107,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAIResponsesLLMService( llm = OpenAIResponsesLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
enable_async_tool_cancellation=True, enable_async_tool_cancellation=True,
settings=OpenAIResponsesLLMService.Settings( settings=OpenAIResponsesLLMService.Settings(
system_instruction=( system_instruction=(

View File

@@ -66,17 +66,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAIResponsesLLMService( llm = OpenAIResponsesLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
enable_async_tool_cancellation=True, enable_async_tool_cancellation=True,
settings=OpenAIResponsesLLMService.Settings( settings=OpenAIResponsesLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",

View File

@@ -63,17 +63,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAIResponsesHttpLLMService( llm = OpenAIResponsesHttpLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAIResponsesHttpLLMService.Settings( settings=OpenAIResponsesHttpLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -87,17 +87,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAIResponsesHttpLLMService( llm = OpenAIResponsesHttpLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAIResponsesHttpLLMService.Settings( settings=OpenAIResponsesHttpLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.",
), ),

View File

@@ -87,17 +87,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAIResponsesLLMService( llm = OpenAIResponsesLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAIResponsesLLMService.Settings( settings=OpenAIResponsesLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.",
), ),

View File

@@ -63,17 +63,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAIResponsesLLMService( llm = OpenAIResponsesLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAIResponsesLLMService.Settings( settings=OpenAIResponsesLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -87,17 +87,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. You are able to describe images from the user camera.",
), ),

View File

@@ -64,7 +64,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = OpenAISTTService( stt = OpenAISTTService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAISTTService.Settings( settings=OpenAISTTService.Settings(
model="gpt-4o-transcribe", model="gpt-4o-transcribe",
prompt="Expect words related weather, such as temperature and conditions. And restaurant names.", prompt="Expect words related weather, such as temperature and conditions. And restaurant names.",
@@ -72,7 +72,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
tts = OpenAITTSService( tts = OpenAITTSService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAITTSService.Settings( settings=OpenAITTSService.Settings(
voice="ballad", voice="ballad",
), ),
@@ -80,7 +80,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -60,11 +60,11 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = AzureTTSService( tts = AzureTTSService(
api_key=os.getenv("AZURE_SPEECH_API_KEY"), api_key=os.environ["AZURE_SPEECH_API_KEY"],
region=os.getenv("AZURE_SPEECH_REGION"), region=os.environ["AZURE_SPEECH_REGION"],
settings=AzureTTSService.Settings( settings=AzureTTSService.Settings(
voice="en-US-JennyNeural", voice="en-US-JennyNeural",
language="en-US", language="en-US",
@@ -74,7 +74,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
llm = OpenRouterLLMService( llm = OpenRouterLLMService(
api_key=os.getenv("OPENROUTER_API_KEY"), api_key=os.environ["OPENROUTER_API_KEY"],
settings=OpenRouterLLMService.Settings( settings=OpenRouterLLMService.Settings(
model="openai/gpt-4o-2024-11-20", model="openai/gpt-4o-2024-11-20",
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",

View File

@@ -58,17 +58,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = PerplexityLLMService( llm = PerplexityLLMService(
api_key=os.getenv("PERPLEXITY_API_KEY"), api_key=os.environ["PERPLEXITY_API_KEY"],
settings=PerplexityLLMService.Settings( settings=PerplexityLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -60,17 +60,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = QwenLLMService( llm = QwenLLMService(
api_key=os.getenv("QWEN_API_KEY"), api_key=os.environ["QWEN_API_KEY"],
model="qwen2.5-72b-instruct", model="qwen2.5-72b-instruct",
settings=QwenLLMService.Settings( settings=QwenLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",

View File

@@ -61,18 +61,18 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService( stt = DeepgramSTTService(
api_key=os.getenv("DEEPGRAM_API_KEY"), api_key=os.environ["DEEPGRAM_API_KEY"],
) )
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = SambaNovaLLMService( llm = SambaNovaLLMService(
api_key=os.getenv("SAMBANOVA_API_KEY"), api_key=os.environ["SAMBANOVA_API_KEY"],
settings=SambaNovaLLMService.Settings( settings=SambaNovaLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -64,21 +64,21 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = SarvamSTTService( stt = SarvamSTTService(
api_key=os.getenv("SARVAM_API_KEY"), api_key=os.environ["SARVAM_API_KEY"],
settings=SarvamSTTService.Settings( settings=SarvamSTTService.Settings(
model="saaras:v3", model="saaras:v3",
), ),
) )
tts = SarvamTTSService( tts = SarvamTTSService(
api_key=os.getenv("SARVAM_API_KEY"), api_key=os.environ["SARVAM_API_KEY"],
settings=SarvamTTSService.Settings( settings=SarvamTTSService.Settings(
model="bulbul:v3", model="bulbul:v3",
voice="shubh", voice="shubh",
), ),
) )
llm = SarvamLLMService( llm = SarvamLLMService(
api_key=os.getenv("SARVAM_API_KEY"), api_key=os.environ["SARVAM_API_KEY"],
settings=SarvamLLMService.Settings( settings=SarvamLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -60,17 +60,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = TogetherLLMService( llm = TogetherLLMService(
api_key=os.getenv("TOGETHER_API_KEY"), api_key=os.environ["TOGETHER_API_KEY"],
settings=TogetherLLMService.Settings( settings=TogetherLLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -36,7 +36,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),

View File

@@ -28,7 +28,7 @@ async def main():
transport = LocalAudioTransport(LocalAudioTransportParams(audio_out_enabled=True)) transport = LocalAudioTransport(LocalAudioTransportParams(audio_out_enabled=True))
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),

View File

@@ -38,14 +38,14 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -42,7 +42,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
imagegen = GoogleImageGenService( imagegen = GoogleImageGenService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
) )
task = PipelineTask( task = PipelineTask(

View File

@@ -108,10 +108,10 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Create an HTTP session for API calls # Create an HTTP session for API calls
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY")) llm = OpenAILLMService(api_key=os.environ["OPENAI_API_KEY"])
tts = CartesiaHttpTTSService( tts = CartesiaHttpTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaHttpTTSService.Settings( settings=CartesiaHttpTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),

View File

@@ -96,17 +96,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -51,17 +51,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -40,17 +40,17 @@ async def main():
) )
) )
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -63,17 +63,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -53,10 +53,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -77,7 +77,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
""" """
llm = AnthropicLLMService( llm = AnthropicLLMService(
api_key=os.getenv("ANTHROPIC_API_KEY"), api_key=os.environ["ANTHROPIC_API_KEY"],
settings=AnthropicLLMService.Settings( settings=AnthropicLLMService.Settings(
system_instruction=system_prompt, system_instruction=system_prompt,
), ),

View File

@@ -49,10 +49,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -71,7 +71,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
""" """
llm = AnthropicLLMService( llm = AnthropicLLMService(
api_key=os.getenv("ANTHROPIC_API_KEY"), api_key=os.environ["ANTHROPIC_API_KEY"],
settings=AnthropicLLMService.Settings( settings=AnthropicLLMService.Settings(
system_instruction=system_prompt, system_instruction=system_prompt,
), ),

View File

@@ -23,8 +23,6 @@ from pipecat.processors.aggregators.llm_response_universal import (
) )
from pipecat.runner.types import RunnerArguments from pipecat.runner.types import RunnerArguments
from pipecat.runner.utils import create_transport from pipecat.runner.utils import create_transport
from pipecat.services.cartesia.tts import CartesiaTTSService
from pipecat.services.deepgram.stt import DeepgramSTTService
from pipecat.services.google.gemini_live.llm import GeminiLiveLLMService from pipecat.services.google.gemini_live.llm import GeminiLiveLLMService
from pipecat.services.mcp_service import MCPClient from pipecat.services.mcp_service import MCPClient
from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.base_transport import BaseTransport, TransportParams
@@ -54,15 +52,6 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))
tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"),
settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
),
)
system = f""" system = f"""
You are a helpful LLM in a voice call. You are a helpful LLM in a voice call.
Your goal is to answer questions about the user's GitHub repositories and account. Your goal is to answer questions about the user's GitHub repositories and account.
@@ -85,7 +74,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
tools = await mcp.get_tools_schema() tools = await mcp.get_tools_schema()
llm = GeminiLiveLLMService( llm = GeminiLiveLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
system_instruction=system, system_instruction=system,
tools=tools, tools=tools,
) )

View File

@@ -54,10 +54,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -73,7 +73,7 @@ Just respond with short sentences when you are carrying out tool calls.
""" """
llm = GoogleLLMService( llm = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GoogleLLMService.Settings( settings=GoogleLLMService.Settings(
system_instruction=system_prompt, system_instruction=system_prompt,
), ),

View File

@@ -100,17 +100,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",
), ),

View File

@@ -60,12 +60,12 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
stt = DeepgramSTTService( stt = DeepgramSTTService(
api_key=os.getenv("DEEPGRAM_API_KEY"), api_key=os.environ["DEEPGRAM_API_KEY"],
metrics=SentryMetrics(), metrics=SentryMetrics(),
) )
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -73,7 +73,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
metrics=SentryMetrics(), metrics=SentryMetrics(),
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.",

View File

@@ -170,17 +170,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = AnthropicLLMService( llm = AnthropicLLMService(
api_key=os.getenv("ANTHROPIC_API_KEY"), api_key=os.environ["ANTHROPIC_API_KEY"],
settings=AnthropicLLMService.Settings( settings=AnthropicLLMService.Settings(
system_instruction=system_instruction, system_instruction=system_instruction,
), ),

View File

@@ -87,7 +87,9 @@ async def save_conversation(params: FunctionCallParams):
# the simplest thing to do is to pop messages until the last one is an assistant # the simplest thing to do is to pop messages until the last one is an assistant
# response # response
while messages and not ( while messages and not (
messages[-1].get("role") == "assistant" and "content" in messages[-1] isinstance(messages[-1], dict)
and messages[-1].get("role") == "assistant"
and "content" in messages[-1]
): ):
messages.pop() messages.pop()
if messages: # we never expect this to be empty if messages: # we never expect this to be empty
@@ -125,6 +127,7 @@ async def load_conversation(params: FunctionCallParams):
} }
) )
params.context.set_messages(messages) params.context.set_messages(messages)
assert isinstance(params.llm, AWSNovaSonicLLMService)
await params.llm.reset_conversation() await params.llm.reset_conversation()
# await params.llm.trigger_assistant_response() # await params.llm.trigger_assistant_response()
except Exception as e: except Exception as e:
@@ -219,9 +222,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
llm = AWSNovaSonicLLMService( llm = AWSNovaSonicLLMService(
secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"), secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"],
access_key_id=os.getenv("AWS_ACCESS_KEY_ID"), access_key_id=os.environ["AWS_ACCESS_KEY_ID"],
region=os.getenv("AWS_REGION"), # as of 2025-05-06, us-east-1 is the only supported region region=os.environ["AWS_REGION"], # as of 2025-05-06, us-east-1 is the only supported region
settings=AWSNovaSonicLLMService.Settings( settings=AWSNovaSonicLLMService.Settings(
voice="tiffany", # matthew, tiffany, amy voice="tiffany", # matthew, tiffany, amy
system_instruction=system_instruction, system_instruction=system_instruction,

View File

@@ -243,17 +243,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = GoogleLLMService( llm = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
system_instruction=system_instruction, system_instruction=system_instruction,
) )

View File

@@ -192,7 +192,7 @@ Remember, your responses should be short - just one or two sentences usually."""
) )
llm = GrokRealtimeLLMService( llm = GrokRealtimeLLMService(
api_key=os.getenv("XAI_API_KEY"), api_key=os.environ["XAI_API_KEY"],
session_properties=session_properties, session_properties=session_properties,
) )

View File

@@ -93,6 +93,7 @@ async def load_conversation(params: FunctionCallParams):
try: try:
with open(filename) as file: with open(filename) as file:
params.context.set_messages(json.load(file)) params.context.set_messages(json.load(file))
assert isinstance(params.llm, OpenAIRealtimeLLMService)
await params.llm.reset_conversation() await params.llm.reset_conversation()
# NOTE: we manually create a response here rather than relying # NOTE: we manually create a response here rather than relying
# on the function callback to trigger one since we've reset the # on the function callback to trigger one since we've reset the
@@ -171,10 +172,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
llm = OpenAIRealtimeLLMService( llm = OpenAIRealtimeLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAIRealtimeLLMService.Settings( settings=OpenAIRealtimeLLMService.Settings(
system_instruction="""Your knowledge cutoff is 2023-10. You are a helpful and friendly AI. system_instruction="""Your knowledge cutoff is 2023-10. You are a helpful and friendly AI.

View File

@@ -171,17 +171,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAIResponsesHttpLLMService( llm = OpenAIResponsesHttpLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAIResponsesHttpLLMService.Settings( settings=OpenAIResponsesHttpLLMService.Settings(
system_instruction=system_instruction, system_instruction=system_instruction,
), ),

View File

@@ -171,17 +171,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAIResponsesLLMService( llm = OpenAIResponsesLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAIResponsesLLMService.Settings( settings=OpenAIResponsesLLMService.Settings(
system_instruction=system_instruction, system_instruction=system_instruction,
), ),

View File

@@ -171,17 +171,17 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
) )
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
system_instruction=system_instruction, system_instruction=system_instruction,
) )

View File

@@ -95,10 +95,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),
@@ -106,7 +106,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Initialize the Gemini Multimodal Live model # Initialize the Gemini Multimodal Live model
llm = GoogleLLMService( llm = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GoogleLLMService.Settings( settings=GoogleLLMService.Settings(
system_instruction=system_instruction, system_instruction=system_instruction,
), ),

View File

@@ -52,7 +52,7 @@ import os
import time import time
from dotenv import load_dotenv from dotenv import load_dotenv
from google import genai from google import genai # pyright: ignore[reportAttributeAccessIssue]
from loguru import logger from loguru import logger
from pipecat.adapters.schemas.function_schema import FunctionSchema from pipecat.adapters.schemas.function_schema import FunctionSchema
@@ -179,10 +179,10 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="f9836c6e-a0bd-460e-9d3c-f7299fa60f94", # Southern Lady voice="f9836c6e-a0bd-460e-9d3c-f7299fa60f94", # Southern Lady
), ),
@@ -197,7 +197,7 @@ Your response will be turned into speech so use only simple words and punctuatio
""" """
llm = GoogleLLMService( llm = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GoogleLLMService.Settings( settings=GoogleLLMService.Settings(
model=VOICE_MODEL, model=VOICE_MODEL,
system_instruction=system_prompt, system_instruction=system_prompt,

View File

@@ -133,11 +133,11 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
# Initialize text-to-speech service # Initialize text-to-speech service
tts = ElevenLabsTTSService( tts = ElevenLabsTTSService(
api_key=os.getenv("ELEVENLABS_API_KEY"), api_key=os.environ["ELEVENLABS_API_KEY"],
settings=ElevenLabsTTSService.Settings( settings=ElevenLabsTTSService.Settings(
voice="pNInz6obpgDQGcFmaJgB", voice="pNInz6obpgDQGcFmaJgB",
), ),
@@ -196,7 +196,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Initialize LLM service # Initialize LLM service
llm = OpenAILLMService( llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAILLMService.Settings( settings=OpenAILLMService.Settings(
system_instruction="""You are a personal assistant. You can remember things about the person you are talking to. system_instruction="""You are a personal assistant. You can remember things about the person you are talking to.
Some Guidelines: Some Guidelines:

View File

@@ -116,8 +116,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Create the AWS Nova Sonic LLM service # Create the AWS Nova Sonic LLM service
llm = AWSNovaSonicLLMService( llm = AWSNovaSonicLLMService(
secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"), secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"],
access_key_id=os.getenv("AWS_ACCESS_KEY_ID"), access_key_id=os.environ["AWS_ACCESS_KEY_ID"],
# as of 2025-12-09, these are the supported regions: # as of 2025-12-09, these are the supported regions:
# - Nova 2 Sonic (the default model): # - Nova 2 Sonic (the default model):
# - us-east-1 # - us-east-1
@@ -126,7 +126,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# - Nova Sonic (the older model): # - Nova Sonic (the older model):
# - us-east-1 # - us-east-1
# - ap-northeast-1 # - ap-northeast-1
region=os.getenv("AWS_REGION"), region=os.environ["AWS_REGION"],
session_token=os.getenv("AWS_SESSION_TOKEN"), session_token=os.getenv("AWS_SESSION_TOKEN"),
settings=AWSNovaSonicLLMService.Settings( settings=AWSNovaSonicLLMService.Settings(
voice="tiffany", voice="tiffany",

View File

@@ -112,8 +112,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
llm = AzureRealtimeLLMService( llm = AzureRealtimeLLMService(
api_key=os.getenv("AZURE_REALTIME_API_KEY"), api_key=os.environ["AZURE_REALTIME_API_KEY"],
base_url=os.getenv("AZURE_REALTIME_BASE_URL"), base_url=os.environ["AZURE_REALTIME_BASE_URL"],
settings=AzureRealtimeLLMService.Settings( settings=AzureRealtimeLLMService.Settings(
system_instruction="""You are a helpful and friendly AI. system_instruction="""You are a helpful and friendly AI.

View File

@@ -104,7 +104,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Initialize Gemini service with File API support # Initialize Gemini service with File API support
llm = GeminiLiveLLMService( llm = GeminiLiveLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GeminiLiveLLMService.Settings( settings=GeminiLiveLLMService.Settings(
system_instruction=system_instruction, system_instruction=system_instruction,
voice="Charon", # Aoede, Charon, Fenrir, Kore, Puck voice="Charon", # Aoede, Charon, Fenrir, Kore, Puck

View File

@@ -114,7 +114,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
llm = GeminiLiveLLMService( llm = GeminiLiveLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GeminiLiveLLMService.Settings( settings=GeminiLiveLLMService.Settings(
system_instruction=system_instruction, system_instruction=system_instruction,
), ),

View File

@@ -67,7 +67,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Initialize the Gemini Multimodal Live model # Initialize the Gemini Multimodal Live model
llm = GeminiLiveLLMService( llm = GeminiLiveLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GeminiLiveLLMService.Settings( settings=GeminiLiveLLMService.Settings(
voice="Puck", # Aoede, Charon, Fenrir, Kore, Puck voice="Puck", # Aoede, Charon, Fenrir, Kore, Puck
system_instruction=system_instruction, system_instruction=system_instruction,

View File

@@ -133,7 +133,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
llm = GeminiLiveLLMService( llm = GeminiLiveLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GeminiLiveLLMService.Settings( settings=GeminiLiveLLMService.Settings(
system_instruction=system_instruction, system_instruction=system_instruction,
), ),

View File

@@ -75,7 +75,8 @@ class GroundingMetadataProcessor(FrameProcessor):
if isinstance(frame, LLMSearchResponseFrame): if isinstance(frame, LLMSearchResponseFrame):
self._grounding_count += 1 self._grounding_count += 1
logger.info(f"\n\n🔍 GROUNDING METADATA RECEIVED #{self._grounding_count}\n") logger.info(f"\n\n🔍 GROUNDING METADATA RECEIVED #{self._grounding_count}\n")
logger.info(f"📝 Search Result Text: {frame.search_result[:200]}...") if frame.search_result:
logger.info(f"📝 Search Result Text: {frame.search_result[:200]}...")
if frame.rendered_content: if frame.rendered_content:
logger.info(f"🔗 Rendered Content: {frame.rendered_content}") logger.info(f"🔗 Rendered Content: {frame.rendered_content}")
@@ -101,7 +102,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
) )
llm = GeminiLiveLLMService( llm = GeminiLiveLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GeminiLiveLLMService.Settings( settings=GeminiLiveLLMService.Settings(
system_instruction=SYSTEM_INSTRUCTION, system_instruction=SYSTEM_INSTRUCTION,
voice="Charon", # Aoede, Charon, Fenrir, Kore, Puck voice="Charon", # Aoede, Charon, Fenrir, Kore, Puck
@@ -111,16 +112,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Create a processor to capture grounding metadata # Create a processor to capture grounding metadata
grounding_processor = GroundingMetadataProcessor() grounding_processor = GroundingMetadataProcessor()
messages = [
{
"role": "user",
"content": "Please introduce yourself and let me know that you can help with current information by searching the web. Ask me what current information I'd like to know about.",
},
]
# Set up conversation context and management # Set up conversation context and management
context = LLMContext(messages) context = LLMContext()
# Server-side VAD is enabled by default; no local VAD is added. # Server-side VAD is enabled by default; no local VAD is added.
user_aggregator, assistant_aggregator = LLMContextAggregatorPair(context) user_aggregator, assistant_aggregator = LLMContextAggregatorPair(context)
@@ -144,6 +137,12 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
async def on_client_connected(transport, client): async def on_client_connected(transport, client):
logger.info(f"Client connected") logger.info(f"Client connected")
# Kick off the conversation. # Kick off the conversation.
context.add_message(
{
"role": "developer",
"content": "Please introduce yourself and let me know that you can help with current information by searching the web. Ask me what current information I'd like to know about.",
}
)
await task.queue_frames([LLMRunFrame()]) await task.queue_frames([LLMRunFrame()])
@transport.event_handler("on_client_disconnected") @transport.event_handler("on_client_disconnected")

View File

@@ -54,7 +54,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
llm = GeminiLiveLLMService( llm = GeminiLiveLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GeminiLiveLLMService.Settings( settings=GeminiLiveLLMService.Settings(
voice="Aoede", # Puck, Charon, Kore, Fenrir, Aoede voice="Aoede", # Puck, Charon, Kore, Fenrir, Aoede
vad=GeminiVADParams(disabled=True), vad=GeminiVADParams(disabled=True),

View File

@@ -110,8 +110,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
llm = GeminiLiveVertexLLMService( llm = GeminiLiveVertexLLMService(
credentials=os.getenv("GOOGLE_VERTEX_TEST_CREDENTIALS"), credentials=os.getenv("GOOGLE_VERTEX_TEST_CREDENTIALS"),
project_id=os.getenv("GOOGLE_CLOUD_PROJECT_ID"), project_id=os.environ["GOOGLE_CLOUD_PROJECT_ID"],
location=os.getenv("GOOGLE_CLOUD_LOCATION"), location=os.environ["GOOGLE_CLOUD_LOCATION"],
settings=GeminiLiveVertexLLMService.Settings( settings=GeminiLiveVertexLLMService.Settings(
system_instruction=system_instruction, system_instruction=system_instruction,
voice="Puck", # Aoede, Charon, Fenrir, Kore, Puck voice="Puck", # Aoede, Charon, Fenrir, Kore, Puck

View File

@@ -47,7 +47,7 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
llm = GeminiLiveLLMService( llm = GeminiLiveLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GeminiLiveLLMService.Settings( settings=GeminiLiveLLMService.Settings(
voice="Aoede", # Puck, Charon, Kore, Fenrir, Aoede voice="Aoede", # Puck, Charon, Kore, Fenrir, Aoede
# system_instruction="Talk like a pirate." # system_instruction="Talk like a pirate."

View File

@@ -52,7 +52,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
llm = GeminiLiveLLMService( llm = GeminiLiveLLMService(
api_key=os.getenv("GOOGLE_API_KEY"), api_key=os.environ["GOOGLE_API_KEY"],
settings=GeminiLiveLLMService.Settings( settings=GeminiLiveLLMService.Settings(
voice="Aoede", # Puck, Charon, Kore, Fenrir, Aoede voice="Aoede", # Puck, Charon, Kore, Fenrir, Aoede
# system_instruction="Talk like a pirate." # system_instruction="Talk like a pirate."

View File

@@ -179,7 +179,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# Create the Grok Realtime LLM service # Create the Grok Realtime LLM service
llm = GrokRealtimeLLMService( llm = GrokRealtimeLLMService(
api_key=os.getenv("XAI_API_KEY"), api_key=os.environ["XAI_API_KEY"],
settings=GrokRealtimeLLMService.Settings( settings=GrokRealtimeLLMService.Settings(
system_instruction="""You are a helpful and friendly AI assistant powered by Grok. system_instruction="""You are a helpful and friendly AI assistant powered by Grok.

View File

@@ -84,7 +84,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
# llm_model can be any supported model or an Inworld Router. # llm_model can be any supported model or an Inworld Router.
# See: https://docs.inworld.ai/router/introduction # See: https://docs.inworld.ai/router/introduction
llm = InworldRealtimeLLMService( llm = InworldRealtimeLLMService(
api_key=os.getenv("INWORLD_API_KEY"), api_key=os.environ["INWORLD_API_KEY"],
llm_model="xai/grok-4-1-fast-non-reasoning", llm_model="xai/grok-4-1-fast-non-reasoning",
voice="Sarah", voice="Sarah",
settings=InworldRealtimeLLMService.Settings( settings=InworldRealtimeLLMService.Settings(

View File

@@ -62,7 +62,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
llm = OpenAIRealtimeLLMService( llm = OpenAIRealtimeLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAIRealtimeLLMService.Settings( settings=OpenAIRealtimeLLMService.Settings(
system_instruction="""You are a helpful and friendly AI. system_instruction="""You are a helpful and friendly AI.
@@ -133,8 +133,8 @@ Remember, your responses should be short. Just one or two sentences, usually. Re
async def on_client_connected(transport, client): async def on_client_connected(transport, client):
logger.info(f"Client connected: {client}") logger.info(f"Client connected: {client}")
await maybe_capture_participant_camera(transport, client, framerate=0.5) await maybe_capture_participant_camera(transport, client, framerate=1)
await maybe_capture_participant_screen(transport, client, framerate=0.5) await maybe_capture_participant_screen(transport, client, framerate=1)
await task.queue_frames([LLMRunFrame()]) await task.queue_frames([LLMRunFrame()])

View File

@@ -117,7 +117,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
llm = OpenAIRealtimeLLMService( llm = OpenAIRealtimeLLMService(
api_key=os.getenv("OPENAI_API_KEY"), api_key=os.environ["OPENAI_API_KEY"],
settings=OpenAIRealtimeLLMSettings( settings=OpenAIRealtimeLLMSettings(
system_instruction="""You are a helpful and friendly AI. system_instruction="""You are a helpful and friendly AI.
@@ -156,7 +156,7 @@ Remember, your responses should be short. Just one or two sentences, usually. Re
) )
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.getenv("CARTESIA_API_KEY"), api_key=os.environ["CARTESIA_API_KEY"],
settings=CartesiaTTSService.Settings( settings=CartesiaTTSService.Settings(
voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady voice="71a7ad14-091c-4e8e-a314-022ece01c121", # British Reading Lady
), ),

Some files were not shown because too many files have changed in this diff Show More