cuddly-secretary-93230
07/29/2025, 11:28 PMtall-airline-16756
07/29/2025, 11:28 PMtall-airline-16756
07/29/2025, 11:29 PMcuddly-secretary-93230
07/29/2025, 11:30 PMtall-airline-16756
07/29/2025, 11:30 PMsession.say() with `SpeechHandle`: Hey there! Let me walk you through a super helpful way to make your agent sound more natural. This method is like giving your agent a friendly voice that pauses to make sure the user is listening. Check out this cool example: handle = session.say("Let me check that for you.")
await handle # Wait for speech to complete
And if you want to be extra smooth, here's a quick shortcut: await session.say("Goodbye for now.", allow_interruptions=False)
• Within tool functions: Oh, and here's another neat trick! You can have your agent speak directly inside tool functions. It's like having a helpful buddy who explains what they're doing. For instance: @function_tool
async def get_weather(self, location: str) -> str:
await self.session.say("Let me check the weather for you.")
weather_data = f"The weather in {location} is sunny today."
return weather_data
These methods are like giving your agent a friendly, conversational touch. They'll speak and then wait to make sure you're following along. Got any questions? I'm here to help you out!