📚 API ReferenceGenerative AI
<TTS>
Add text-to-speech support to your agent.
Import
import { TTS } from 'react-agents';
Usage
The TTS component adds text-to-speech capabilities to your agent, allowing it to speak messages using a specified voice endpoint.
-
Add the component to your agent:
return ( <Agent> {/* ... */} <TTS voiceEndpoint="elevenlabs:scillia:kNBPK9DILaezWWUSHpF9" /> {/* ... */} </Agent> );
-
Use the
say
action in your agent's responses:agent.say({ text: "Hello, I can speak!" });
Or, simply chat with the agent to get them to speak.
Props
Prop | Type | Default |
---|---|---|
voiceEndpoint | string | null (uses default voice) |
Custom voices
You can create and use custom voices with the USDK CLI. Learn how to do that here.
Using Custom Voices with <TTS>
Once created, use your custom voice in the TTS component by setting the voiceEndpoint prop:
<TTS voiceEndpoint="elevenlabs:scillia:kNBPK9DILaezWWUSHpF9" />