neuml/rag
🚀 Retrieval Augmented Generation (RAG) with txtai. Combine search and LLMs to find insights with your own data.
What it solves
This project provides a user-friendly Streamlit application that implements Retrieval Augmented Generation (RAG) to ensure LLM responses are factually correct by grounding them in specific, relevant context. It allows users to easily switch between traditional vector-based retrieval and more advanced graph-based retrieval methods.
How it works
Built on the txtai framework, the application processes user queries using two primary retrieval strategies:
- Vector RAG: Performs a standard vector search to find the top N most relevant document matches to provide as context for the LLM.
- Graph RAG: Uses semantic graphs to generate context via graph path traversal or graph query expansion (using the
gq:prefix). It can also combine both methods to narrow down a search within a specific graph path.
Users can dynamically add data to the index via URLs, file paths, or direct text input using the # prefix.
Who it’s for
Developers and AI researchers who want a ready-to-use interface for testing and comparing different RAG retrieval strategies (vector vs. graph) and managing their own knowledge bases.
Highlights
- Dual Retrieval Modes: Supports both standard Vector RAG and Graph RAG.
- Dynamic Data Indexing: Add new documents or text snippets directly through the chat interface using
#commands. - Flexible Configuration: Highly configurable via environment variables for LLM choice, embeddings database, and text extraction backends (e.g., Docling).
- Visual Graph Representation: Graph RAG queries display a corresponding graph to visualize how the context was retrieved.