β¨ Adaptive AI assistant with RAG + web search fallback + agentic routing ππ
RAGent is an advanced Adaptive RAG (Retrieval-Augmented Generation) pipeline that intelligently decides how to answer user queries using:
- Internal document retrieval π
- Agentic LLM reasoning π€
- Conditional routing for unknown queries π
- Web search fallback π
It is designed to mimic human decision-making in multi-step reasoning pipelines and integrates seamlessly with multiple LLM providers via OpenRouter.
- Adaptive RAG: Dynamically retrieves and ranks relevant documents.
- Agentic Control Flow: Conditional routing to select between internal knowledge or web search.
- Web Search Fallback: Automatically queries the web if internal knowledge is insufficient.
- Multi-LLM Integration: Supports OpenRouter, GPT models, and other LLMs.
- Prompt Engineering: Modular and reusable prompt templates for different contexts.
- Message Conversion: Converts prompts into LLM-compatible messages.
- Monitoring Ready: Easily extendable to track latency, costs, and evaluation metrics.
flowchart LR
User[User Query] --> Retriever[BM25 Retriever]
Retriever --> PromptBuilder[Prompt Builder]
PromptBuilder --> MessageConverter[ChatMessageConverter]
MessageConverter --> LLM[OpenRouter LLM Generator]
LLM --> Router[Conditional Router]
Router -->|answer| Output[Return Answer]
Router -->|go_to_websearch| WebSearch[SerperDev Web Search]
WebSearch --> WebPrompt[Web Prompt Builder]
WebPrompt --> WebMessageConverter[ChatMessageConverter]
WebMessageConverter --> WebLLM[OpenRouter Web Generator]
WebLLM --> Output