Skip to content

A RAG agent for local document retrieval and answer generation

Notifications You must be signed in to change notification settings

pranav-ap/library_rag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

22 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Retrieval-Augmented Generation

This project implements a Retrieval-Augmented Generation (RAG) workflow that uses,

  • ๐Ÿ•ธ๏ธ Web search via Tavily
  • ๐Ÿ“š Document retrieval via vector database
  • ๐Ÿ’ฌ Local LLMs via Ollama
  • ๐Ÿ”€ Dynamic reasoning and control flow using LangGraph
  • ๐Ÿ“Š Tracing and evaluation using Langfuse

๐Ÿš€ Features

  • Hybrid RAG with both web and vector-based retrieval
  • Automatic query reformulation
  • Relevance filtering before answer generation
  • Hallucination detection and correction
  • Tracing via Langfuse
  • Modular node/edge logic using LangGraph

This RAG system is built with a hybrid retrieval architecture combining multiple search strategies:

  • ChromaDB Vector Search: Retrieves documents based on semantic similarity using dense embeddings from a Chroma collection.
  • BM25 Lexical Search: Identifies relevant documents using traditional keyword-based matching with BM25 scoring.
  • Hybrid Retrieval: Integrates results from both semantic and lexical searches using Reciprocal Rank Fusion (RRF) for balanced and robust retrieval.

๐Ÿ” Environment Variables

Create a .env file in the project root:

TAVILY_API_KEY=your_tavily_api_key
LANGFUSE_PUBLIC_KEY=your_langfuse_public_key
LANGFUSE_SECRET_KEY=your_langfuse_secret_key

About

A RAG agent for local document retrieval and answer generation

Topics

Resources

Stars

Watchers

Forks