Home / Class/ ChatResult Class — langchain Architecture

ChatResult Class — langchain Architecture

Architecture documentation for the ChatResult class in chat_result.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  653774ed_85b9_3ccf_5709_df3be5253604["ChatResult"]
  89d4b203_bee2_2a50_cacf_19aae90c54c7["chat_result.py"]
  653774ed_85b9_3ccf_5709_df3be5253604 -->|defined in| 89d4b203_bee2_2a50_cacf_19aae90c54c7

Relationship Graph

Source Code

libs/core/langchain_core/outputs/chat_result.py lines 8–36

class ChatResult(BaseModel):
    """Use to represent the result of a chat model call with a single prompt.

    This container is used internally by some implementations of chat model, it 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.
    """

    generations: list[ChatGeneration]
    """List of the chat generations.

    Generations is a list to allow for multiple candidate generations for a single
    input prompt.
    """

    llm_output: dict | None = None
    """For arbitrary LLM provider specific output.

    This dictionary is a free-form dictionary that can contain any information that the
    provider wants to return. It is not standardized and is provider-specific.

    Users should generally avoid relying on this field and instead rely on accessing
    relevant information from standardized fields present in `AIMessage`.
    """

Frequently Asked Questions

What is the ChatResult class?
ChatResult is a class in the langchain codebase, defined in libs/core/langchain_core/outputs/chat_result.py.
Where is ChatResult defined?
ChatResult is defined in libs/core/langchain_core/outputs/chat_result.py at line 8.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free