wooden-egg-50291
03/25/2025, 4:50 PMtall-airline-16756
03/25/2025, 4:50 PMtall-airline-16756
03/25/2025, 4:51 PMsay
method in the PhoneAssistant class: This method allows you to programmatically instruct the assistant to say a specific message. For example:
async def say(self, message: str) -> None:
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()
• Using predefined messages: You can also define a list of messages and randomly select one for the bot to say. For example:
thinking_messages = [
"Let me look that up...",
"One moment while I check...",
"I'll find that information for you...",
"Just a second while I search...",
"Looking into that now..."
]
async def enrich_with_rag(...):
await agent.say(random.choice(thinking_messages))
Let me know if you need further assistance!
Sources: Company directory phone assistant | LiveKit Docs | Handling RAG Delays in Voice Agents | LiveKit Docs