🚀 UltraRAG - Complete Unified Package
The ONLY RAG package you need!
✅ Revolutionary RAG engine
✅ Built-in Ollama integration
✅ Built-in FastAPI + Swagger UI
✅ ONE command to start!
✅ Zero configuration needed!
🎯 Quick Start (2 Commands!)
Step 1: Install
pip install ultrarag[server]
Step 2: Start Server
ultrarag serve --ollama-host localhost --ollama-model llama3.2
Open Swagger UI:
http://localhost:8000/docs
🎉 DONE! RAG chatbot ready!
📚 Three Ways to Use
Method 1: Web Server (with Swagger UI)
# Start server
ultrarag serve --ollama-host localhost --ollama-model llama3.2
# Open browser → http://localhost:8000/docs
# Upload documents, ask questions via Swagger!
Method 2: Python Code (Simple)
from ultrarag import RAG
# Create RAG
rag = RAG()
# Add document
rag.add("Python is a programming language created by Guido van Rossum.")
# Ask question
answer = rag.ask("Who created Python?")
print(answer)
# Output: "Python is a programming language created by Guido van Rossum."
Method 3: Python Code (with Ollama)
from ultrarag import RAG, OllamaLLM
# Initialize Ollama
llm = OllamaLLM(host="localhost", port=11434, model="llama3.2")
# Create RAG
rag = RAG()
# Add document
rag.add("Python is used for AI, web development, and data science.")
# Get context
query = "What is Python used for?"
query_analysis = rag.query_processor.analyze(query)
chunks = rag.retriever.retrieve(rag.chunks, query_analysis, top_k=3)
context = " ".join([c.text for c in chunks])
# Generate with LLM
prompt = f"Based on: {context}\n\nQuestion: {query}\n\nAnswer:"
answer = llm.generate(prompt)
print(answer)
🎯 Complete Example (CLI Server)
Prerequisites
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Start Ollama
ollama serve
# Pull model (in another terminal)
ollama pull llama3.2
Install UltraRAG
pip install ultrarag[server]
Start Server
ultrarag serve --ollama-host localhost --ollama-model llama3.2
Output:
🚀 Starting UltraRAG Server...
📡 Ollama: localhost:11434
🤖 Model: llama3.2
📚 Swagger UI: http://localhost:8000/docs
Use Swagger UI
-
Open:
http://localhost:8000/docs -
Upload document:
- Click
POST /upload - Choose file
- Execute
- Click
-
Ask question:
- Click
POST /query - Enter:
{ "question": "Your question?", "use_llm": true }
- Execute
- Click
-
Get answer! ✅
🔧 Configuration Options
Server Command
ultrarag serve \
--ollama-host localhost \ # Ollama IP
--ollama-port 11434 \ # Ollama port
--ollama-model llama3.2 \ # Model name
--port 8000 # Server port
Different Ollama Machine
ultrarag serve --ollama-host 192.168.1.100 --ollama-model llama3.2
📊 API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/docs |
GET | Swagger UI |
/upload |
POST | Upload file |
/upload-text |
POST | Upload text |
/query |
POST | Ask question |
/stats |
GET | Statistics |
/clear |
DELETE | Clear documents |
💻 Python API
Basic Usage
from ultrarag import RAG
rag = RAG()
rag.add("document text...")
answer = rag.ask("question?")
With Ollama
from ultrarag import RAG, OllamaLLM
llm = OllamaLLM(host="localhost", model="llama3.2")
rag = RAG()
# Test Ollama
if llm.test():
print("✅ Ollama connected")
else:
print("❌ Ollama not available")
# Add documents
rag.add("Your documents...")
# Generate answer
chunks = rag.retriever.retrieve(rag.chunks, query_analysis, top_k=3)
context = " ".join([c.text for c in chunks])
answer = llm.generate(f"Context: {context}\n\nQuestion: {question}")
Advanced Usage
# Custom configuration
rag = RAG(
min_chunk_completeness=0.85,
min_grounding_score=0.85
)
# Add with metadata
rag.add("text...", metadata={"source": "doc1.pdf"})
# Detailed response
response = rag.ask("question?", explain=True)
print(f"Answer: {response.answer}")
print(f"Confidence: {response.confidence}")
print(f"Grounding: {response.grounding_score}")
print(f"Verdict: {response.metadata['verdict']}")
# Statistics
stats = rag.get_stats()
print(f"Total chunks: {stats['total_chunks']}")
🎯 Installation Options
Minimal (RAG only)
pip install ultrarag
Use in Python code only (no web server)
Full (RAG + Web Server)
pip install ultrarag[server]
Includes FastAPI + Swagger UI
From Source
git clone https://github.com/kumar123ips/ultrarag
cd ultrarag
pip install -e .[server]
🔥 Features
Revolutionary RAG Components
✅ AtomicChunk - Guaranteed completeness (ICS ≥ 0.75)
✅ QueryDNA - Multi-dimensional query analysis
✅ AdaptiveRetriever - Intent-based retrieval
✅ ProvenAnswer - Mathematical validation
✅ Zero Dependencies - Core package is pure Python!
Built-in Integrations
✅ Ollama - Local LLM support
✅ FastAPI - Production web server
✅ Swagger UI - Interactive API docs
✅ CLI - One command to start!
📝 License
MIT License - see LICENSE
👤 Author
Abhishek Kumar
Email: ipsabhi420@gmail.com
GitHub: @kumar123ips
🎉 Success!
The ONLY RAG package you need!
pip install ultrarag[server]
ultrarag serve --ollama-model llama3.2
That's it! 🚀
Made with ❤️ by Abhishek Kumar
Metadata
Release files for ultrarag 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ultrarag-1.0.0.tar.gz | 10.2 kB | Without provenance | Details for ultrarag-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ultrarag-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for ultrarag-1.0.0-py3-none-any.whl |
Total release size: 20.5 kB
Release files / ultrarag-1.0.0.tar.gz
| Download URL | ultrarag-1.0.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0af3e0d6007efa265e449be13f53bf3b84c8e19dacaad5c747dfae6cf0b5b5ca
|
|
BLAKE2b-256 checksum How to use checksums |
c4e46461e0c67e5790cc9077a9b74b668f802dd1205281c48cff88365d600252
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.2
|
Release files / ultrarag-1.0.0-py3-none-any.whl
| Download URL | ultrarag-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4337c89cebeb81c9a23c405c1fbbf9c1e2ebdb11c0e70c06b5767fe6c8ea1cb6
|
|
BLAKE2b-256 checksum How to use checksums |
314f8ecaafbf94b01fddc89cc15b1829173bae3eec0665ae78ca64bf2203bf60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.2
|
Security for ultrarag 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.