Expand description
Tolerant JSON parsing for LLM outputs.
LLMs frequently produce malformed JSON: trailing commas, unescaped quotes,
incomplete brackets, or markdown-wrapped code blocks. The repair pipeline
lives in lc_shared::json_repair so that every parser of LLM JSON —
including ToolCall::parse_arguments in lc-shared — shares one tolerant
parser. This module keeps the historical public API (parse_llm_json,
parse_llm_json_with_retry, LlmJsonParseError) and delegates to it.
Enums§
- LlmJson
Parse Error - Error types for LLM JSON parsing.
Functions§
- parse_
llm_ json - Parses LLM JSON output with automatic repair of common errors.
- parse_
llm_ json_ with_ retry - Parses LLM JSON with retry: if parsing fails, calls the provided callback to get a corrected response from the LLM, and tries again.