extract_json

Function extract_json 

Source
pub fn extract_json(text: &str) -> Result<String, ParseError>
Expand description

Extracts a JSON string from a raw LLM response string.

This function uses a FlexibleExtractor with its standard strategies to find and extract a JSON object from a string that may contain extraneous text, such as explanations or Markdown code blocks.

For more advanced control over extraction strategies, see the extract::FlexibleExtractor struct.

ยงReturns

A Result containing the extracted JSON String on success, or a ParseError if no JSON could be extracted.