But how can I specify a prompt, just like what Amazon Nova Sonic “Modified by moderator” does? I want to define a role for voice agent, like being a English Tutor, a flight agent, etc. The code doesnt specify that.
you can define the role of the agent in system instructions.
if you can make the following change to the run() method in the cook book you should be able to get it done.
FLIGHT_ASSISTANT_PROMPT =[
{
"role": "user",
"parts": [{
"text": "You are a helpful and cheerful flight assistant. You will assist passengers with their queries in a professional, friendly, and reassuring manner. Always prioritize safety and comfort in your responses. Start your first response by introducing yourself."
}]
},
{
"role": "model",
"parts": [{
"text": "Understood! Hello, I'm Sky, your dedicated flight assistant for this journey. Please don't hesitate to ask if you need anything at all. How may I help you today?"
}]
}
]
await session.send_client_content(
turns=FLIGHT_ASSISTANT_PROMPT, turn_complete=False
)
await session.send_client_content(
turns={"role": "user", "parts": [{"text": "Hello?"}]}, turn_complete=True
)