RAG made simple.
raghilda is a Python package for implementing Retrieval-Augmented Generation (RAG) workflows. It provides a complete solution with sensible defaults while remaining transparent—not a black box.
pip install raghildaOr install from GitHub:
pip install git+https://github.com/posit-dev/raghilda.gitraghilda handles the complete RAG pipeline:
- Document Processing — Convert documents to Markdown using MarkItDown
- Text Chunking — Split text at semantic boundaries (headings, paragraphs, sentences)
- Embedding — Generate vector representations via OpenAI or other providers
- Storage — Store chunks and embeddings in DuckDB, ChromaDB, or OpenAI Vector Stores
- Retrieval — Find relevant chunks using similarity search or BM25
from raghilda.store import DuckDBStore
from raghilda.embedding import EmbeddingOpenAI
from raghilda.scrape import find_links
from raghilda.read import read_as_markdown
from raghilda.chunker import MarkdownChunker
# Create a store with embeddings
store = DuckDBStore.create(
location="chatlas.db",
embed=EmbeddingOpenAI(),
)
# Find and index pages from the chatlas documentation
links = find_links("https://posit-dev.github.io/chatlas/")
chunker = MarkdownChunker()
for link in links:
document = read_as_markdown(link)
chunked_document = chunker.chunk(document)
store.upsert(chunked_document)
# Retrieve relevant chunks
chunks = store.retrieve("How do I stream a response?", top_k=5)
for chunk in chunks:
print(chunk.text)