Expand description
Tolerant JSON parsing for LLM outputs.
LLMs frequently produce malformed JSON: trailing commas, unescaped quotes, incomplete brackets, or markdown-wrapped code blocks. This module provides utilities to handle these cases gracefully.
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.