Also see the Conversational AI
overview
Installation
Install theelevenlabs
Python package in your project:
pyaudio
extra:
The
pyaudio
package installation might require additional system dependencies.See PyAudio package README for more information.On Debian-based systems you can install the dependencies with:
Usage
In this example we will create a simple script that runs a conversation with the ElevenLabs Conversational AI agent. You can find the full code in the ElevenLabs examples repository. First import the necessary dependencies:ElevenLabs
client instance:
Conversation
instance:
DefaultAudioInterface
which uses the default system audio input/output devices for the conversation.
You can also implement your own audio interface by subclassing elevenlabs.conversational_ai.conversation.AudioInterface
.
Now we can start the conversation:
Ctrl+C
we can add a signal handler which will call end_session()
: