LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-classicagentsformat_scratchpadlogformat_log_to_str
    Function●Since v1.0

    format_log_to_str

    Construct the scratchpad that lets the agent continue its thought process.

    Copy
    format_log_to_str(
      intermediate_steps: list[tuple[AgentAction, str]],
      observation_prefix: str = 'Observation: ',
      llm_prefix: str = 'Thought: '
    ) -> str

    Used in Docs

    • Mlx integration

    Parameters

    NameTypeDescription
    intermediate_steps*list[tuple[AgentAction, str]]

    List of tuples of AgentAction and observation strings.

    observation_prefixstr
    Default:'Observation: '

    Prefix to append the observation with.

    llm_prefixstr
    Default:'Thought: '

    Prefix to append the llm call with.

    View source on GitHub