Skip to main content

Module payload_fixer

Module payload_fixer 

Source
Expand description

LLM-JSON autofixer — ports payload_fixer.py.

Parses a raw JSON string from an LLM, applying tolerant fixes:

  1. normalize smart (curly) quotes to straight quotes,
  2. on parse failure, strip trailing commas and retry,
  3. wrap a bare top-level object into a one-element list.

Returns Ok(Vec<Value>) on success, or an A2uiError (Parse for serde failures, Validation for a non-list/non-object top level).

Functions§

parse_and_fix
Parse and autofix a raw LLM JSON payload into a list of JSON values.