Real time RAG Voice Agent, powered by Cartesia
This project implements a VOICE RAG Agent powered by Cartesia
Installation
Ensure you have Python 3.11 or later installed and run:
bash
pip install -r requirements.txtImplementation 1: voice_agent_openai.py
This implementation uses OpenAI's services for speech-to-text and cartesia for speech synthesis, simpler setup if you already have OpenAI API keys.
Requirements
- Cartesia AI key
- OpenAI API key
- LiveKit credentials
Setup
- Copy
.env.exampleto.env - Configure the following environment variables:
bash
OPENAI_API_KEY=your_openai_api_key
CARTESIA_API_KEY=your_cartesia_api_key
LIVEKIT_URL=your_livekit_url
LIVEKIT_API_KEY=your_livekit_api_key
LIVEKIT_API_SECRET=your_livekit_api_secretRunning
bash
python voice_agent_openai.py startConnecting to Agent Playground
Implementation 2: voice_agent.py
This implementation uses AssemblyAI for speech processing and Ollama (with Gemma) for language tasks.
Setup
Install Ollama
bash# For macOS brew install ollama # For Linux curl -fsSL https://ollama.com/install.sh | shPull Gemma Model
bashollama pull gemma3Configure Environment Copy
.env.exampleto.envand set:bashCARTESIA_API_KEY=your_cartesia_api_key ASSEMBLYAI_API_KEY=your_assemblyai_api_key LIVEKIT_URL=your_livekit_url LIVEKIT_API_KEY=your_livekit_api_key LIVEKIT_API_SECRET=your_livekit_api_secret
Running
Start Ollama server:
bashollama serveIn a new terminal, run the voice agent:
bashpython voice_agent.py start
📬 Stay Updated with Our Newsletter!
Get a FREE Data Science eBook 📖 with 150+ essential lessons in Data Science when you subscribe to our newsletter! Stay in the loop with the latest tutorials, insights, and exclusive resources. Subscribe now!
