LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coremessagesaiAIMessagepretty_repr
    Method●Since v0.1

    pretty_repr

    Return a pretty representation of the message for display.

    Copy
    pretty_repr(
        self,
        html: bool = False,
    ) -> str

    Example:

    from langchain_core.messages import AIMessage
    
    msg = AIMessage(
        content="Let me check the weather.",
        tool_calls=[
            {"name": "get_weather", "args": {"city": "Paris"}, "id": "1"}
        ],
    )

    Results in:

    >>> print(msg.pretty_repr())
    ================================== Ai Message ==================================
    
    Let me check the weather.
    Tool Calls:
      get_weather (1)
     Call ID: 1
      Args:
        city: Paris

    Parameters

    NameTypeDescription
    htmlbool
    Default:False

    Whether to return an HTML-formatted string.

    View source on GitHub