pub fn extract_labeled_text(text: &str) -> Vec<(String, String)>
Expand description
Extracts labeled text from markdown
LLMs often generate text that looks something like this
- *foo*: bar
- hello: world
Which we want to parse as key value pairs (foo, bar), (hello, world).
§Parameters
text
the text to parse
§Returns
Vec<(String, String)> A vector of key value pairs.
§Examples
use llm_chain::parsing::extract_labeled_text;
let data = "
- alpha: beta
- *gamma*: delta
";
let labs = extract_labeled_text(data);
println!("{:?}", labs);
assert_eq!(labs[0], ("alpha".to_string(), "beta".to_string()));