Class AgentAbstract

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.

Hierarchy

Constructors

Properties

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

Accessors

  • get allowedTools(): undefined | string[]
  • Returns undefined | string[]

  • get inputKeys(): string[]
  • Returns string[]

  • get returnValues(): string[]
  • Returns string[]

Methods

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

    Parameters

    Returns Promise<string | BaseMessage[]>

  • 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

  • Prepare the agent for output, if needed

    Parameters

    • _returnValues: Record<string, any>
    • _steps: AgentStep[]

    Returns Promise<Record<string, any>>

  • Create a prompt for this class

    Parameters

    • _tools: StructuredTool<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, BasePromptValue, any>

    A PromptTemplate assembled from the given tools and fields.

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

    Parameters

    • data: Object

    Returns Promise<Agent>

  • Validate that appropriate tools are passed in

    Parameters

    Returns void

Generated using TypeDoc