A end-to-end conversational system that accepts voice input, transcribes it, retrieves relevant context from a vector database, and generates grounded answers using a large language model.
Python
0
9 commits
updated Jan 25, 2026
A end-to-end conversational system that accepts voice input, transcribes it, retrieves relevant context from a vector database, and generates grounded answers using a large language model.
This project implements a Retrieval-Augmented Generation (RAG) pipeline with voice as the primary input modality. The system is designed to answer questions about specific topics (e.g., Wikipedia articles) by combining:
┌─────────────┐
│ Audio File │
└──────┬──────┘
│
▼
┌──────────────────┐
│ ASR (FastAPI) │
│ Indic-Conformer │
└──────┬───────────┘
│
▼
┌──────────────────────┐
│ Translation Layer │
│ (Sarvam API) │
└──────┬───────────────┘
│
▼
┌──────────────────────┐
│ Vector Retrieval │
│ (Chroma DB) │
└──────┬───────────────┘
│
▼
┌──────────────────────┐
│ LLM Query Engine │
│ (GitHub Models) │
└──────┬───────────────┘
│
▼
┌──────────────────────┐
│ Formatted Answer │
│ (Streamlit UI) │
└──────────────────────┘
git clone <your-repo-url>
cd voice-rag-chatbot
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
pip install -r requirements.txt
Copy .env.example to .env and fill in your API keys:
cp .env.example .env
Edit .env:
GITHUB_TOKEN=your_github_models_token
SARVAM_API_KEY=your_sarvam_api_key
ASR_ENDPOINT=http://localhost:8000/transcribe
CHROMA_DB_PATH=./chroma_db
COLLECTION_NAME=wiki_article
Fetch a Wikipedia article for your knowledge base:
python data.py "Apple fruit"
This will:
Apple_fruit.txtSupported Queries: Any topic with a Wikipedia article (e.g., "Machine Learning", "Climate Change", "Ancient Rome")
Other Approaches for WebScraping: BeautifulSoup
Transform the article text into embeddings and build a searchable index:
python vectordb.py Apple_fruit.txt --db-path ./chroma_db --chunk-size 1000
Key Parameters:
--chunk-size: Size of text chunks (1000 chars recommended for semantic coherence, especially for Wikipedia articles)--chunk-overlap: Overlap between chunks (200 chars recommended to preserve context between chunks)--model-name: Embedding model (default: sentence-transformers/all-MiniLM-L6-v2)Why these settings?
Start the FastAPI server for audio transcription:
uvicorn asr:app --host 0.0.0.0 --port 8000
Endpoint: POST http://localhost:8000/transcribe
Supported Languages: Hindi, Tamil, Telugu, Kannada, Malayalam, and more (see Indic-Conformer model)
Launch the Streamlit application:
streamlit run app.py
The UI will open at http://localhost:8501
Usage:
voice-rag-chatbot/
├── app.py # Streamlit UI application
├── asr.py # FastAPI ASR endpoint
├── data.py # Wikipedia article scraping
├── vectordb.py # Vector database creation
├── txt_translate.py # Sarvam translation API wrapper
├── voice_rag_chatbot.py # Main RAG pipeline
├── requirements.txt # Python dependencies
├── .env.example # Environment template
├── .gitignore # Git exclusions
└── README.md # This file
Why Chroma?
Advantages:
Drawbacks:
Alternative Considerations: For production scale, consider Pinecone, Weaviate, or Milvus.
Why this model?
Trade-offs:
Why this model?
Performance Notes:
Why GitHub Models + LLaMA-3.1-8B?
Alternative: Can easily swap for other models (Mistral, Orca, etc.) by changing GITHUB_MODEL env var
Why not translate locally?
The system handles:
| Component | Latency | Notes |
|---|---|---|
| ASR | 0.5-2s | Depends on audio length and model loading |
| Translation | 1-2s | API call over network |
| Vector Retrieval | 50-100ms | In-process, very fast |
| LLM Inference | 2-5s | Depends on answer length |
| Total | 4-10s | Typical end-to-end time |
Optimization Tips:
max_tokens in LLM if latency is criticalProblem: Audio quality varies; background noise affects transcription. Solution:
Problem: LLM may generate plausible-sounding but incorrect answers. Solution:
Problem: User might ask in mixed language or code-switching. Solution:
Problem: Forgetting to regenerate DB after data updates. Solution:
Test ASR alone:
curl -X POST http://localhost:8000/transcribe \
-F "file=@test_audio.wav"
Test Translation:
python txt_translate.py "नमस्ते कैसे हो"
Test Vector DB:
from vectordb import retrieve_chunks
chunks = retrieve_chunks("apple farming")
print(chunks)
Test Full Pipeline:
from voice_rag_chatbot import voice_rag_pipeline
answer = voice_rag_pipeline("path_to_audio.wav")
print(answer)
Use the setup above—perfectly suitable for prototyping.
Containerize with Docker:
FROM python:3.10
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["streamlit", "run", "app.py"]
Deploy ASR separately (GPU-accelerated VM)
Use managed vector DB (Pinecone, Weaviate cloud)
Scale LLM calls with request queuing
Add monitoring (Sentry, CloudWatch, Prometheus)
Solution: Ensure ASR server is running: uvicorn asr:app --port 8000
Solution: Add token to .env file and restart Streamlit app
Solution: Run python vectordb.py your_file.txt first
Solution:
torch.cuda.is_available()chunk_size for faster retrievalThe work uses Claude Opus model for generating documentation assistance and code fixes. All generated content has been reviewed and edited for accuracy.
This project is open-sourced under the MIT License. See LICENSE file for details.
Contributions welcome! Please:
For issues, questions, or suggestions:
Last Updated: January 2026
Python Version: 3.9+
Status: Active Development
A end-to-end conversational system that accepts voice input, transcribes it, retrieves relevant context from a vector database, and generates grounded answers using a large language model.
Python
0
9 commits
updated Jan 25, 2026
A end-to-end conversational system that accepts voice input, transcribes it, retrieves relevant context from a vector database, and generates grounded answers using a large language model.
This project implements a Retrieval-Augmented Generation (RAG) pipeline with voice as the primary input modality. The system is designed to answer questions about specific topics (e.g., Wikipedia articles) by combining:
┌─────────────┐
│ Audio File │
└──────┬──────┘
│
▼
┌──────────────────┐
│ ASR (FastAPI) │
│ Indic-Conformer │
└──────┬───────────┘
│
▼
┌──────────────────────┐
│ Translation Layer │
│ (Sarvam API) │
└──────┬───────────────┘
│
▼
┌──────────────────────┐
│ Vector Retrieval │
│ (Chroma DB) │
└──────┬───────────────┘
│
▼
┌──────────────────────┐
│ LLM Query Engine │
│ (GitHub Models) │
└──────┬───────────────┘
│
▼
┌──────────────────────┐
│ Formatted Answer │
│ (Streamlit UI) │
└──────────────────────┘
git clone <your-repo-url>
cd voice-rag-chatbot
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
pip install -r requirements.txt
Copy .env.example to .env and fill in your API keys:
cp .env.example .env
Edit .env:
GITHUB_TOKEN=your_github_models_token
SARVAM_API_KEY=your_sarvam_api_key
ASR_ENDPOINT=http://localhost:8000/transcribe
CHROMA_DB_PATH=./chroma_db
COLLECTION_NAME=wiki_article
Fetch a Wikipedia article for your knowledge base:
python data.py "Apple fruit"
This will:
Apple_fruit.txtSupported Queries: Any topic with a Wikipedia article (e.g., "Machine Learning", "Climate Change", "Ancient Rome")
Other Approaches for WebScraping: BeautifulSoup
Transform the article text into embeddings and build a searchable index:
python vectordb.py Apple_fruit.txt --db-path ./chroma_db --chunk-size 1000
Key Parameters:
--chunk-size: Size of text chunks (1000 chars recommended for semantic coherence, especially for Wikipedia articles)--chunk-overlap: Overlap between chunks (200 chars recommended to preserve context between chunks)--model-name: Embedding model (default: sentence-transformers/all-MiniLM-L6-v2)Why these settings?
Start the FastAPI server for audio transcription:
uvicorn asr:app --host 0.0.0.0 --port 8000
Endpoint: POST http://localhost:8000/transcribe
Supported Languages: Hindi, Tamil, Telugu, Kannada, Malayalam, and more (see Indic-Conformer model)
Launch the Streamlit application:
streamlit run app.py
The UI will open at http://localhost:8501
Usage:
voice-rag-chatbot/
├── app.py # Streamlit UI application
├── asr.py # FastAPI ASR endpoint
├── data.py # Wikipedia article scraping
├── vectordb.py # Vector database creation
├── txt_translate.py # Sarvam translation API wrapper
├── voice_rag_chatbot.py # Main RAG pipeline
├── requirements.txt # Python dependencies
├── .env.example # Environment template
├── .gitignore # Git exclusions
└── README.md # This file
Why Chroma?
Advantages:
Drawbacks:
Alternative Considerations: For production scale, consider Pinecone, Weaviate, or Milvus.
Why this model?
Trade-offs:
Why this model?
Performance Notes:
Why GitHub Models + LLaMA-3.1-8B?
Alternative: Can easily swap for other models (Mistral, Orca, etc.) by changing GITHUB_MODEL env var
Why not translate locally?
The system handles:
| Component | Latency | Notes |
|---|---|---|
| ASR | 0.5-2s | Depends on audio length and model loading |
| Translation | 1-2s | API call over network |
| Vector Retrieval | 50-100ms | In-process, very fast |
| LLM Inference | 2-5s | Depends on answer length |
| Total | 4-10s | Typical end-to-end time |
Optimization Tips:
max_tokens in LLM if latency is criticalProblem: Audio quality varies; background noise affects transcription. Solution:
Problem: LLM may generate plausible-sounding but incorrect answers. Solution:
Problem: User might ask in mixed language or code-switching. Solution:
Problem: Forgetting to regenerate DB after data updates. Solution:
Test ASR alone:
curl -X POST http://localhost:8000/transcribe \
-F "file=@test_audio.wav"
Test Translation:
python txt_translate.py "नमस्ते कैसे हो"
Test Vector DB:
from vectordb import retrieve_chunks
chunks = retrieve_chunks("apple farming")
print(chunks)
Test Full Pipeline:
from voice_rag_chatbot import voice_rag_pipeline
answer = voice_rag_pipeline("path_to_audio.wav")
print(answer)
Use the setup above—perfectly suitable for prototyping.
Containerize with Docker:
FROM python:3.10
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["streamlit", "run", "app.py"]
Deploy ASR separately (GPU-accelerated VM)
Use managed vector DB (Pinecone, Weaviate cloud)
Scale LLM calls with request queuing
Add monitoring (Sentry, CloudWatch, Prometheus)
Solution: Ensure ASR server is running: uvicorn asr:app --port 8000
Solution: Add token to .env file and restart Streamlit app
Solution: Run python vectordb.py your_file.txt first
Solution:
torch.cuda.is_available()chunk_size for faster retrievalThe work uses Claude Opus model for generating documentation assistance and code fixes. All generated content has been reviewed and edited for accuracy.
This project is open-sourced under the MIT License. See LICENSE file for details.
Contributions welcome! Please:
For issues, questions, or suggestions:
Last Updated: January 2026
Python Version: 3.9+
Status: Active Development