Skip to content

george07-t/RAGVoice-AI

Repository files navigation

Voice-Enabled RAG AI Agent

Python 3.13 LiveKit LangChain OpenAI

A sophisticated voice-enabled AI agent combining Retrieval-Augmented Generation (RAG), multi-agent orchestration, and real-time function calling for intelligent document Q&A and dynamic information retrieval.

🎯 Features

  • πŸ“š RAG System: Query 5 comprehensive documents (80+ pages) on AI, Climate, History, Blockchain, and Health
  • 🎀 Voice Interface: Natural conversation with Deepgram STT and Cartesia TTS via LiveKit
  • πŸ€– Multi-Agent System: LangGraph orchestrator with specialized agents (RAG, Tool, General)
  • 🌦️ Dynamic Tools: Real-time weather, currency exchange, and timezone information
  • ⚑ High Performance: <2-5s end-to-end latency with comprehensive metrics logging
  • 🐳 Production Ready: Docker deployment with environment variable configuration

πŸ—οΈ Architecture

image

πŸš€ Quick Start

Prerequisites

  • Python 3.13+
  • OpenAI API key
  • LiveKit account (for voice features)
  • Deepgram API key (for STT)
  • Cartesia API key (for TTS)
  • WeatherAPI key (for weather tools)

Installation

# Clone repository
git clone https://github.com/george07-t/RAGVoice-AI.git
cd soffotech-rag-agent

# Create virtual environment
python -m venv .venv

# Activate (Windows)
.\.venv\Scripts\Activate.ps1

# Activate (Linux/Mac)
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Configuration

Copy .env.example to .env.local and fill in your API keys:

OPENAI_API_KEY="your-openai-key"
WEATHER_API_KEY="your-weather-key"
LIVEKIT_URL="your-livekit-url"
LIVEKIT_API_KEY="your-livekit-key"
LIVEKIT_API_SECRET="your-livekit-secret"
DEEPGRAM_API_KEY="your-deepgram-key"
CARTESIA_API_KEY="your-cartesia-key"

Initialize RAG System

python src/rag_system.py

This will:

  • Load 5 documents from documents/
  • Create 112 text chunks
  • Generate OpenAI embeddings
  • Build FAISS vector store

Run the Agent

Console Mode (Terminal Voice Chat):

python src/agent.py console

Development Mode:

python src/agent.py dev

Production Mode:

python src/agent.py start

πŸ“ Usage Examples

Document-Based Queries (RAG)

  • "What is deep learning?"
  • "Explain climate change causes"
  • "Tell me about World War II"
  • "What is blockchain technology?"
  • "How much sleep do I need?"

Real-Time Information (Tools)

  • "What's the weather in Dhaka?"
  • "Give me a 3-day forecast for New York"
  • "What's the USD to BDT exchange rate?"
  • "What time is it in Tokyo?"

General Conversation

  • "Hello! How are you?"
  • "What can you help me with?"

🐳 Docker Deployment

Build Image

docker build -t rag-voice-agent .

Run Container

docker run -d \
  -e OPENAI_API_KEY="your-key" \
  -e LIVEKIT_URL="your-url" \
  -e LIVEKIT_API_KEY="your-key" \
  -e LIVEKIT_API_SECRET="your-secret" \
  -e DEEPGRAM_API_KEY="your-key" \
  -e CARTESIA_API_KEY="your-key" \
  -e WEATHER_API_KEY="your-key" \
  -p 8080:8080 \
  rag-voice-agent

Deploy to LiveKit Cloud

lk deploy create

πŸ“Š Performance Metrics

Component Latency
RAG Retrieval (3 docs) 0.5-1.5s
Orchestrator Routing <0.1s
LLM Response 1-3s
Weather API 0.2-0.5s
Total End-to-End 2-5s

πŸ› οΈ Technology Stack

  • LLM: OpenAI GPT-4o-mini
  • Embeddings: OpenAI text-embedding-3-small
  • Vector DB: FAISS (CPU)
  • Orchestration: LangChain + LangGraph
  • Voice: LiveKit (Deepgram STT, Cartesia TTS)
  • APIs: WeatherAPI.com, ExchangeRate-API.com

πŸ“š Project Structure

soffotech-rag-agent/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ agent.py                    # LiveKit voice agent entry point
β”‚   β”œβ”€β”€ multi_agent_rag.py          # LangGraph multi-agent orchestrator
β”‚   β”œβ”€β”€ rag_system.py               # RAG pipeline (FAISS + embeddings)
β”‚   β”œβ”€β”€ dynamic_tools.py            # Real-time API tools
β”‚   └── __init__.py
β”œβ”€β”€ documents/                       # Knowledge base (5 docs, 80+ pages)
β”‚   β”œβ”€β”€ artificial_intelligence_guide.txt
β”‚   β”œβ”€β”€ climate_change_report.txt
β”‚   β”œβ”€β”€ world_history_modern.txt
β”‚   β”œβ”€β”€ blockchain_technology.txt
β”‚   └── health_wellness_guide.txt
β”œβ”€β”€ vector_store/                    # FAISS index (auto-generated)
β”œβ”€β”€ tests/
β”‚   └── test_agent.py
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ livekit.toml
β”œβ”€β”€ .env.example                    # Environment template
β”œβ”€β”€ PROJECT_README.md               # Detailed technical documentation
β”œβ”€β”€ Soffotech_RAG_Voice_Agent_Demo.ipynb  # Google Colab demo
β”œβ”€β”€ LICENSE
└── README.md                       # This file

πŸ§ͺ Testing

Test RAG System

python -c "from src.rag_system import get_rag_system; rag = get_rag_system(); print(rag.retrieve('What is deep learning?'))"

Test Weather Tool

python -c "from src.dynamic_tools import get_current_weather; print(get_current_weather.invoke({'city': 'Dhaka'}))"

Test Multi-Agent System

python src/multi_agent_rag.py

Run Unit Tests

pytest tests/

πŸ“– Documentation

πŸ”’ Security

  • API keys stored in .env.local (never committed)
  • Docker runs as non-privileged user
  • Input sanitization for all queries
  • HTTPS/TLS for LiveKit connections

🀝 Contributing

This is an assessment project. For questions or suggestions, please open an issue.

πŸ“„ License

MIT License - See LICENSE file for details

πŸ‘€ Author

George Tonmoy Roy
Soffotech Technical Assessment - November 2025

πŸ™ Acknowledgments


⭐ Star this repo if you find it helpful!

About

A sophisticated voice-enabled AI agent combining Retrieval-Augmented Generation (RAG), multi-agent orchestration, and real-time function calling for intelligent document Q&A and dynamic information retrieval.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors