Enables Retrieval-Augmented Generation (RAG) workflows in R by combining local vector search using 'DuckDB' with optional web search via the 'Tavily' API. Supports 'OpenAI'- and 'Ollama'-compatible embedding models, full-text and 'HNSW' (Hierarchical Navigable Small World) indexing, and modular large language model (LLM) invocation. Designed for advanced question-answering, chat-based applications, and production-ready AI pipelines. This package is the R equivalent of the 'python' package 'RAGFlowChain' available at < https://pypi.org/project/RAGFlowChain/>.

RAGFlowChainR is an R package for Retrieval-Augmented Generation (RAG)
workflows with local retrieval backends (DuckDB and VectrixDB) plus
optional web search.
The README is intentionally short. Full backend workflows are documented in vignettes.
install.packages("RAGFlowChainR")
install.packages("remotes")
remotes::install_github("knowusuboaky/RAGFlowChainR")
library(RAGFlowChainR)
rag <- create_rag_chain(
llm = function(prompt) "mock answer",
vector_database_directory = "my_vectors.duckdb",
method = "DuckDB",
use_web_search = FALSE
)
rag$invoke("What is RAG?")
rag$disconnect()
For complete ingestion, indexing, and backend-specific setup, use the two backend vignettes above.
Sys.setenv(TAVILY_API_KEY = "your-tavily-api-key")
Sys.setenv(OPENAI_API_KEY = "your-openai-api-key")
Sys.setenv(GROQ_API_KEY = "your-groq-api-key")
Sys.setenv(ANTHROPIC_API_KEY = "your-anthropic-api-key")
MIT (c) Kwadwo Daddy Nyame Owusu Boakye