🤖 AI Summary
This work addresses the lack of an integrated Retrieval-Augmented Generation (RAG) development and evaluation toolkit in the R programming language, where existing solutions predominantly rely on the Python ecosystem. The authors propose ragR, the first native R framework enabling end-to-end RAG workflows—including document ingestion, vector storage, similarity-based retrieval, evidence synthesis, and structured question-answering logging—and faithfully reimplements the four core RAGAS evaluation metrics: context precision, context recall, faithfulness, and answer relevance. Experimental results demonstrate that ragR yields evaluation outcomes highly consistent with those produced by the original Python-based RAGAS implementation. This provides R users with a lightweight, reproducible, and self-contained environment for RAG research and education without requiring language switching.
📝 Abstract
Retrieval-augmented generation (RAG) combines document retrieval with large language models to produce responses grounded in external evidence. While several R packages support core components of RAG workflows, integrated evaluation of RAG systems in R remains limited and is often conducted through Python-based tools, most notably the RAG assessment (RAGAS) framework. To address this gap, we introduce ragR, an R package that unifies document ingestion, embedding and vector storage, similarity-based retrieval, grounded generation, structured question-answer logging, and RAGAS-style evaluation within a single R-native workflow. The current implementation provides LLM-based scoring for four core RAGAS metrics: context precision, context recall, faithfulness, and answer relevance. Validation experiments under controlled settings show that ragR captures similar metric behavior to the reference Python RAGAS workflow across multiple use cases. By integrating RAG construction and evaluation within a reproducible workflow in R, ragR provides a practical framework for research, teaching, and moderate-scale experimentation on RAG systems entirely within the R ecosystem.