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-classicagentsstructured_chatbase
    Module●Since v1.0

    base

    Attributes

    attribute
    FORMAT_INSTRUCTIONS: str
    attribute
    PREFIX: str
    attribute
    SUFFIX: str
    attribute
    HUMAN_MESSAGE_TEMPLATE: str

    Functions

    function
    format_log_to_str

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

    function
    create_structured_chat_agent

    Create an agent aimed at supporting tools with multiple inputs.

    Classes

    class
    AgentOutputParser

    Base class for parsing agent output into agent action/finish.

    class
    JSONAgentOutputParser

    Parses tool invocations and final answers in JSON format.

    Expects output to be in one of two formats.

    If the output signals that an action should be taken, should be in the below format. This will result in an AgentAction being returned.

    {"action": "search", "action_input": "2+2"}
    

    If the output signals that a final answer should be given, should be in the below format. This will result in an AgentFinish being returned.

    {"action": "Final Answer", "action_input": "4"}
    
    class
    StructuredChatOutputParserWithRetries

    Output parser with retries for the structured chat agent.

    deprecatedclass
    Agent

    Agent that calls the language model and deciding the action.

    This is driven by a LLMChain. The prompt in the LLMChain MUST include a variable called "agent_scratchpad" where the agent can put its intermediary work.

    deprecatedclass
    LLMChain

    Chain to run queries against LLMs.

    This class is deprecated. See below for an example implementation using LangChain runnables:

    from langchain_core.output_parsers import StrOutputParser
    from langchain_core.prompts import PromptTemplate
    from langchain_openai import OpenAI
    
    prompt_template = "Tell me a {adjective} joke"
    prompt = PromptTemplate(input_variables=["adjective"], template=prompt_template)
    model = OpenAI()
    chain = prompt | model | StrOutputParser()
    
    chain.invoke("your adjective here")
    deprecatedclass
    StructuredChatAgent

    Structured Chat Agent.

    View source on GitHub