Skip to main content

LlamaIndex x ElevenLabs integration

Project description

LlamaIndex x ElevenLabs integration

This package is an integration for ElevenLabs realtime conversation with agents.

To install the package, run:

python3 -m pip install llama-index-voice-agents-elevenlabs

And, if you want to run it, you can refer to the simple example down here (in this case, the audio input/output are the same as the local device you are running the script on):

import os

from llama_index.voice_agents.elevenlabs import ElevenLabsVoiceAgent
from dotenv import load_dotenv
from elevenlabs.client import ElevenLabs


load_dotenv()
AGENT_ID = os.environ.get("AGENT_ID")
API_KEY = os.environ.get("ELEVENLABS_API_KEY")


def main():
    client = ElevenLabs(api_key=API_KEY)
    conversation = ElevenLabsVoiceAgent(
        client,
        AGENT_ID,
        requires_auth=bool(API_KEY),
    )
    conversation.start()

    while True:
        try:
            # GET MESSAGES IN llama-index ChatMessage FORMAT
            messages = conversation.export_messages()
            events = conversation.export_events()
            # GET AVERAGE LATENCY
            latency = conversation.average_latency
        except KeyboardInterrupt:
            conversation.interrupt()
            conversation.stop()
            print(f"Messages: {messages}")
            print(f"Events: {events}")
            print(f"Latency: {latency}")


if __name__ == "__main__":
    main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_voice_agents_elevenlabs-0.4.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_voice_agents_elevenlabs-0.4.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_voice_agents_elevenlabs-0.4.0.tar.gz
Algorithm Hash digest
SHA256 1c73bca5b2a880bcfa9101aaabf1f9b5b589a2c6f2e597fcce6f7e51bc095c34
MD5 773872d6d7f6aeb075bbd60fc693ee3d
BLAKE2b-256 40ee6ce5cfaa3b67f92ef54887effabe4fcef227102bf79979fa007257e88628

See more details on using hashes here.

File details

Details for the file llama_index_voice_agents_elevenlabs-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_voice_agents_elevenlabs-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18c977515c2bf73bb98ea7723c5a0412d07c5d2bc03cecac3c11f722ebd65c4d
MD5 d9af8d92044d8a3627f787072abb515f
BLAKE2b-256 d7387415962acda6b242a4b4f68cb57174fbfa3d42a990cd48d8f34bad28aa07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page