OutputParser classes parse the output of an LLM call into structured data.
Output parsers emerged as an early solution to the challenge of obtaining structured output from LLMs.
Today, most LLMs support structured output natively. In such cases, using output parsers may be unnecessary, and you should leverage the model's built-in capabilities for structured output. Refer to the documentation of your chosen model for guidance on how to achieve structured output directly.
Output parsers remain valuable when working with models that do not support structured output natively, or when you require additional processing or validation of the model's output beyond its inherent capabilities.
Base class to parse the output of an LLM call.
Abstract base class for parsing the outputs of a model.
Base class to parse the output of an LLM call.
Output parsers help structure language model responses.
Parse the output of an LLM call to a JSON object.
Probably the most reliable output parser for getting structured data that does not use function calling.
When used in streaming mode, it will yield partial JSON objects containing all the keys that have been returned so far.
In streaming, if diff is set to True, yields JSONPatch operations describing
the difference between the previous and the current object.
Parse the output of a model to a comma-separated list.
Parse the output of a model to a list.
Parse a Markdown list.
Parse a numbered list.
Parse tools from OpenAI response.
Parse tools from OpenAI response.
Parse tools from OpenAI response.
Parse an output using a Pydantic model.
Extract text content from model outputs as a string.
Converts model outputs (such as AIMessage or AIMessageChunk objects) into plain
text strings. It's the simplest output parser and is useful when you need string
responses for downstream processing, display, or storage.
Supports streaming, yielding text chunks as they're generated by the model.
Base class for an output parser that can handle streaming input.
Base class for an output parser that can handle streaming input.
Parse an output using xml format.
Returns a dictionary of tags.
Parsers for list output.
Base classes for output parsers that can handle streaming input.
Format instructions.
String output parser.
Parsers for OpenAI functions output.
Output parsers using Pydantic.
Parse tools for OpenAI tools output.
Parser for JSON output.
Output parser for XML format.
Base parser for language model outputs.