Skip to main content

parse_rendered_output

Function parse_rendered_output 

Source
pub fn parse_rendered_output(text: &str) -> Option<Value>
Expand description

Read render_tool_output’s text back into a JSON object — for consumers that need fields (an outcome, a receipt’s structured redaction) when only the model’s copy survives, such as a transcript replayed without its recorded ok. Exact for scalars and blocks; an outcome field reads back as the one line the model saw (breaks as spaces, long ones clipped), and a record list reads back as its text. A block cut short by a budget reads back as what is left of it, and parsing stops at the first line that is not a field, which is where a budget cut the text. None unless the first line is a field — a [FAILED] … line, a refusal or prose is not rendered output.