% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/vlm-providers.R
\name{vlm_provider}
\alias{vlm_provider}
\title{Construct a VLM provider chat object}
\usage{
vlm_provider(
  name = c("auto", "anthropic", "openai", "google", "ollama"),
  model = NULL,
  ...
)
}
\arguments{
\item{name}{Provider name. One of \code{"anthropic"} (Claude),
\code{"openai"} (GPT-4o family), \code{"google"} (Gemini),
\code{"ollama"} (local).}

\item{model}{Optional model identifier; defaults to
\code{default_model(name)}.}

\item{...}{Additional arguments forwarded to the corresponding
\code{ellmer::chat_*} constructor (e.g. \code{system_prompt},
\code{api_key}, \code{base_url}, \code{params}).}
}
\value{
An \code{ellmer} \code{Chat} object exposing a \code{$chat()}
        method for sending prompts.
}
\description{
Returns an \code{ellmer} chat object configured for the given
provider, ready to be passed to the extraction functions
(\code{\link{extract_horizons_from_pdf}}, etc.). The chat object
wraps API credentials and model selection; it does not itself send
any request.
}
\details{
This is purely a convenience wrapper: it picks a default model per
provider and forwards remaining arguments (e.g.
\code{system_prompt}, \code{api_key}) to the underlying ellmer
constructor. \code{ellmer} must be installed.
}
\section{Local-first option}{

Passing \code{name = "ollama"} runs every extraction locally via
an Ollama server (default \code{gemma4:e4b}, Gemma 4 edge with
multimodal text+image+audio support). No data leaves the
machine, which is the recommended setting for sensitive field
descriptions (e.g. governmental surveys, indigenous land studies)
where institutional independence and data sovereignty matter.
Pull the model first:
\preformatted{
  ollama pull gemma4:e4b      # ~3 GB edge variant (default)
  ollama pull gemma4:31b      # frontier dense variant
  ollama pull gemma3:27b      # earlier generation, still solid
}
Then start an Ollama server (\code{ollama serve}) and the chat
object returned here will dispatch over HTTP locally.
}

\examples{
\dontshow{if (requireNamespace("ellmer", quietly = TRUE)) withAutoprint(\{ # examplesIf}
\donttest{
# Each provider needs either an API key (cloud) or a running daemon
# (Ollama); the example no-ops on CRAN when neither is available.
if (nzchar(Sys.getenv("ANTHROPIC_API_KEY"))) {
  provider <- try(vlm_provider("anthropic"), silent = TRUE)
}
if (interactive()) {
  # Local Gemma 4 edge model -- default, ~3 GB, runs anywhere
  provider <- try(vlm_provider("ollama"), silent = TRUE)

  # Local Gemma 4 frontier dense model -- best quality
  provider <- try(vlm_provider("ollama", model = "gemma4:31b"),
                  silent = TRUE)
}
}
\dontshow{\}) # examplesIf}
}
