Expand description
Lenient JSON parsing for model output: tool-call arguments and server-sent event payloads.
Functions§
- js_
parse_ error - The message of the error JavaScript’s
JSON.parsethrows fortext, as V8 words it, orNonewhentextis valid JSON. - parse_
json_ with_ repair - Parses JSON, retrying once on the
repair_jsonform. - parse_
streaming_ json - Parses possibly incomplete tool-call arguments into an object.
- repair_
json - Escapes what models commonly emit raw inside JSON strings: control characters, lone backslashes and invalid escapes. Valid JSON is returned unchanged.