Is there an option in livekit to remotely force th...
# ask-ai
w
Is there an option in livekit to remotely force the ai bot to say something specific?
t
Thanks for reaching out, Ankit. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Yes, LiveKit provides options to make an AI bot say something specific. Here are two approaches: • Using the
say
method in the PhoneAssistant class:
This method allows you to programmatically instruct the assistant to say a specific message. For example:
Copy code
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:
Copy code
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