gptme-rag

v0.5.1 ChromaDB-based RAG (Retrieval-Augmented Generation) for gptme agents packages/gptme-rag View on GitHub

gptme-rag

ChromaDB-based RAG (Retrieval-Augmented Generation) for gptme agents.

Part of gptme-contrib. Upstreamed from gptme/gptme-rag.

Enhances AI responses by retrieving and incorporating relevant context from your local files using vector/semantic search with ChromaDB.

This is the vector search complement to gptme-wisdom (BM25/SQLite exact-term search). Different approaches for different use cases.

Features

Quick Start

# Index your documents
gptme-rag index /path/to/documents

# Index with API embeddings instead of local CPU embeddings
OPENROUTER_API_KEY=... gptme-rag index /path/to/documents --embedding-function openrouter

# Search with semantic relevance
gptme-rag search "your query"

# Start MCP server (for agent tool integration)
gptme-rag mcp --persist-dir /path/to/index

OpenRouter embedding model defaults to openai/text-embedding-3-large and can be overridden with OPENROUTER_EMBEDDING_MODEL. If --embedding-function openrouter is requested without an API key, gptme-rag falls back to the local ModernBERT embedding backend.

Local (sentence-transformers) embeddings are cached by chunk content hash in ~/.cache/gptme-rag/local-embeddings.sqlite (XDG_CACHE_HOME respected). Change detection is per file, so an appended line re-submits every chunk of that file; the cache turns the unchanged chunks into lookups instead of CPU re-embeds. Set GPTME_RAG_EMBEDDING_CACHE=/path/to/cache.sqlite to relocate it or GPTME_RAG_EMBEDDING_CACHE=off to disable.

Development

# Run tests (excluding slow embedding-model tests)
uv run pytest packages/gptme-rag/ -v -m "not slow"

# Run all tests
uv run pytest packages/gptme-rag/ -v

License

MIT