many-forest-60185
09/05/2025, 3:03 AMtall-airline-16756
09/05/2025, 3:03 AMtall-airline-16756
09/05/2025, 3:03 AMgpt-realtime session, you can use the instructions parameter. Think of it as the system message that helps guide how the model behaves. Here are a couple of easy ways to set or update your prompt:
1. Set the Prompt When You Start the Session
Just pass the instructions parameter when you create a new session. For example:
const session = llm.session();
await session.updateInstructions("You are a helpful and concise assistant.");
2. Change the Prompt On the Fly During a Session
If you want to switch things up while the session is running, just use the updateInstructions method like this:
await session.updateInstructions("You are now a pirate, speak like one!");
Feel free to reach out if you have any questions or need a hand with this!
Sources: examples/src/realtime_turn_detector.ts | Live Conversations with AI using ChatGPT and WebRTC | livekit-plugins/livekit-plugins-google/livekit/plugins/google/beta/realtime...many-forest-60185
09/05/2025, 3:04 AMtall-airline-16756
09/05/2025, 3:04 AMmany-forest-60185
09/05/2025, 3:05 AMtall-airline-16756
09/05/2025, 3:06 AMupdate_instructions method. Here’s a little example to show you how:
async def on_enter(self):
if self.session.participant.name.startswith("sip"):
await self.update_instructions("You are a helpful agent speaking on the phone.")
self.session.generate_reply()
This method lets you change the system prompt while the session is still going. If you have any questions or want me to walk you through it, just let me know—I’m here to help!
Sources: livekit-agents/livekit/agents/llm/realtime.py | basics/change_agent_instructions.py