Skip to main content

extract_last_code_block

Function extract_last_code_block 

Source
pub fn extract_last_code_block(s: &str) -> Option<&str>
Expand description

Extract the LAST json or ``` code block from text.

Thinking/reasoning models often output multiple blocks, refining their answer. The last block is typically the final, valid JSON.