langchain_core.output_parsers.base.BaseGenerationOutputParser

Note

BaseGenerationOutputParser implements the standard Runnable Interface. 🏃

class langchain_core.output_parsers.base.BaseGenerationOutputParser[source]

Bases: BaseLLMOutputParser, RunnableSerializable[Union[BaseMessage, str], T]

Base class to parse the output of an LLM call.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

async aparse_result(result: List[Generation], *, partial: bool = False) T

Parse a list of candidate model Generations into a specific format.

Parameters
  • result (List[Generation]) – A list of Generations to be parsed. The Generations are assumed to be different candidate outputs for a single model input.

  • partial (bool) –

Returns

Structured output.

Return type

T

abstract parse_result(result: List[Generation], *, partial: bool = False) T

Parse a list of candidate model Generations into a specific format.

Parameters
  • result (List[Generation]) – A list of Generations to be parsed. The Generations are assumed to be different candidate outputs for a single model input.

  • partial (bool) –

Returns

Structured output.

Return type

T

Examples using BaseGenerationOutputParser