langchain.js
    Preparing search index...

    Agent for the MRKL chain.

    Hierarchy (View Summary)

    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-zero-shot-react-description"

    • Returns string[]

    • Constructs the agent's scratchpad, which is a string representation of the agent's previous steps.

      Parameters

      • steps: AgentStep[]

        Array of AgentStep instances representing the agent's previous steps.

      Returns Promise<string>

      Promise resolving to a string representing the agent's scratchpad.

    • 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 zero shot agent.

      Parameters

      • tools: ToolInterface[]

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

      • Optionalargs: ChatCreatePromptArgs

        Arguments to create the prompt with.

        Interface for arguments used to create a chat prompt.

        • OptionalformatInstructions?: string

          Formattable string to use as the instructions template.

        • OptionalhumanMessageTemplate?: string

          String to use directly as the human message template.

        • OptionalinputVariables?: string[]

          List of input variables the final prompt will expect.

        • Optionalprefix?: string

          String to put before the list of tools.

        • Optionalsuffix?: 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 a ChatAgent instance using a language model, tools, and optional arguments.

      Parameters

      • llm: BaseLanguageModelInterface

        BaseLanguageModelInterface instance to use in the agent.

      • tools: ToolInterface[]

        Array of Tool instances to include in the agent.

      • Optionalargs: ChatCreatePromptArgs & AgentArgs

        Optional arguments to customize the agent and prompt.

      Returns ChatAgent

      ChatAgent instance

    • Returns string

    • Validates that all tools have descriptions. Throws an error if a tool without a description is found.

      Parameters

      • tools: ToolInterface[]

        Array of Tool instances to validate.

      Returns void

      void