Schema-first variant of llm_fn()
. It enables structured output on the config,
calls the model via call_llm_broadcast()
, parses JSON, and optionally validates.
llm_fn_structured(
x,
prompt,
.config,
.system_prompt = NULL,
...,
.schema = NULL,
.fields = NULL,
.local_only = FALSE,
.validate_local = TRUE
)
A character vector or a data.frame/tibble.
A glue template string. With a data-frame you may reference
columns ({col}
); with a vector the placeholder is {x}
.
An llm_config object.
Optional system message (character scalar).
Passed unchanged to call_llm_broadcast()
(e.g. tries
,
progress
, verbose
).
Optional JSON Schema list; if NULL
, only JSON object is enforced.
Optional fields to hoist from parsed JSON (supports nested paths).
If TRUE, do not send schema to the provider (parse/validate locally).
If TRUE and .schema
provided, validate locally.