dry-helmet-74553
07/28/2025, 2:58 PMtall-airline-16756
07/28/2025, 2:58 PMtall-airline-16756
07/28/2025, 2:59 PMgenerate_reply() Method: In multimodal agents, you can trigger an initial response by calling the generate_reply() method after starting the agent. For example: agent = MultimodalAgent(model=model, chat_ctx=chat_ctx)
agent.start(ctx.room, participant)
# Enable the agent to speak first
agent.generate_reply()
• Create a Custom say Method: You can implement a custom say method to enable the agent to greet users. For example: async def say(self, message: str):
if self.model and hasattr(self.model, 'sessions'):
session = self.model.sessions[0]
session.conversation.item.create(
llm.ChatMessage(
role="assistant",
content=f"Using your voice to respond, please say: {message}"
)
)
session.response.create()
• Use Conversation Items (Node.js): In Node.js implementations, you can manually create conversation items and trigger responses. For example: session.conversation.item.create(
llm.ChatMessage.create({
role: llm.ChatRole.USER,
text: 'Say "How can I help you today?"',
}),
);
session.response.create();
These approaches allow you to customize the behavior of realtime models to include an initial greeting.
Sources: plugins/openai/src/realtime/realtime_model.ts