Constructs the agent's scratchpad from a list of steps. If the agent's scratchpad is not empty, it prepends a message indicating that the agent has not seen any previous work.
Array of AgentStep instances to construct the scratchpad from.
A Promise that resolves to a string representing the agent's scratchpad.
Decide what to do given some input.
Steps the LLM has taken so far, along with observations from each.
User inputs.
Optional
callbackManager: CallbackManagerCallback manager to use for this call.
Action specifying what tool to use.
Prepare the agent for output, if needed
Return response when agent has been stopped due to max iterations
Optional
callbackManager: CallbackManagerStatic
createCreate prompt in the style of the agent.
List of tools the agent will have access to, used to format the prompt.
Optional
args: StructuredChatCreatePromptArgsArguments to create the prompt with.
Static
createCreates a string representation of the schemas of the provided tools.
Array of StructuredTool instances to create the schemas string from.
A string representing the schemas of the provided tools.
Static
deserializeLoad an agent from a json-like object describing it.
Static
fromLLMAndCreates a StructuredChatAgent from an LLM and a list of tools. Validates the tools, creates a prompt, and sets up an LLM chain for the agent.
BaseLanguageModel instance to create the agent from.
Array of StructuredTool instances to create the agent from.
Optional
args: StructuredChatCreatePromptArgs & AgentArgsOptional arguments to customize the creation of the agent. Can include arguments for creating the prompt and AgentArgs.
A new instance of StructuredChatAgent.
Static
getReturns a default output parser for the StructuredChatAgent. If an LLM is provided, it creates an output parser with retry logic from the LLM.
Optional
fields: OutputParserArgs & { Optional fields to customize the output parser. Can include an LLM and a list of tool names.
An instance of StructuredChatOutputParserWithRetries.
Static
validate
Agent that interoperates with Structured Tools using React logic.
Deprecated
Use the method instead.