Generation#

class langchain_core.outputs.generation.Generation[source]#

Bases: Serializable

A single text generation output.

Generation represents the response from an “old-fashioned” LLM that generates regular text (not chat messages).

This model is used internally by chat model and will eventually be mapped to a more general LLMResult object, and then projected into an AIMessage object.

LangChain users working with chat models will usually access information via AIMessage (returned from runnable interfaces) or LLMResult (available via callbacks). Please refer the AIMessage and LLMResult schema documentation for more information.

param generation_info: Dict[str, Any] | None = None#

Raw response from the provider.

May include things like the reason for finishing or token log probabilities.

param text: str [Required]#

Generated text output.

param type: Literal['Generation'] = 'Generation'#

Type is used exclusively for serialization purposes. Set to “Generation” for this class.

Examples using Generation