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:
@@ -146,15 +146,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
||||
)
|
||||
|
||||
# Set up context and context management.
|
||||
context = LLMContext(
|
||||
messages=[
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Tell me a fun fact!",
|
||||
},
|
||||
],
|
||||
tools=tools,
|
||||
)
|
||||
context = LLMContext(tools=tools)
|
||||
user_aggregator, assistant_aggregator = LLMContextAggregatorPair(context)
|
||||
|
||||
# Build the pipeline
|
||||
@@ -183,6 +175,7 @@ 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.
|
||||
context.add_message({"role": "user", "content": "Please introduce yourself to the user."})
|
||||
await task.queue_frames([LLMRunFrame()])
|
||||
# HACK: if using the older Nova Sonic (pre-2) model, you need this special way of
|
||||
# triggering the first assistant response. Note that this trigger requires a special
|
||||
|
||||
Reference in New Issue
Block a user