% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api_llamacpp.R
\name{llamacpp_rerank}
\alias{llamacpp_rerank}
\title{Rerank Documents Using a llama.cpp Server}
\usage{
llamacpp_rerank(
  .query,
  .documents,
  .model = "local-model",
  .server = Sys.getenv("LLAMACPP_SERVER", "http://localhost:8080"),
  .api_key = Sys.getenv("LLAMACPP_API_KEY", ""),
  .timeout = 60,
  .max_tries = 3,
  .dry_run = FALSE
)
}
\arguments{
\item{.query}{A single query string.}

\item{.documents}{A character vector of documents to rerank.}

\item{.model}{The model name (default: \code{"local-model"}).}

\item{.server}{Base URL of the llama.cpp server. Defaults to \code{LLAMACPP_SERVER}
env var, falling back to \code{"http://localhost:8080"}.}

\item{.api_key}{API key for the server (default: \code{LLAMACPP_API_KEY} env var).}

\item{.timeout}{Request timeout in seconds (default: 60).}

\item{.max_tries}{Maximum retries (default: 3).}

\item{.dry_run}{If TRUE, returns the request object without executing it (default: FALSE).}
}
\value{
A tibble with columns \code{index} (original position), \code{document} (text),
and \code{relevance_score}, sorted by descending score.
}
\description{
Calls the \verb{/v1/reranking} endpoint of a running llama.cpp server to score
documents by relevance to a query. Useful for building fully-local RAG
pipelines (embed → cosine search → rerank → chat, all with \code{llamacpp()}).
}
