Turn on structured output for a model configuration. Supports OpenAI‑compatible providers (OpenAI, Groq, Together, x.ai, DeepSeek), Anthropic, and Gemini.
enable_structured_output(
config,
schema = NULL,
name = "llmr_schema",
method = c("auto", "json_mode", "tool_call"),
strict = TRUE
)
Modified llm_config
.
An llm_config object.
A named list representing a JSON Schema.
If NULL
, OpenAI-compatible providers enforce a JSON object; Gemini switches
to JSON mime type; Anthropic only injects a tool when a schema is supplied.
Character. Schema/tool name for providers requiring one. Default "llmr_schema".
One of c("auto","json_mode","tool_call"). "auto" chooses the best per provider. You rarely need to change this.
Logical. Request strict validation when supported (OpenAI-compatible).