cognis_core/output_parsers/
mod.rs1pub mod boolean;
11pub mod fixing;
12pub mod json;
13pub mod list;
14pub mod string;
15pub mod structured;
16pub mod xml;
17
18pub use boolean::BooleanParser;
19pub use fixing::{OutputFixingParser, RetryParser};
20pub use json::JsonParser;
21pub use list::{CommaListParser, NumberedListParser};
22pub use string::StringParser;
23pub use structured::{
24 JsonExtraction, JsonExtractor, StructuredOutputConfig, StructuredOutputParser,
25};
26pub use xml::XmlParser;
27
28use crate::Result;
29
30pub trait OutputParser<T>: Send + Sync
32where
33 T: Send + 'static,
34{
35 fn parse(&self, text: &str) -> Result<T>;
37
38 fn format_instructions(&self) -> Option<String> {
41 None
42 }
43}