Self-improving retrieval orchestration framework with RL-based routing, conditional graph activation, and evaluation-driven learning.
Project description
adaptive-intelligence
Self-improving retrieval orchestration framework. Drop documents, ask questions, the system learns how to retrieve better over time.
Install
pip install adaptive-intelligence
pip install adaptive-intelligence[pdf]
pip install adaptive-intelligence[sql]
pip install adaptive-intelligence[all]
Quick Start
from adaptive_intelligence import AdaptiveAI
engine = AdaptiveAI()
engine.ingest("./documents")
response = engine.ask("What are the key risks?")
print(response.answer)
print(f"Confidence: {response.confidence:.0%}")
Comparison
| S.No. | Capability | Traditional RAG | GraphRAG | Adaptive Intelligence |
|---|---|---|---|---|
| 1 | Retrieval | Static vector | Always graph | RL-learned per query |
| 2 | Graph | None | Always on | Conditional (5-signal gate) |
| 3 | Learning | None | None | Improves every query |
| 4 | Evaluation | None | None | 6 metrics per response |
| 5 | Vector DB | Required | Required | Optional (vectorless mode) |
| 6 | Output | Text only | Text only | JSON, CSV, YAML, DataFrame |
| 7 | Feedback | None | None | Thumbs up/down updates RL |
| 8 | Reranking | None | None | Cross-encoder re-scoring |
| 9 | Complex queries | Single retrieval | Single retrieval | Multi-query decomposition |
| 10 | Domain warmup | Manual tuning | Manual tuning | Pre-trained policies (skip warmup) |
| 11 | LLM agnostic | Usually one | Usually one | 10+ providers |
| 12 | Crash recovery | None | Partial | Full auto-checkpoint |
Results (20 queries, same LLM, same corpus)
| S.No. | Query type | Traditional RAG | Adaptive Intelligence | Delta |
|---|---|---|---|---|
| 1 | Factual | 85% | 90% | +5% |
| 2 | Relational | 45% | 78% | +33% |
| 3 | Analytical | 55% | 75% | +20% |
| 4 | Comparative | 50% | 80% | +30% |
| 5 | Multi-hop | 35% | 72% | +37% |
| 6 | Overall | 54% | 79% | +25% |
Version Evolution
| S.No. | Feature | v1 | v2 | v3 (current) |
|---|---|---|---|---|
| 1 | RL algorithm | Thompson Sampling | + configurable warmup | + PPO option |
| 2 | Graph | 5-signal gate + BFS | + persistence | + pre-trained policies |
| 3 | Evaluation | 6 metrics | + user feedback | + A/B testing |
| 4 | Ingestion | Basic | Hardened (every edge case) | Same |
| 5 | SQL connector | No | PostgreSQL, MySQL, SQLite | Same |
| 6 | Vectorless mode | No | Page BM25 + graph + RL | Same |
| 7 | Output formats | Text only | JSON, CSV, YAML, DataFrame | Same |
| 8 | Reranking | No | No | Cross-encoder re-scoring |
| 9 | Multi-query | No | No | Auto-decompose complex queries |
| 10 | Pre-trained policies | No | No | Financial, legal, healthcare |
| 11 | Transfer learning | No | No | Export/import policies |
| 12 | A/B testing | No | No | Compare two policies |
| 13 | Crash recovery | Partial | Full auto-checkpoint | Same |
| 14 | Providers | 3 | 10+ | Same |
| 15 | System prompt | No | Custom | Same |
All Features
RL + Retrieval
# Default: Thompson Sampling
engine = AdaptiveAI()
# PPO algorithm
engine = AdaptiveAI(rl_algorithm="ppo")
# Cross-encoder reranking
engine = AdaptiveAI(reranking=True)
# Pre-trained policy (skip warmup)
engine = AdaptiveAI(domain="financial", pretrained_policy=True)
# Transfer learning
engine.export_policy("my_policy.json")
other_engine.import_policy("my_policy.json")
# A/B testing
engine.enable_ab_test(policy_a="thompson", policy_b="ppo")
print(engine.ab_results())
Vectorless Mode
engine = AdaptiveAI(vectorless=True)
# No ChromaDB. No embeddings. Pure BM25 + graph + RL.
# Page-number citations. Zero dependencies.
Output Formats
response = engine.ask("Extract vendors", output_format="json")
response = engine.ask("List items", output_format="csv")
response = engine.ask("Show data", output_format="dataframe")
response = engine.ask("Details", output_format="json",
schema={"vendor": "str", "amount": "float"})
User Feedback
engine.feedback(response.query_id, "good")
engine.feedback(response.query_id, "bad", reason="Missing data")
SQL Connector
engine.ingest("sqlite:///data.db")
engine.ingest("postgresql://user:pass@host/db", tables=["orders"])
Incremental Ingestion
engine.ingest("./new_file.pdf")
engine.remove("old_file.pdf")
engine.update("./changed_file.pdf")
engine.ingest("./docs/", parallel=True, workers=4)
System Prompt
engine = AdaptiveAI(system_prompt="You are a financial analyst.")
response = engine.ask("Risks?", system_prompt="Rate each HIGH/MEDIUM/LOW.")
engine.set_system_prompt("You are a legal reviewer.")
Providers — Copy, Paste, Run
Free
engine = AdaptiveAI() # Ollama (default, local)
engine = AdaptiveAI(llm_model="llama3.2") # Ollama specific model
engine = AdaptiveAI(api_key="nvapi-...",
base_url="https://integrate.api.nvidia.com/v1",
llm_model="meta/llama-3.1-70b-instruct") # NVIDIA NIM
engine = AdaptiveAI(api_key="gsk_...",
base_url="https://api.groq.com/openai/v1",
llm_model="llama-3.3-70b-versatile") # Groq
engine = AdaptiveAI(llm_backend="huggingface",
llm_model="Qwen/Qwen2.5-1.5B-Instruct") # HuggingFace local
Paid
engine = AdaptiveAI(api_key="sk-...", llm_model="gpt-4o") # OpenAI
engine = AdaptiveAI(api_key="xai-...",
base_url="https://api.x.ai/v1", llm_model="grok-3-mini") # Grok
No LLM
engine = AdaptiveAI(llm_backend="none") # Retrieval only
engine = AdaptiveAI(llm_backend="none", vectorless=True) # Zero dependencies
Supported Formats
| S.No. | Format | Extension |
|---|---|---|
| 1 | Text / Markdown | .txt, .md |
| 2 | CSV / TSV | .csv, .tsv |
| 3 | JSON | .json |
| 4 | HTML / XML | .html, .xml |
| 5 | ||
| 6 | Word | .docx |
| 7 | Excel | .xlsx |
| 8 | PowerPoint | .pptx |
| 9 | Images (OCR) | .png, .jpg |
| 10 | SQL databases | PostgreSQL, MySQL, SQLite |
FAQ
Q: How is this different from ChatGPT / Claude? This is not an LLM. It's the retrieval layer that decides what context to feed TO the LLM. Works with any LLM as backend.
Q: What is vectorless mode? No ChromaDB, no embeddings, no vector DB. Pure BM25 keyword search + graph + RL. Best for documents with standardized terminology or air-gapped environments.
Q: Does the RL policy persist? Yes. Everything persists to disk with auto-checkpoint every 5 minutes.
Q: Can I use it without an LLM?
Yes. AdaptiveAI(llm_backend="none") returns ranked source excerpts directly.
Also by the Author
- llmevalkit — 61 metrics for LLM evaluation
- Responsible AI Series — HIPAA, GDPR, NIST AI RMF, CoSAI
Citation
@article{venkatkumar2026adaptive,
title={Adaptive Retrieval Orchestration for Self-Learning Knowledge Systems},
author={Venkatkumar, Rajan},
year={2026},
url={https://www.researchgate.net/publication/405076088}
}
License
Apache License 2.0
Author
Venkatkumar Rajan
- LinkedIn: https://linkedin.com/in/venkatkumarvk
- GitHub: https://github.com/VK-Ant
- Portfolio: https://vk-ant.github.io/Venkatkumar/
- PyPI: https://pypi.org/project/adaptive-intelligence/
- ResearchGate: https://www.researchgate.net/publication/405076088
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file adaptive_intelligence-3.0.0.tar.gz.
File metadata
- Download URL: adaptive_intelligence-3.0.0.tar.gz
- Upload date:
- Size: 79.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d4e7bec37c2bb61604e4da3039aad46760da1833f556139272e05d23b7bbee1
|
|
| MD5 |
9fcfadd50e7cf09c44890487883b8153
|
|
| BLAKE2b-256 |
cf518825578748c44e15152b94594d77ce6705608fe8668158435f27edc1ed9f
|
File details
Details for the file adaptive_intelligence-3.0.0-py3-none-any.whl.
File metadata
- Download URL: adaptive_intelligence-3.0.0-py3-none-any.whl
- Upload date:
- Size: 79.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc9f8c6de7c5a24b8889fc0730d44934cee295813d6394d4050fd4389bcad0a3
|
|
| MD5 |
b12f0630550f86aaf12d790dcfdaac4e
|
|
| BLAKE2b-256 |
ea5b60b18d50f9f3ec16fe51e0f7bd1f2ccc9954913d829920bb8de22ff6859b
|