% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rag.R
\name{build_knowledge_base}
\alias{build_knowledge_base}
\title{Build the PRA Knowledge Base for RAG Retrieval}
\usage{
build_knowledge_base(
  store_path = NULL,
  embed_model = "nomic-embed-text",
  overwrite = FALSE
)
}
\arguments{
\item{store_path}{Path to store the DuckDB knowledge base. Defaults to a
cache directory under \code{\link[tools:userdir]{tools::R_user_dir()}}.}

\item{embed_model}{Ollama embedding model name (default \code{"nomic-embed-text"}).}

\item{overwrite}{Logical. If \code{TRUE}, rebuild the knowledge base even if a
cached version exists. Default \code{FALSE}.}
}
\value{
A ragnar store object that can be passed to \code{\link[=retrieve_context]{retrieve_context()}}.
}
\description{
Reads the curated risk analysis knowledge files bundled with the PRA package,
chunks them, generates embeddings via Ollama, and stores them in a DuckDB-backed
ragnar knowledge base for retrieval-augmented generation.
}
\details{
The knowledge base is built once and cached to disk. Subsequent calls with the
same \code{store_path} load the existing store.
}
\examples{
\dontrun{
store <- build_knowledge_base()
context <- retrieve_context(store, "How do I run a Monte Carlo simulation?")
}

}
