OmniRAG
Intelligent Retrieval-Augmented Generation with Multi-Language Support and Voice Interface
Features • Installation • Quick Start • Documentation • Examples • Contributing
Overview
OmniRAG is a production-ready RAG (Retrieval-Augmented Generation) framework that combines adaptive learning, intelligent tool selection, and native multi-language capabilities. Unlike traditional RAG systems, OmniRAG translates outputs after retrieval, preserving semantic quality while supporting 27+ languages with built-in voice interface.
Key Capabilities
- Adaptive Intelligence: Automatically adjusts response complexity based on user expertise level
- Multi-Language Translation: Native support for 27+ languages including Tamil, Hindi, Spanish, and more
- Voice Interface: Built-in speech-to-text and text-to-speech capabilities
- Intelligent Tool Selection: Automatically chooses between local knowledge base and web search
- Production Ready: Optimized for real-world applications with caching and error handling
Features
Core Features
- 🌊 Liquid RAG: Adapts responses to user expertise (beginner, intermediate, expert)
- 🤖 Agentic RAG: Intelligently selects optimal information sources
- ⛓️ Chain RAG: Decomposes and handles complex multi-part queries
- 📄 Document Processing: Native support for PDF, TXT, JSON, and more
- 🔍 Vector Search: High-performance FAISS-based similarity search
- 💾 Smart Caching: Automatic response caching for improved performance
v2.0 New Features
-
🌍 Post-Retrieval Translation
- Preserves embedding quality by maintaining original language documents
- Significantly more storage efficient than pre-translation approaches
- Supports full language names ("Spanish" vs "es") for better usability
-
🎤 Native Voice Interface
- Built-in speech recognition and synthesis
- No external API dependencies
- Multi-language voice support
- Works offline
-
🔧 Production Enhancements
- UTF-8 encoding support for non-Latin scripts
- Improved error handling and logging
- Comprehensive documentation and examples
Installation
Basic Installation
pip install omnirag
With Voice Input Support
Voice output is enabled by default. For voice input (speech recognition), install additional dependencies:
Windows
pip install pipwin
pipwin install pyaudio
pip install omnirag[voice-input]
macOS
brew install portaudio
pip install omnirag[voice-input]
Linux
sudo apt-get install portaudio19-dev python3-pyaudio
pip install omnirag[voice-input]
From Source
git clone https://github.com/Giri530/omnirag.git
cd omnirag
pip install -e .
Quick Start
Basic Usage
from omnirag import OmniRAG
# Initialize with your preferred model
rag = OmniRAG(model_name="google/flan-t5-small")
# Add documents
rag.add_documents([
"Python is a high-level programming language.",
"It emphasizes code readability and simplicity."
])
# Query the system
result = rag.query("What is Python?")
print(result['answer'])
Multi-Language Translation
from omnirag import OmniRAG
# Initialize with target language
rag = OmniRAG(
model_name="google/flan-t5-small",
output_language="Spanish"
)
# Add English documents
rag.add_documents([
"Artificial Intelligence enables machines to learn from experience.",
"Machine Learning is a subset of AI."
])
# Query in any language, receive Spanish response
result = rag.query("What is AI?")
print(result['answer'])
# Output: "La Inteligencia Artificial permite a las máquinas aprender de la experiencia."
Voice-Enabled RAG
from omnirag import OmniRAG
# Initialize with voice support
rag = OmniRAG(
enable_voice=True,
output_language="Tamil"
)
rag.add_documents(["Quantum computing uses quantum mechanics principles."])
# Text query with spoken response
result = rag.query("Explain quantum computing", speak_answer=True)
# Full voice interaction (requires microphone)
result = rag.voice_query()
Supported Languages
OmniRAG supports 27+ languages with both full names and ISO codes:
Indian Languages: Tamil, Hindi, Telugu, Marathi, Gujarati, Kannada, Malayalam, Punjabi, Bengali
European Languages: Spanish, French, German, Italian, Portuguese, Russian, Polish, Dutch, Turkish
Asian Languages: Chinese (Simplified), Japanese, Korean, Vietnamese, Thai, Indonesian, Malay
Other: Arabic, English
Model Support
Recommended Models
| Model | Parameters | RAM | Speed | Quality | Use Case |
|---|---|---|---|---|---|
google/flan-t5-small |
80M | 0.5GB | ⚡⚡⚡ | ⭐⭐ | Development, Testing |
google/flan-t5-base |
250M | 1GB | ⚡⚡⚡ | ⭐⭐⭐ | Production (Balanced) |
Qwen/Qwen2.5-0.5B-Instruct |
500M | 1GB | ⚡⚡ | ⭐⭐⭐ | High Quality |
Qwen/Qwen2.5-1.5B-Instruct |
1.5B | 2GB | ⚡⚡ | ⭐⭐⭐⭐ | Best Quality |
Qwen/Qwen2.5-3B-Instruct |
3B | 4GB | ⚡ | ⭐⭐⭐⭐⭐ | Maximum Quality |
Advanced Configuration
rag = OmniRAG(
model_name="google/flan-t5-base", # LLM model
embedding_model="all-MiniLM-L6-v2", # Embedding model
enable_web_search=True, # Enable web search
output_language="Tamil", # Target language
enable_voice=True, # Voice interface
use_4bit=False, # 4-bit quantization
verbose=True # Debug logging
)
Examples
Document Q&A System
# Load documents from various sources
rag.load_from_file("company_handbook.pdf")
rag.load_from_folder("./policy_documents")
# Query with automatic source attribution
result = rag.query("What is the remote work policy?")
print(f"Answer: {result['answer']}")
print(f"Sources: {result['sources']}")
Multi-Language Customer Support
# Initialize for Hindi-speaking users
support_rag = OmniRAG(
output_language="Hindi",
enable_voice=True
)
support_rag.load_from_file("product_manual.pdf")
# Customer query with voice response
result = support_rag.query(
"How do I reset my password?",
speak_answer=True
)
Educational Assistant
# Initialize for students
edu_rag = OmniRAG(model_name="google/flan-t5-base")
edu_rag.load_from_file("physics_textbook.pdf")
# Automatically adapts to user level
beginner_result = rag.query("Explain photosynthesis") # Simple explanation
expert_result = rag.query("Explain quantum entanglement") # Technical detail
Complex Query Handling
# Automatically decomposes complex queries
result = rag.query("""
Compare the advantages and disadvantages of solar and wind energy.
Which is more cost-effective for residential use?
What are the environmental impacts of each?
""")
API Reference
Core Methods
__init__(**kwargs)
Initialize OmniRAG with configuration parameters.
Parameters:
model_name(str): HuggingFace model identifierembedding_model(str): Sentence transformer modelenable_web_search(bool): Enable web search capabilityoutput_language(str): Target language for responsesenable_voice(bool): Enable voice interfaceuse_4bit(bool): Use 4-bit quantization for memory efficiencyverbose(bool): Enable detailed logging
query(user_query, output_language=None, speak_answer=False)
Submit a query to the RAG system.
Parameters:
user_query(str): The question or promptoutput_language(str, optional): Override default output languagespeak_answer(bool): Enable voice response
Returns: Dictionary containing:
answer(str): Generated responsesources(list): Retrieved source documentsuser_level(str): Detected expertise leveloutput_language(str): Language code of response
add_documents(documents)
Add documents to the knowledge base.
Parameters:
documents(list): List of text strings or file paths
load_from_file(file_path, chunk_size=None)
Load and process a document file.
Parameters:
file_path(str): Path to document filechunk_size(int, optional): Character limit per chunk
voice_query(output_language=None)
Process voice input and provide voice output.
Parameters:
output_language(str, optional): Override default output language
Returns: Same structure as query()
Architecture
┌─────────────┐
│ User Query │
└──────┬──────┘
│
▼
┌─────────────────────┐
│ Liquid Analyzer │ ← Detect user expertise level
└──────┬──────────────┘
│
▼
┌─────────────────────┐
│ Chain Decomposer │ ← Break complex queries
└──────┬──────────────┘
│
▼
┌─────────────────────┐
│ Agentic Planner │ ← Select tools (Vector DB / Web)
└──────┬──────────────┘
│
▼
┌─────────────────────┐
│ Information │
│ Retrieval │ ← Fetch relevant chunks
└──────┬──────────────┘
│
▼
┌─────────────────────┐
│ Content │
│ Transformation │ ← Adapt to user level
└──────┬──────────────┘
│
▼
┌─────────────────────┐
│ LLM Generation │ ← Generate response
└──────┬──────────────┘
│
▼
┌─────────────────────┐
│ Smart Translator │ ← Translate (if needed)
└──────┬──────────────┘
│
▼
┌─────────────────────┐
│ Voice Processor │ ← Synthesize speech (if enabled)
└──────┬──────────────┘
│
▼
┌─────────────┐
│ Response │
└─────────────┘
Use Cases
Enterprise Applications
- Customer Support: Multi-language support with voice interface
- Internal Knowledge Base: Quick access to company documentation
- Training Systems: Adaptive content delivery based on employee expertise
Education
- Study Assistants: Personalized explanations for students
- Language Learning: Cross-language practice and translation
- Accessibility: Voice interface for visually impaired students
Research
- Literature Review: Query across multiple papers and documents
- Data Analysis: Natural language interface to research data
- Collaborative Tools: Multi-language research team support
Performance Optimization
Memory Management
# Use 4-bit quantization for large models
rag = OmniRAG(
model_name="Qwen/Qwen2.5-3B-Instruct",
use_4bit=True # Reduces memory usage by ~75%
)
Caching
# Automatic caching of frequent queries
result1 = rag.query("What is Python?") # ~2s
result2 = rag.query("What is Python?") # <10ms (from cache)
# Clear cache when needed
rag.clear_cache()
Batch Processing
questions = [
"What is machine learning?",
"What is deep learning?",
"What is neural network?"
]
results = [rag.query(q) for q in questions]
Comparison with Other Frameworks
| Feature | LangChain | LlamaIndex | OmniRAG |
|---|---|---|---|
| Built-in Translation* | ❌ | ❌ | ✅ |
| Built-in Voice I/O* | ❌ | ❌ | ✅ |
| Adaptive Responses | ⚠️ Manual | ⚠️ Manual | ✅ Auto |
| Indian Languages | ⚠️ External | ⚠️ External | ✅ Native |
| Beginner Friendly | ⚠️ Complex | ⚠️ Complex | ✅ Simple |
| Open Source | ✅ | ✅ | ✅ |
| Free to Use | ✅ | ✅ | ✅ |
* Built-in = Native implementation without external APIs or services
Troubleshooting
Common Issues
Import Errors
# Ensure proper installation
pip install --upgrade omnirag
# Verify installation
python -c "from omnirag import OmniRAG; print('Success!')"
Voice Input Issues
# Windows
pipwin install pyaudio
# macOS
brew install portaudio && pip install pyaudio
# Linux
sudo apt-get install portaudio19-dev python3-pyaudio
Out of Memory
# Use smaller model or enable quantization
rag = OmniRAG(
model_name="google/flan-t5-small", # Smaller model
use_4bit=True # Enable quantization
)
Contributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
git clone https://github.com/Giri530/omnirag.git
cd omnirag
pip install -e ".[dev]"
pytest tests/ # Run tests
License
This project is licensed under the MIT License - see the LICENSE file for details.
Citation
If you use OmniRAG in your research or project, please cite:
@software{omnirag2025,
title={OmniRAG: Intelligent Multi-Language RAG Framework},
author={Girinath V},
year={2025},
version={2.0.0},
url={https://github.com/Giri530/omnirag},
license={MIT}
}
Acknowledgments
Built with these excellent open-source projects:
- Transformers by Hugging Face
- FAISS by Meta Research
- Sentence Transformers by UKP Lab
- Deep Translator
- pyttsx3
Support
- Documentation: Complete Guide (PDF)
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: girinathv48@gmail.com
Roadmap
v2.0 (Current)
- ✅ Multi-language translation
- ✅ Voice interface
- ✅ UTF-8 support
v2.1 (Planned)
- DOCX and XLSX support
- Custom translation models
- Voice language selection
- Web UI
v3.0 (Future)
- Multi-modal support (images, audio)
- Real-time translation
- Cloud deployment templates
- REST API server
Made with ❤️ by Girinath V
Metadata
Release files for omnirag 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| omnirag-2.0.3.tar.gz | 23.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| omnirag-2.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.2 kB
Release files / omnirag-2.0.3.tar.gz
| Download URL | omnirag-2.0.3.tar.gz |
|---|---|
| Size | 23.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1acd0dd0e06ec7dc4434b1b9acb68c7f3c4be4b0089ce124f9707d7458168bf0
|
|
BLAKE2b-256 checksum How to use checksums |
45e36ad802d41ef622c6e919c2b5054302b630f82aa35ade87e5530579e69dbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / omnirag-2.0.3-py3-none-any.whl
| Download URL | omnirag-2.0.3-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a79005bd85d6ce4fed6df30019871cc85950e0c1a1e99cb9ecb0db55f824e535
|
|
BLAKE2b-256 checksum How to use checksums |
523f7943691e12d67d9948a6b4d0171eacc0660bbb9847dee6d82afcf415cfe7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|