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

Remarks

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.

⚠️ Deprecated ⚠️

Use new agent creation methods.

This feature is deprecated and will be removed in the future.

It is not recommended for use.

Hierarchy (view full)

Constructors

Properties

ToolType: StructuredToolInterface<ZodObject<any, any, any, any, {}>>
llmChain: LLMChain<string, LLMType>
outputParser: undefined | AgentActionOutputParser

Accessors

Methods

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

    Parameters

    • steps: AgentStep[]

    Returns Promise<string | BaseMessage[]>

  • 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.

    • Optional callbackManager: CallbackManager

      Callback manager to use for this call.

    Returns Promise<AgentAction | AgentFinish>

    Action specifying what tool to use.

  • Create a prompt for this class

    Parameters

    • _tools: StructuredToolInterface<ZodObject<any, any, any, any, {}>>[]

      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<ZodObject<any, any, any, any, {}>>[]
    • Optional _args: AgentArgs

    Returns Agent

  • Validate that appropriate tools are passed in

    Parameters

    • _tools: StructuredToolInterface<ZodObject<any, any, any, any, {}>>[]

    Returns void

Generated using TypeDoc