Catalog PyPI
Back to packageRELEASE DETAILS

1.0.1

PyPI

adaptive-rag-engine

Adaptive Retrieval-Augmented Generation (RAG) Engine with Hybrid Retrieval, LangChain, Cross-Encoder Reranking, FAISS Vector Search, Gemini LLM Integration and FastAPI.

adaptive-ragaibm25cross-encoderfaissfastapigeminiinformation-retrievallangchainllmnlpragretrievalsemantic-searchvector-search
Published4 Aug 2026
Direct dependencies17
Transitive dependenciesNot calculated

README

Version 1.0.1 documentation

Adaptive RAG Engine

Production-ready Adaptive Retrieval-Augmented Generation (Adaptive RAG) Engine built using FastAPI, LangChain, FAISS, SentenceTransformers, BM25, Cross-Encoder Reranking and Google Gemini.

Python FastAPI LangChain FAISS License


Overview

Adaptive RAG Engine is a modular Retrieval-Augmented Generation framework designed to improve retrieval quality through adaptive query routing, hybrid retrieval, reciprocal rank fusion (RRF), cross-encoder reranking, confidence estimation, and optimized context construction before passing relevant information to a Large Language Model (LLM).

Unlike conventional RAG systems that rely on a single retrieval strategy, Adaptive RAG dynamically selects Dense, Sparse, or Hybrid Retrieval based on query analysis to improve retrieval precision while maintaining low latency.


Key Features

  • Adaptive Query Analysis
  • Intelligent Query Routing
  • Dense Retrieval (SentenceTransformers)
  • Sparse Retrieval (BM25)
  • Hybrid Retrieval
  • Reciprocal Rank Fusion (RRF)
  • Cross-Encoder Re-ranking
  • Confidence Estimation
  • Context Optimization
  • LangChain Retriever
  • FastAPI REST API
  • FAISS Vector Database
  • Google Gemini Integration
  • Modular Production Architecture
  • Docker Ready
  • PyPI Ready

System Architecture

flowchart TD

A[User Query]

A --> B[FastAPI REST API]

B --> C[Adaptive RAG Pipeline]

C --> D[Query Analyzer]

D --> E[Adaptive Query Router]

E -->|Semantic Query| F[Dense Retriever]

E -->|Keyword Query| G[BM25 Retriever]

E -->|Mixed Query| H[Hybrid Retrieval]

F --> I[SentenceTransformer Embeddings]

I --> J[FAISS Vector Store]

G --> K[BM25 Index]

J --> H

K --> H

H --> L[Reciprocal Rank Fusion]

L --> M[Cross Encoder Reranker]

M --> N[Confidence Estimator]

N --> O[Context Optimizer]

O --> P[LangChain Retriever Adapter]

P --> Q[Prompt Builder]

Q --> R[Gemini LLM]

R --> S[Generated Answer]

S --> T[FastAPI Response]

Retrieval Pipeline

User Query

↓

FastAPI REST API

↓

Query Analyzer

↓

Adaptive Query Router

↓

Dense Retriever (MiniLM)

BM25 Retriever

↓

Hybrid Retriever

↓

RRF Fusion

↓

Cross Encoder Reranker

↓

Confidence Estimator

↓

Context Optimizer

↓

LangChain Retriever

↓

Prompt Builder

↓

Gemini

↓

Generated Response


Technology Stack

CategoryTechnologies
BackendFastAPI
LLMGoogle Gemini
FrameworkLangChain
Vector SearchFAISS
EmbeddingsSentenceTransformers
Sparse RetrievalBM25
RerankingCross Encoder
Programming LanguagePython
PackagingDocker, PyPI

Project Structure

app/
src/
tests/
docs/
data/
logs/

Installation

git clone ...
cd adaptive-rag-engine

pip install -r requirements.txt

Environment Variables

GEMINI_API_KEY=

GEMINI_MODEL=

HF_TOKEN=

Running

uvicorn app.main:app --reload

API

POST /rag/ask

Example

{
  "question":"Explain Retrieval Augmented Generation."
}

Docker

docker build -t adaptive-rag-engine .

docker run -p 8000:8000 adaptive-rag-engine

PyPI

pip install adaptive-rag-engine

Future Scope

  • Redis Cache
  • Streaming Responses
  • Multi-modal Retrieval
  • Kubernetes Deployment
  • Multi-Agent RAG
  • GraphRAG
  • Knowledge Graph Integration

License

MIT License

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 17

Native requirements
17 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
fastapi
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
fastapi>=0.141.1runtime
uvicorn
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
uvicorn>=0.52.1runtime
google-genai
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
google-genai>=2.16.0runtime
sentence-transformers
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
sentence-transformers>=5.6.1runtime
transformers
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
transformers>=5.14.1runtime
torch
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
torch>=2.13.0runtime
faiss-cpu
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
faiss-cpu>=1.15.0runtime
rank-bm25
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
rank-bm25>=0.2.2runtime
langchain-core
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
langchain-core>=1.5.3runtime
langchain-text-splitters
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
langchain-text-splitters>=1.1.2runtime
python-dotenv
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
python-dotenv>=1.2.2runtime
pydantic
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pydantic>=2.13.4runtime
numpy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
numpy>=2.2.6runtime
scikit-learn
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
scikit-learn>=1.7.2runtime
httpx
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
httpx>=0.28.1runtime
requests
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
requests>=2.34.2runtime
tqdm
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
tqdm>=4.70.0runtime

Distribution files

2 collected
adaptive_rag_engine-1.0.1-py3-none-any.whl

bdist_wheel · 35.69 KB · Python py3

Source file
adaptive_rag_engine-1.0.1.tar.gz

sdist · 24.21 KB · Python source

Source file

Repository

ACCESSIBLE
gokul028h/adaptive-rag-engine

Shared repository data · GitHub

License detected in repository
MIT
License branch / ref
main
Last push
4 Aug 2026
Archived
No
Contributor identities
— · partial collection

Public sponsor counts have not been collected. These signals belong to the repository owner.

Downloads & popularity

0count
Gauge · observed snapshots21 Oct 2026
10.50
2026-10-21: 0 · observed 2026-10-21T11:15:06.2332534Z
21 Oct21 Oct

github · 1 observations shown. Missing days are unknown.

View observed values
Date / source periodValueObserved at
2026-10-2102026-10-21T11:15:06.2332534Z

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:07 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:ba5c76eafefa57a2c5fc0dee9bfa7a89864442e5c9d567db34d4f4f83a6a6631

Other collected versions

View all collected versions →