langchain.js
    Preparing search index...

    Agent for the MRKL chain.

    Hierarchy (View Summary)

    • Agent
      • ChatConversationalAgent
    Index

    Constructors

    Properties

    lc_namespace: string[] = ...
    llmChain: LLMChain
    outputParser: undefined | AgentActionOutputParser
    ToolType: ToolInterface

    Accessors

    • get allowedTools(): undefined | string[]

      Returns undefined | string[]

    • get inputKeys(): string[]

      Returns string[]

    • get returnValues(): string[]

      Returns string[]

    Methods

    • Return the string type key uniquely identifying multi or single action agents.

      Returns string

    • Return the string type key uniquely identifying this class of agent.

      Returns "chat-conversational-react-description"

    • Returns string[]

    • Constructs the agent scratchpad based on the agent steps. It returns an array of base messages representing the thoughts of the agent.

      Parameters

      • steps: AgentStep[]

        The agent steps to construct the scratchpad from.

      Returns Promise<BaseMessage[]>

      An array of base messages representing the thoughts of the agent.

    • Name of tool to use to terminate the chain.

      Returns string

    • Prefix to append the LLM call with.

      Returns string

    • Prefix to append the observation with.

      Returns string

    • Decide what to do given some input.

      Parameters

      • steps: AgentStep[]

        Steps the LLM has taken so far, along with observations from each.

      • inputs: ChainValues

        User inputs.

      • OptionalcallbackManager: any

        Callback manager to use for this call.

      Returns Promise<any>

      Action specifying what tool to use.

    • Prepare the agent for output, if needed

      Parameters

      • _returnValues: AgentFinish
      • _steps: AgentStep[]

      Returns Promise<AgentFinish>

    • Return response when agent has been stopped due to max iterations

      Parameters

      • earlyStoppingMethod: StoppingMethod
      • steps: AgentStep[]
      • inputs: ChainValues
      • OptionalcallbackManager: any

      Returns Promise<AgentFinish>

    • Create prompt in the style of the ChatConversationAgent.

      Parameters

      • tools: ToolInterface[]

        List of tools the agent will have access to, used to format the prompt.

      • Optionalargs: ChatConversationalCreatePromptArgs

        Arguments to create the prompt with.

        Interface defining the structure of arguments used to create a prompt for the ChatConversationalAgent class.

        • OptionalhumanMessage?: string

          String to put before the list of tools.

        • OptionalinputVariables?: string[]

          List of input variables the final prompt will expect.

        • OptionaloutputParser?: AgentActionOutputParser

          Output parser to use for formatting.

        • OptionalsystemMessage?: string

          String to put after the list of tools.

      Returns any

    • Load an agent from a json-like object describing it.

      Parameters

      Returns Promise<Agent>

    • Creates an instance of the ChatConversationalAgent class from a BaseLanguageModel and a set of tools. It takes optional arguments to customize the agent.

      Parameters

      • llm: BaseLanguageModelInterface

        The BaseLanguageModel to create the agent from.

      • tools: ToolInterface[]

        The set of tools to create the agent from.

      • Optionalargs: ChatConversationalCreatePromptArgs & AgentArgs

        Optional arguments to customize the agent.

      Returns ChatConversationalAgent

      An instance of the ChatConversationalAgent class.

    • Returns the default output parser for the ChatConversationalAgent class. It takes optional fields as arguments to customize the output parser.

      Parameters

      • Optionalfields: OutputParserArgs & { toolNames: string[] }

        Optional fields to customize the output parser.

      Returns AgentActionOutputParser

      The default output parser for the ChatConversationalAgent class.

    • Returns string

    • Validate that appropriate tools are passed in

      Parameters

      • tools: ToolInterface[]

      Returns void