| llm_render_messages | R Documentation |
Returns the per-row message objects that llm_fn() / llm_mutate() would
build from prompt or .messages, using the same internal renderer they
use. No request is sent and no file is read or encoded; a "file" role
stays a (glued) path string. Use this to inspect templating, roles, and
multimodal wiring before spending anything.
llm_render_messages(
.data,
prompt = NULL,
.messages = NULL,
.system_prompt = NULL,
rows = NULL
)
.data |
A data.frame/tibble whose columns feed the |
prompt |
A single |
.messages |
A character vector of |
.system_prompt |
Optional system string, prepended when a row has no
|
rows |
Optional integer vector selecting which rows to render (default: all rows). |
A list of length length(rows) (default nrow(.data)). Each element
is either a bare character scalar (prompt only, no system) or a role-named
character vector, identical to what the call path would dispatch.
llm_preview() for a row-level summary with issue flags and the
batch plan; llm_fn(), llm_mutate().
df <- data.frame(text = c("good", "bad"), stringsAsFactors = FALSE)
llm_render_messages(df, prompt = "Sentiment of: {text}")
llm_render_messages(
df,
.messages = c(system = "Be terse.", user = "Rate: {text}")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.