llm_mutate {LLMR}R Documentation

Mutate a data frame with LLM output

Description

A convenience wrapper around llm_fn that inserts the result as a new column via mutate.

Usage

llm_mutate(
  .data,
  output,
  prompt,
  .config,
  .system_prompt = NULL,
  .before = NULL,
  .after = NULL,
  ...
)

Arguments

.data

A data frame / tibble.

output

Unquoted name of the new column you want to add.

prompt

A glue template string. If x is a data frame, use {col} placeholders; if x is a vector, refer to the element as {x}.

.config

An llm_config object.

.system_prompt

Optional system message (character scalar).

.before, .after

Standard mutate column-placement helpers.

...

Passed unchanged to call_llm_broadcast (e.g.\ tries, progress, verbose).

Details

Internally calls llm_fn(), so the API requests inherit the same parallel behaviour. Activate parallelism with setup_llm_parallel() and shut it off with reset_llm_parallel().

See Also

setup_llm_parallel, reset_llm_parallel, call_llm_par, llm_fn

Examples

## See examples under \link{llm_fn}.

[Package LLMR version 0.5.0 Index]