Catalog PyPI
PACKAGE EXPLORERView in registry

adaptive-rag-engine

PyPI

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
Versions collected1
Direct dependencies17From release 1.0.1
Last observed20 Oct, 19:07 UTC

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.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.14 Aug 202617

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

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:ad22e26be2a30aac86b2fc76f4b9c0d457a3fce8655c2010cf1e8e93dd3efe18