Skip to main content

OutputParser

Trait OutputParser 

Source
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§

Source

type Output

The output type produced by this parser.

Required Methods§

Source

fn parse(&self, text: &str) -> Result<Self::Output>

Parse the raw LLM response text into structured output.

Source

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.

Implementors§