Class responsible for calling a language model and deciding an action.

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

Use new agent creation methods.

Hierarchy (view full)

Constructors

Properties

ToolType: StructuredToolInterface<ZodObjectAny>
llmChain: LLMChain<string, LLMType>
outputParser: undefined | AgentActionOutputParser

Accessors

Methods

  • Construct a scratchpad to let the agent continue its thought process

    Parameters

    Returns Promise<string | BaseMessage[]>

  • Create a prompt for this class

    Parameters

    • _tools: StructuredToolInterface<ZodObjectAny>[]

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

    • Optional_fields: Record<string, any>

      Additional fields used to format the prompt.

    Returns BasePromptTemplate<any, BasePromptValueInterface, any>

    A PromptTemplate assembled from the given tools and fields.

  • Construct an agent from an LLM and a list of tools

    Parameters

    • _llm: BaseLanguageModelInterface<any, BaseLanguageModelCallOptions>
    • _tools: StructuredToolInterface<ZodObjectAny>[]
    • Optional_args: AgentArgs

    Returns Agent

  • Validate that appropriate tools are passed in

    Parameters

    • _tools: StructuredToolInterface<ZodObjectAny>[]

    Returns void