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.1.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.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_voice_agents_elevenlabs-0.4.1.tar.gz
Algorithm Hash digest
SHA256 c548b62c820fda55a647b6acc0527b97f03105612f5adc62f4091923f77c0134
MD5 d3cc8c039d148d0f5cccf21cf37a04d7
BLAKE2b-256 8f23f03285c9231f202b80d13b17ffe986df996476242e0054c2f57c58cbe283

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_voice_agents_elevenlabs-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db0c0761e8d024b6c59838a6181486ae200fc03c2a005da499f2e936da7dfd7f
MD5 b13271da035e32c825a326290eb38f0e
BLAKE2b-256 5e4bc077d695f51c6b2506996124fe2f5b83ed8a49fb257332d822bc0bf849ce

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