examples(foundational): use system_instruction in all examples

This commit is contained in:
Aleix Conchillo Flaqué
2026-03-04 15:36:48 -08:00
parent 01f0caf252
commit 0004a116d8
192 changed files with 1118 additions and 1916 deletions

View File

@@ -90,6 +90,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
include_thoughts=True,
)
),
system_instruction="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.register_direct_function(check_flight_status)
@@ -97,14 +98,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
tools = ToolsSchema(standard_tools=[check_flight_status, book_taxi])
messages = [
{
"role": "system",
"content": "You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be 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.",
},
]
context = LLMContext(messages, tools)
context = LLMContext(tools=tools)
user_aggregator, assistant_aggregator = LLMContextAggregatorPair(
context,
user_params=LLMUserAggregatorParams(vad_analyzer=SileroVADAnalyzer()),
@@ -135,16 +129,11 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
async def on_client_connected(transport, client):
logger.info(f"Client connected")
# Kick off the conversation.
messages.append(
{
"role": "user",
"content": "Say hello briefly.",
}
)
context.add_message({"role": "user", "content": "Say hello briefly."})
# Replace the above with one of these example prompts to demonstrate
# thinking and function calling.
# This example comes from Gemini docs.
# messages.append(
# context.add_message(
# {
# "role": "user",
# "content": "Check the status of flight AA100 and, if it's delayed, book me a taxi 2 hours before its departure time.",