pub trait OutputParser: Send + Sync {
type Output;
// Required methods
fn parse(&self, text: &str) -> Result<Self::Output>;
fn format_instructions(&self) -> String;
}Expand description
Trait for parsing structured output from LLM text responses.
Required Associated Types§
Required Methods§
Sourcefn parse(&self, text: &str) -> Result<Self::Output>
fn parse(&self, text: &str) -> Result<Self::Output>
Parse the raw LLM response text into structured output.
Sourcefn format_instructions(&self) -> String
fn format_instructions(&self) -> String
Return format instructions to inject into the prompt.
These instructions tell the LLM how to format its response so this parser can extract structured data from it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".