adaptive-intelligence 2.0.0__tar.gz → 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. adaptive_intelligence-3.0.0/PKG-INFO +323 -0
  2. adaptive_intelligence-3.0.0/README.md +259 -0
  3. adaptive_intelligence-3.0.0/adaptive_intelligence/__init__.py +24 -0
  4. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/core/engine.py +92 -23
  5. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/rl/__init__.py +65 -4
  6. adaptive_intelligence-3.0.0/adaptive_intelligence/rl/multi_query.py +114 -0
  7. adaptive_intelligence-3.0.0/adaptive_intelligence/rl/ppo.py +178 -0
  8. adaptive_intelligence-3.0.0/adaptive_intelligence/rl/pretrained.py +84 -0
  9. adaptive_intelligence-3.0.0/adaptive_intelligence/rl/reranker.py +98 -0
  10. adaptive_intelligence-3.0.0/adaptive_intelligence.egg-info/PKG-INFO +323 -0
  11. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence.egg-info/SOURCES.txt +4 -0
  12. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence.egg-info/requires.txt +3 -0
  13. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/pyproject.toml +2 -1
  14. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/tests/test_core.py +1 -1
  15. adaptive_intelligence-2.0.0/PKG-INFO +0 -468
  16. adaptive_intelligence-2.0.0/README.md +0 -406
  17. adaptive_intelligence-2.0.0/adaptive_intelligence/__init__.py +0 -32
  18. adaptive_intelligence-2.0.0/adaptive_intelligence.egg-info/PKG-INFO +0 -468
  19. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/LICENSE +0 -0
  20. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/core/__init__.py +0 -0
  21. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/core/config.py +0 -0
  22. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/core/response.py +0 -0
  23. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/evaluation/__init__.py +0 -0
  24. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/graph/__init__.py +0 -0
  25. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/indexes/__init__.py +0 -0
  26. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/indexes/base.py +0 -0
  27. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/indexes/keyword_index.py +0 -0
  28. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/indexes/page_index.py +0 -0
  29. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/indexes/vector_index.py +0 -0
  30. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/ingestion/__init__.py +0 -0
  31. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/ingestion/chunker.py +0 -0
  32. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/ingestion/engine.py +0 -0
  33. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/ingestion/parser.py +0 -0
  34. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/llm/__init__.py +0 -0
  35. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/memory/__init__.py +0 -0
  36. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/prompts/__init__.py +0 -0
  37. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/query/__init__.py +0 -0
  38. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/security/__init__.py +0 -0
  39. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence/utils/__init__.py +0 -0
  40. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence.egg-info/dependency_links.txt +0 -0
  41. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/adaptive_intelligence.egg-info/top_level.txt +0 -0
  42. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/setup.cfg +0 -0
  43. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/tests/test_evaluation.py +0 -0
  44. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/tests/test_graph.py +0 -0
  45. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/tests/test_ingestion.py +0 -0
  46. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/tests/test_query.py +0 -0
  47. {adaptive_intelligence-2.0.0 → adaptive_intelligence-3.0.0}/tests/test_rl.py +0 -0
@@ -0,0 +1,323 @@
1
+ Metadata-Version: 2.4
2
+ Name: adaptive-intelligence
3
+ Version: 3.0.0
4
+ Summary: Self-improving retrieval orchestration framework with RL-based routing, conditional graph activation, and evaluation-driven learning.
5
+ Author-email: Venkatkumar Rajan <venkatkumarr.vk99@gmail.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://pypi.org/project/adaptive-intelligence/
8
+ Project-URL: Documentation, https://github.com/VK-Ant/adaptive-intelligence#readme
9
+ Project-URL: Repository, https://github.com/VK-Ant/adaptive-intelligence
10
+ Project-URL: Issues, https://github.com/VK-Ant/adaptive-intelligence/issues
11
+ Project-URL: PyPI, https://pypi.org/project/adaptive-intelligence/
12
+ Project-URL: Portfolio, https://vk-ant.github.io/Venkatkumar/
13
+ Keywords: rag,retrieval,reinforcement-learning,knowledge-graph,document-intelligence,adaptive,self-improving,llm,ai,nlp,evaluation,self-learning
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: License :: OSI Approved :: Apache Software License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: chromadb>=0.4.0
29
+ Provides-Extra: openai
30
+ Requires-Dist: openai>=1.0.0; extra == "openai"
31
+ Provides-Extra: groq
32
+ Requires-Dist: openai>=1.0.0; extra == "groq"
33
+ Provides-Extra: pdf
34
+ Requires-Dist: PyMuPDF>=1.23.0; extra == "pdf"
35
+ Provides-Extra: docx
36
+ Requires-Dist: python-docx>=1.0.0; extra == "docx"
37
+ Provides-Extra: xlsx
38
+ Requires-Dist: openpyxl>=3.1.0; extra == "xlsx"
39
+ Provides-Extra: pptx
40
+ Requires-Dist: python-pptx>=0.6.21; extra == "pptx"
41
+ Provides-Extra: sql
42
+ Requires-Dist: sqlalchemy>=2.0.0; extra == "sql"
43
+ Provides-Extra: rerank
44
+ Requires-Dist: sentence-transformers>=2.2.0; extra == "rerank"
45
+ Provides-Extra: ocr
46
+ Requires-Dist: pytesseract>=0.3.10; extra == "ocr"
47
+ Requires-Dist: Pillow>=10.0; extra == "ocr"
48
+ Provides-Extra: huggingface
49
+ Requires-Dist: transformers>=4.35.0; extra == "huggingface"
50
+ Requires-Dist: torch>=2.0.0; extra == "huggingface"
51
+ Provides-Extra: all
52
+ Requires-Dist: PyMuPDF>=1.23.0; extra == "all"
53
+ Requires-Dist: python-docx>=1.0.0; extra == "all"
54
+ Requires-Dist: openpyxl>=3.1.0; extra == "all"
55
+ Requires-Dist: python-pptx>=0.6.21; extra == "all"
56
+ Requires-Dist: pytesseract>=0.3.10; extra == "all"
57
+ Requires-Dist: Pillow>=10.0; extra == "all"
58
+ Provides-Extra: dev
59
+ Requires-Dist: pytest>=7.0; extra == "dev"
60
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
61
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
62
+ Requires-Dist: mypy>=1.5; extra == "dev"
63
+ Dynamic: license-file
64
+
65
+ # adaptive-intelligence
66
+
67
+ Self-improving retrieval orchestration framework. Drop documents, ask questions, the system learns how to retrieve better over time.
68
+
69
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/VK-Ant/adaptive-intelligence/blob/main/notebooks/adaptive_intelligence_v3_demo.ipynb)
70
+
71
+ ## Install
72
+
73
+ ```
74
+ pip install adaptive-intelligence
75
+ pip install adaptive-intelligence[pdf]
76
+ pip install adaptive-intelligence[sql]
77
+ pip install adaptive-intelligence[all]
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Quick Start
83
+
84
+ ```python
85
+ from adaptive_intelligence import AdaptiveAI
86
+
87
+ engine = AdaptiveAI()
88
+ engine.ingest("./documents")
89
+ response = engine.ask("What are the key risks?")
90
+ print(response.answer)
91
+ print(f"Confidence: {response.confidence:.0%}")
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Comparison
97
+
98
+ | S.No. | Capability | Traditional RAG | GraphRAG | Adaptive Intelligence |
99
+ |-------|-----------|----------------|----------|----------------------|
100
+ | 1 | Retrieval | Static vector | Always graph | RL-learned per query |
101
+ | 2 | Graph | None | Always on | Conditional (5-signal gate) |
102
+ | 3 | Learning | None | None | Improves every query |
103
+ | 4 | Evaluation | None | None | 6 metrics per response |
104
+ | 5 | Vector DB | Required | Required | Optional (vectorless mode) |
105
+ | 6 | Output | Text only | Text only | JSON, CSV, YAML, DataFrame |
106
+ | 7 | Feedback | None | None | Thumbs up/down updates RL |
107
+ | 8 | Reranking | None | None | Cross-encoder re-scoring |
108
+ | 9 | Complex queries | Single retrieval | Single retrieval | Multi-query decomposition |
109
+ | 10 | Domain warmup | Manual tuning | Manual tuning | Pre-trained policies (skip warmup) |
110
+ | 11 | LLM agnostic | Usually one | Usually one | 10+ providers |
111
+ | 12 | Crash recovery | None | Partial | Full auto-checkpoint |
112
+
113
+ ## Results (20 queries, same LLM, same corpus)
114
+
115
+ | S.No. | Query type | Traditional RAG | Adaptive Intelligence | Delta |
116
+ |-------|-----------|----------------|----------------------|-------|
117
+ | 1 | Factual | 85% | 90% | +5% |
118
+ | 2 | Relational | 45% | 78% | +33% |
119
+ | 3 | Analytical | 55% | 75% | +20% |
120
+ | 4 | Comparative | 50% | 80% | +30% |
121
+ | 5 | Multi-hop | 35% | 72% | +37% |
122
+ | 6 | **Overall** | **54%** | **79%** | **+25%** |
123
+
124
+ ---
125
+
126
+ ## Version Evolution
127
+
128
+ | S.No. | Feature | v1 | v2 | v3 (current) |
129
+ |-------|---------|----|----|------|
130
+ | 1 | RL algorithm | Thompson Sampling | + configurable warmup | + PPO option |
131
+ | 2 | Graph | 5-signal gate + BFS | + persistence | + pre-trained policies |
132
+ | 3 | Evaluation | 6 metrics | + user feedback | + A/B testing |
133
+ | 4 | Ingestion | Basic | Hardened (every edge case) | Same |
134
+ | 5 | SQL connector | No | PostgreSQL, MySQL, SQLite | Same |
135
+ | 6 | Vectorless mode | No | Page BM25 + graph + RL | Same |
136
+ | 7 | Output formats | Text only | JSON, CSV, YAML, DataFrame | Same |
137
+ | 8 | Reranking | No | No | Cross-encoder re-scoring |
138
+ | 9 | Multi-query | No | No | Auto-decompose complex queries |
139
+ | 10 | Pre-trained policies | No | No | Financial, legal, healthcare |
140
+ | 11 | Transfer learning | No | No | Export/import policies |
141
+ | 12 | A/B testing | No | No | Compare two policies |
142
+ | 13 | Crash recovery | Partial | Full auto-checkpoint | Same |
143
+ | 14 | Providers | 3 | 10+ | Same |
144
+ | 15 | System prompt | No | Custom | Same |
145
+
146
+ ---
147
+
148
+ ## All Features
149
+
150
+ ### RL + Retrieval
151
+
152
+ ```python
153
+ # Default: Thompson Sampling
154
+ engine = AdaptiveAI()
155
+
156
+ # PPO algorithm
157
+ engine = AdaptiveAI(rl_algorithm="ppo")
158
+
159
+ # Cross-encoder reranking
160
+ engine = AdaptiveAI(reranking=True)
161
+
162
+ # Pre-trained policy (skip warmup)
163
+ engine = AdaptiveAI(domain="financial", pretrained_policy=True)
164
+
165
+ # Transfer learning
166
+ engine.export_policy("my_policy.json")
167
+ other_engine.import_policy("my_policy.json")
168
+
169
+ # A/B testing
170
+ engine.enable_ab_test(policy_a="thompson", policy_b="ppo")
171
+ print(engine.ab_results())
172
+ ```
173
+
174
+ ### Vectorless Mode
175
+
176
+ ```python
177
+ engine = AdaptiveAI(vectorless=True)
178
+ # No ChromaDB. No embeddings. Pure BM25 + graph + RL.
179
+ # Page-number citations. Zero dependencies.
180
+ ```
181
+
182
+ ### Output Formats
183
+
184
+ ```python
185
+ response = engine.ask("Extract vendors", output_format="json")
186
+ response = engine.ask("List items", output_format="csv")
187
+ response = engine.ask("Show data", output_format="dataframe")
188
+ response = engine.ask("Details", output_format="json",
189
+ schema={"vendor": "str", "amount": "float"})
190
+ ```
191
+
192
+ ### User Feedback
193
+
194
+ ```python
195
+ engine.feedback(response.query_id, "good")
196
+ engine.feedback(response.query_id, "bad", reason="Missing data")
197
+ ```
198
+
199
+ ### SQL Connector
200
+
201
+ ```python
202
+ engine.ingest("sqlite:///data.db")
203
+ engine.ingest("postgresql://user:pass@host/db", tables=["orders"])
204
+ ```
205
+
206
+ ### Incremental Ingestion
207
+
208
+ ```python
209
+ engine.ingest("./new_file.pdf")
210
+ engine.remove("old_file.pdf")
211
+ engine.update("./changed_file.pdf")
212
+ engine.ingest("./docs/", parallel=True, workers=4)
213
+ ```
214
+
215
+ ### System Prompt
216
+
217
+ ```python
218
+ engine = AdaptiveAI(system_prompt="You are a financial analyst.")
219
+ response = engine.ask("Risks?", system_prompt="Rate each HIGH/MEDIUM/LOW.")
220
+ engine.set_system_prompt("You are a legal reviewer.")
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Providers — Copy, Paste, Run
226
+
227
+ ### Free
228
+
229
+ ```python
230
+ engine = AdaptiveAI() # Ollama (default, local)
231
+ engine = AdaptiveAI(llm_model="llama3.2") # Ollama specific model
232
+
233
+ engine = AdaptiveAI(api_key="nvapi-...",
234
+ base_url="https://integrate.api.nvidia.com/v1",
235
+ llm_model="meta/llama-3.1-70b-instruct") # NVIDIA NIM
236
+
237
+ engine = AdaptiveAI(api_key="gsk_...",
238
+ base_url="https://api.groq.com/openai/v1",
239
+ llm_model="llama-3.3-70b-versatile") # Groq
240
+
241
+ engine = AdaptiveAI(llm_backend="huggingface",
242
+ llm_model="Qwen/Qwen2.5-1.5B-Instruct") # HuggingFace local
243
+ ```
244
+
245
+ ### Paid
246
+
247
+ ```python
248
+ engine = AdaptiveAI(api_key="sk-...", llm_model="gpt-4o") # OpenAI
249
+ engine = AdaptiveAI(api_key="xai-...",
250
+ base_url="https://api.x.ai/v1", llm_model="grok-3-mini") # Grok
251
+ ```
252
+
253
+ ### No LLM
254
+
255
+ ```python
256
+ engine = AdaptiveAI(llm_backend="none") # Retrieval only
257
+ engine = AdaptiveAI(llm_backend="none", vectorless=True) # Zero dependencies
258
+ ```
259
+
260
+ ---
261
+
262
+ ## Supported Formats
263
+
264
+ | S.No. | Format | Extension |
265
+ |-------|--------|-----------|
266
+ | 1 | Text / Markdown | .txt, .md |
267
+ | 2 | CSV / TSV | .csv, .tsv |
268
+ | 3 | JSON | .json |
269
+ | 4 | HTML / XML | .html, .xml |
270
+ | 5 | PDF | .pdf |
271
+ | 6 | Word | .docx |
272
+ | 7 | Excel | .xlsx |
273
+ | 8 | PowerPoint | .pptx |
274
+ | 9 | Images (OCR) | .png, .jpg |
275
+ | 10 | SQL databases | PostgreSQL, MySQL, SQLite |
276
+
277
+ ---
278
+
279
+ ## FAQ
280
+
281
+ **Q: How is this different from ChatGPT / Claude?**
282
+ 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.
283
+
284
+ **Q: What is vectorless mode?**
285
+ No ChromaDB, no embeddings, no vector DB. Pure BM25 keyword search + graph + RL. Best for documents with standardized terminology or air-gapped environments.
286
+
287
+ **Q: Does the RL policy persist?**
288
+ Yes. Everything persists to disk with auto-checkpoint every 5 minutes.
289
+
290
+ **Q: Can I use it without an LLM?**
291
+ Yes. `AdaptiveAI(llm_backend="none")` returns ranked source excerpts directly.
292
+
293
+ ---
294
+
295
+ ## Also by the Author
296
+
297
+ - **[llmevalkit](https://pypi.org/project/llmevalkit/)** — 61 metrics for LLM evaluation
298
+ - **[Responsible AI Series](https://medium.com/@VK_Venkatkumar)** — HIPAA, GDPR, NIST AI RMF, CoSAI
299
+
300
+ ## Citation
301
+
302
+ ```bibtex
303
+ @article{venkatkumar2026adaptive,
304
+ title={Adaptive Retrieval Orchestration for Self-Learning Knowledge Systems},
305
+ author={Venkatkumar, Rajan},
306
+ year={2026},
307
+ url={https://www.researchgate.net/publication/405076088}
308
+ }
309
+ ```
310
+
311
+ ## License
312
+
313
+ Apache License 2.0
314
+
315
+ ## Author
316
+
317
+ Venkatkumar Rajan
318
+
319
+ - LinkedIn: https://linkedin.com/in/venkatkumarvk
320
+ - GitHub: https://github.com/VK-Ant
321
+ - Portfolio: https://vk-ant.github.io/Venkatkumar/
322
+ - PyPI: https://pypi.org/project/adaptive-intelligence/
323
+ - ResearchGate: https://www.researchgate.net/publication/405076088
@@ -0,0 +1,259 @@
1
+ # adaptive-intelligence
2
+
3
+ Self-improving retrieval orchestration framework. Drop documents, ask questions, the system learns how to retrieve better over time.
4
+
5
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/VK-Ant/adaptive-intelligence/blob/main/notebooks/adaptive_intelligence_v3_demo.ipynb)
6
+
7
+ ## Install
8
+
9
+ ```
10
+ pip install adaptive-intelligence
11
+ pip install adaptive-intelligence[pdf]
12
+ pip install adaptive-intelligence[sql]
13
+ pip install adaptive-intelligence[all]
14
+ ```
15
+
16
+ ---
17
+
18
+ ## Quick Start
19
+
20
+ ```python
21
+ from adaptive_intelligence import AdaptiveAI
22
+
23
+ engine = AdaptiveAI()
24
+ engine.ingest("./documents")
25
+ response = engine.ask("What are the key risks?")
26
+ print(response.answer)
27
+ print(f"Confidence: {response.confidence:.0%}")
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Comparison
33
+
34
+ | S.No. | Capability | Traditional RAG | GraphRAG | Adaptive Intelligence |
35
+ |-------|-----------|----------------|----------|----------------------|
36
+ | 1 | Retrieval | Static vector | Always graph | RL-learned per query |
37
+ | 2 | Graph | None | Always on | Conditional (5-signal gate) |
38
+ | 3 | Learning | None | None | Improves every query |
39
+ | 4 | Evaluation | None | None | 6 metrics per response |
40
+ | 5 | Vector DB | Required | Required | Optional (vectorless mode) |
41
+ | 6 | Output | Text only | Text only | JSON, CSV, YAML, DataFrame |
42
+ | 7 | Feedback | None | None | Thumbs up/down updates RL |
43
+ | 8 | Reranking | None | None | Cross-encoder re-scoring |
44
+ | 9 | Complex queries | Single retrieval | Single retrieval | Multi-query decomposition |
45
+ | 10 | Domain warmup | Manual tuning | Manual tuning | Pre-trained policies (skip warmup) |
46
+ | 11 | LLM agnostic | Usually one | Usually one | 10+ providers |
47
+ | 12 | Crash recovery | None | Partial | Full auto-checkpoint |
48
+
49
+ ## Results (20 queries, same LLM, same corpus)
50
+
51
+ | S.No. | Query type | Traditional RAG | Adaptive Intelligence | Delta |
52
+ |-------|-----------|----------------|----------------------|-------|
53
+ | 1 | Factual | 85% | 90% | +5% |
54
+ | 2 | Relational | 45% | 78% | +33% |
55
+ | 3 | Analytical | 55% | 75% | +20% |
56
+ | 4 | Comparative | 50% | 80% | +30% |
57
+ | 5 | Multi-hop | 35% | 72% | +37% |
58
+ | 6 | **Overall** | **54%** | **79%** | **+25%** |
59
+
60
+ ---
61
+
62
+ ## Version Evolution
63
+
64
+ | S.No. | Feature | v1 | v2 | v3 (current) |
65
+ |-------|---------|----|----|------|
66
+ | 1 | RL algorithm | Thompson Sampling | + configurable warmup | + PPO option |
67
+ | 2 | Graph | 5-signal gate + BFS | + persistence | + pre-trained policies |
68
+ | 3 | Evaluation | 6 metrics | + user feedback | + A/B testing |
69
+ | 4 | Ingestion | Basic | Hardened (every edge case) | Same |
70
+ | 5 | SQL connector | No | PostgreSQL, MySQL, SQLite | Same |
71
+ | 6 | Vectorless mode | No | Page BM25 + graph + RL | Same |
72
+ | 7 | Output formats | Text only | JSON, CSV, YAML, DataFrame | Same |
73
+ | 8 | Reranking | No | No | Cross-encoder re-scoring |
74
+ | 9 | Multi-query | No | No | Auto-decompose complex queries |
75
+ | 10 | Pre-trained policies | No | No | Financial, legal, healthcare |
76
+ | 11 | Transfer learning | No | No | Export/import policies |
77
+ | 12 | A/B testing | No | No | Compare two policies |
78
+ | 13 | Crash recovery | Partial | Full auto-checkpoint | Same |
79
+ | 14 | Providers | 3 | 10+ | Same |
80
+ | 15 | System prompt | No | Custom | Same |
81
+
82
+ ---
83
+
84
+ ## All Features
85
+
86
+ ### RL + Retrieval
87
+
88
+ ```python
89
+ # Default: Thompson Sampling
90
+ engine = AdaptiveAI()
91
+
92
+ # PPO algorithm
93
+ engine = AdaptiveAI(rl_algorithm="ppo")
94
+
95
+ # Cross-encoder reranking
96
+ engine = AdaptiveAI(reranking=True)
97
+
98
+ # Pre-trained policy (skip warmup)
99
+ engine = AdaptiveAI(domain="financial", pretrained_policy=True)
100
+
101
+ # Transfer learning
102
+ engine.export_policy("my_policy.json")
103
+ other_engine.import_policy("my_policy.json")
104
+
105
+ # A/B testing
106
+ engine.enable_ab_test(policy_a="thompson", policy_b="ppo")
107
+ print(engine.ab_results())
108
+ ```
109
+
110
+ ### Vectorless Mode
111
+
112
+ ```python
113
+ engine = AdaptiveAI(vectorless=True)
114
+ # No ChromaDB. No embeddings. Pure BM25 + graph + RL.
115
+ # Page-number citations. Zero dependencies.
116
+ ```
117
+
118
+ ### Output Formats
119
+
120
+ ```python
121
+ response = engine.ask("Extract vendors", output_format="json")
122
+ response = engine.ask("List items", output_format="csv")
123
+ response = engine.ask("Show data", output_format="dataframe")
124
+ response = engine.ask("Details", output_format="json",
125
+ schema={"vendor": "str", "amount": "float"})
126
+ ```
127
+
128
+ ### User Feedback
129
+
130
+ ```python
131
+ engine.feedback(response.query_id, "good")
132
+ engine.feedback(response.query_id, "bad", reason="Missing data")
133
+ ```
134
+
135
+ ### SQL Connector
136
+
137
+ ```python
138
+ engine.ingest("sqlite:///data.db")
139
+ engine.ingest("postgresql://user:pass@host/db", tables=["orders"])
140
+ ```
141
+
142
+ ### Incremental Ingestion
143
+
144
+ ```python
145
+ engine.ingest("./new_file.pdf")
146
+ engine.remove("old_file.pdf")
147
+ engine.update("./changed_file.pdf")
148
+ engine.ingest("./docs/", parallel=True, workers=4)
149
+ ```
150
+
151
+ ### System Prompt
152
+
153
+ ```python
154
+ engine = AdaptiveAI(system_prompt="You are a financial analyst.")
155
+ response = engine.ask("Risks?", system_prompt="Rate each HIGH/MEDIUM/LOW.")
156
+ engine.set_system_prompt("You are a legal reviewer.")
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Providers — Copy, Paste, Run
162
+
163
+ ### Free
164
+
165
+ ```python
166
+ engine = AdaptiveAI() # Ollama (default, local)
167
+ engine = AdaptiveAI(llm_model="llama3.2") # Ollama specific model
168
+
169
+ engine = AdaptiveAI(api_key="nvapi-...",
170
+ base_url="https://integrate.api.nvidia.com/v1",
171
+ llm_model="meta/llama-3.1-70b-instruct") # NVIDIA NIM
172
+
173
+ engine = AdaptiveAI(api_key="gsk_...",
174
+ base_url="https://api.groq.com/openai/v1",
175
+ llm_model="llama-3.3-70b-versatile") # Groq
176
+
177
+ engine = AdaptiveAI(llm_backend="huggingface",
178
+ llm_model="Qwen/Qwen2.5-1.5B-Instruct") # HuggingFace local
179
+ ```
180
+
181
+ ### Paid
182
+
183
+ ```python
184
+ engine = AdaptiveAI(api_key="sk-...", llm_model="gpt-4o") # OpenAI
185
+ engine = AdaptiveAI(api_key="xai-...",
186
+ base_url="https://api.x.ai/v1", llm_model="grok-3-mini") # Grok
187
+ ```
188
+
189
+ ### No LLM
190
+
191
+ ```python
192
+ engine = AdaptiveAI(llm_backend="none") # Retrieval only
193
+ engine = AdaptiveAI(llm_backend="none", vectorless=True) # Zero dependencies
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Supported Formats
199
+
200
+ | S.No. | Format | Extension |
201
+ |-------|--------|-----------|
202
+ | 1 | Text / Markdown | .txt, .md |
203
+ | 2 | CSV / TSV | .csv, .tsv |
204
+ | 3 | JSON | .json |
205
+ | 4 | HTML / XML | .html, .xml |
206
+ | 5 | PDF | .pdf |
207
+ | 6 | Word | .docx |
208
+ | 7 | Excel | .xlsx |
209
+ | 8 | PowerPoint | .pptx |
210
+ | 9 | Images (OCR) | .png, .jpg |
211
+ | 10 | SQL databases | PostgreSQL, MySQL, SQLite |
212
+
213
+ ---
214
+
215
+ ## FAQ
216
+
217
+ **Q: How is this different from ChatGPT / Claude?**
218
+ 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.
219
+
220
+ **Q: What is vectorless mode?**
221
+ No ChromaDB, no embeddings, no vector DB. Pure BM25 keyword search + graph + RL. Best for documents with standardized terminology or air-gapped environments.
222
+
223
+ **Q: Does the RL policy persist?**
224
+ Yes. Everything persists to disk with auto-checkpoint every 5 minutes.
225
+
226
+ **Q: Can I use it without an LLM?**
227
+ Yes. `AdaptiveAI(llm_backend="none")` returns ranked source excerpts directly.
228
+
229
+ ---
230
+
231
+ ## Also by the Author
232
+
233
+ - **[llmevalkit](https://pypi.org/project/llmevalkit/)** — 61 metrics for LLM evaluation
234
+ - **[Responsible AI Series](https://medium.com/@VK_Venkatkumar)** — HIPAA, GDPR, NIST AI RMF, CoSAI
235
+
236
+ ## Citation
237
+
238
+ ```bibtex
239
+ @article{venkatkumar2026adaptive,
240
+ title={Adaptive Retrieval Orchestration for Self-Learning Knowledge Systems},
241
+ author={Venkatkumar, Rajan},
242
+ year={2026},
243
+ url={https://www.researchgate.net/publication/405076088}
244
+ }
245
+ ```
246
+
247
+ ## License
248
+
249
+ Apache License 2.0
250
+
251
+ ## Author
252
+
253
+ Venkatkumar Rajan
254
+
255
+ - LinkedIn: https://linkedin.com/in/venkatkumarvk
256
+ - GitHub: https://github.com/VK-Ant
257
+ - Portfolio: https://vk-ant.github.io/Venkatkumar/
258
+ - PyPI: https://pypi.org/project/adaptive-intelligence/
259
+ - ResearchGate: https://www.researchgate.net/publication/405076088
@@ -0,0 +1,24 @@
1
+ """
2
+ Adaptive Intelligence v3 — Self-Improving Retrieval Orchestration Framework
3
+
4
+ v3: PPO/DQN algorithms, cross-encoder reranking, multi-query decomposition,
5
+ pre-trained domain policies, transfer learning, A/B testing.
6
+
7
+ Usage:
8
+ from adaptive_intelligence import AdaptiveAI
9
+
10
+ engine = AdaptiveAI()
11
+ engine.ingest("./documents")
12
+ response = engine.ask("What are the key risks?")
13
+
14
+ # v3: PPO + reranking + pretrained
15
+ engine = AdaptiveAI(rl_algorithm="ppo", reranking=True, pretrained_policy=True)
16
+ """
17
+
18
+ __version__ = "3.0.0"
19
+ __author__ = "Venkatkumar Rajan"
20
+
21
+ from adaptive_intelligence.core.engine import AdaptiveAI
22
+ from adaptive_intelligence.core.response import AdaptiveResponse
23
+
24
+ __all__ = ["AdaptiveAI", "AdaptiveResponse"]