% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paintr-llm.R
\name{ptr_llm_register}
\alias{ptr_llm_register}
\title{Register ggpaintr with an ellmer chat session}
\usage{
ptr_llm_register(chat, tool_name = "ggpaintr_docs")
}
\arguments{
\item{chat}{An ellmer \code{Chat} object (from \code{ellmer::chat_anthropic()},
\code{ellmer::chat_openai()}, etc.).}

\item{tool_name}{String. The name the LLM will call the tool under.
Defaults to \code{"ggpaintr_docs"}; override if it would collide with
another tool you already registered.}
}
\value{
The \code{chat} object (invisibly), for piping.
}
\description{
One-line registration of the ggpaintr docs tool on an existing
\link[ellmer:ellmer-package]{ellmer} \code{Chat} object. The tool wraps
\code{\link[=ptr_llm_topic]{ptr_llm_topic()}} so the LLM can pull focused, runnable examples
on demand instead of loading every topic into the system prompt.
}
\details{
The set of valid topic names is snapshotted at registration time
using \code{\link[=ptr_llm_topics]{ptr_llm_topics()}}, so the LLM cannot request a topic that
does not exist. If you upgrade ggpaintr in the same session and new
topics are added, call this again on a fresh chat.

This function does \emph{not} set the chat's system prompt. Pass
\code{\link[=ptr_llm_primer]{ptr_llm_primer()}} to the \verb{system_prompt =} argument of your
\verb{chat_*()} constructor so the model knows when to reach for the tool.
}
\examples{
if (interactive()) {
library(ellmer)
chat <- chat_anthropic(system_prompt = ptr_llm_primer())
ptr_llm_register(chat)
chat$chat("Build a Shiny app where the user picks X and Y columns from mtcars.")
}
}
\seealso{
\code{\link[=ptr_llm_primer]{ptr_llm_primer()}}, \code{\link[=ptr_llm_topic]{ptr_llm_topic()}}, \code{\link[=ptr_llm_topics]{ptr_llm_topics()}}
}
