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

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.3.0b0.tar.gz.

File metadata

File hashes

Hashes for llama_index_voice_agents_elevenlabs-0.3.0b0.tar.gz
Algorithm Hash digest
SHA256 9318636c572cb820bbc9be1a6c5fc6b01827020d3f2cd81435416341432a9597
MD5 db1042333804eca8bceced7e86c8b108
BLAKE2b-256 b6a3aa93927270607274c53b5f845b32a223563699100fe142d32c3b823741c5

See more details on using hashes here.

File details

Details for the file llama_index_voice_agents_elevenlabs-0.3.0b0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_voice_agents_elevenlabs-0.3.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb10b13e5e91db946b62d838c41fd683c1c8eb096350d5d04a468876dc13a974
MD5 8169e46d9dd119a1768f10a5ca416f5c
BLAKE2b-256 3429e179888baa96ea4238363998c273e2d8068a72c53716a220ad39881a155f

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