llm_parse_structured | R Documentation |
Robustly parses an LLM's structured output (JSON). Works on character scalars or an llmr_response. Strips code fences first, then tries strict parsing, then attempts to extract the largest balanced {...} or [...].
llm_parse_structured(x, strict_only = FALSE, simplify = FALSE)
x |
Character or llmr_response. |
strict_only |
If TRUE, do not attempt recovery via substring extraction. |
simplify |
Logical passed to jsonlite::fromJSON ( |
The return contract is list-or-NULL; scalar-only JSON is treated as failure.
Numerics are coerced to double for stability.
A parsed R object (list), or NULL on failure.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.