pub fn parse_with_parser<T: DeserializeOwned>(
input: &str,
parser: &FlexibleParser,
) -> Result<T>Expand description
Parses an LLM response using a custom parser.
This allows you to configure the parsing strategies used.
ยงExamples
use tryparse::{parse_with_parser, parser::FlexibleParser};
use serde::Deserialize;
#[derive(Deserialize)]
struct Data {
value: i32,
}
let parser = FlexibleParser::new();
let response = r#"{"value": 42}"#;
let data: Data = parse_with_parser(response, &parser).unwrap();