

ragnar
RAG in R
ragnar is an R package for building Retrieval-Augmented Generation (RAG) workflows that provide LLMs with relevant context from document collections. It handles the complete pipeline: converting documents to markdown, chunking text while preserving semantic structure, generating embeddings, storing data in DuckDB, and retrieving relevant chunks based on similarity search or keyword matching.
The package emphasizes transparency and control at each step rather than black-box automation. It supports multiple document formats through MarkItDown, offers configurable chunking strategies that preserve document structure like headings, integrates with popular embedding providers (OpenAI, Ollama, Bedrock, Databricks, Google Vertex), and uses DuckDB’s vector similarity search and full-text search for efficient retrieval. ragnar can also equip ellmer Chat objects with retrieval tools, letting LLMs automatically pull relevant information from knowledge stores during conversations.






