refrag
Verified Safeby DIMANANDEZ
Overview
A Python library for Retrieval Augmented Generation (RAG) that uses micro-chunking, fast direct embedding, and query-time heuristic compression to reduce context size and improve retrieval efficiency, with optional LLM-based reranking for precision.
Installation
python examples/basic_usage.pyEnvironment Variables
- OPENAI_API_KEY
- ANTHROPIC_API_KEY
Security Notes
The core implementation (embedder, compressor) does not use LLMs, which reduces immediate security risks associated with prompt injection or external API calls for core processing. The `REFRAGReranker` component, however, makes external API calls to OpenAI or Anthropic, which introduces standard risks of data privacy, reliance on external services, and potential cost accumulation. API keys are appropriately sourced from environment variables. The use of regex in `ChunkCompressor` for keyword extraction could, in theory, be susceptible to ReDoS attacks with crafted inputs, though the patterns used are relatively simple. An example in the documentation shows `pickle` usage for index saving/loading; loading pickled data from untrusted sources is a deserialization vulnerability, but this is an example for user implementation rather than a core library function.
Similar Servers
haiku.rag
Opinionated agentic RAG powered by LanceDB, Pydantic AI, and Docling to provide hybrid search, intelligent QA, and multi-agent research over user-provided documents, accessible via CLI, Python API, Web App, TUI, or as an MCP server for AI assistants.
Context-Engine
Self-improving code search and context engine for IDEs and AI agents, providing hybrid semantic/lexical search, symbol graph navigation, and persistent memory.
mcp-local-rag
Local RAG server for developers enabling private, offline semantic search with keyword boosting on personal or project documents (PDF, DOCX, TXT, MD, HTML).
RagThisCode
Set up a RAG (Retrieval-Augmented Generation) system to chat with the code of any public or private GitHub repository.