Update foundational examples to use "user" role

Use system_instruction on LLM service constructors instead of adding
system messages to LLMContext. Messages added to context now use
"user" role.
This commit is contained in:
Aleix Conchillo Flaqué
2026-03-05 16:17:32 -08:00
parent 18494658c3
commit 593b75bc8b
179 changed files with 271 additions and 335 deletions

View File

@@ -116,15 +116,15 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
services=[tts_cartesia, tts_deepgram], strategy_type=ServiceSwitcherStrategyManual
)
system = "You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Respond to what the user said in a creative and helpful way."
system_prompt = "You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Respond to what the user said in a creative and helpful way."
llm_openai = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
settings=OpenAILLMSettings(system_instruction=system),
settings=OpenAILLMSettings(system_instruction=system_prompt),
)
llm_google = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"),
settings=GoogleLLMSettings(system_instruction=system),
settings=GoogleLLMSettings(system_instruction=system_prompt),
)
llm_switcher = LLMSwitcher(
llms=[llm_openai, llm_google], strategy_type=ServiceSwitcherStrategyManual