Parses ReAct-style LLM calls that have a single tool input.
Expects output to be in one of two formats.
If the output signals that an action should be taken, should be in the below format. This will result in an AgentAction being returned.
Thought: agent thought hereAction: searchAction Input: what is the temperature in SF? Copy
Thought: agent thought hereAction: searchAction Input: what is the temperature in SF?
If the output signals that a final answer should be given, should be in the below format. This will result in an AgentFinish being returned.
Thought: agent thought hereFinal Answer: The temperature is 100 degrees Copy
Thought: agent thought hereFinal Answer: The temperature is 100 degrees
const runnableAgent = RunnableSequence.from([ ...rest of runnable new ReActSingleInputOutputParser({ toolNames: ["SerpAPI", "Calculator"] }),]);const agent = AgentExecutor.fromAgentAndTools({ agent: runnableAgent, tools: [new SerpAPI(), new Calculator()],});const result = await agent.invoke({ input: "whats the weather in pomfret?",}); Copy
const runnableAgent = RunnableSequence.from([ ...rest of runnable new ReActSingleInputOutputParser({ toolNames: ["SerpAPI", "Calculator"] }),]);const agent = AgentExecutor.fromAgentAndTools({ agent: runnableAgent, tools: [new SerpAPI(), new Calculator()],});const result = await agent.invoke({ input: "whats the weather in pomfret?",});
Returns the format instructions as a string. If the 'raw' option is true, returns the raw FORMAT_INSTRUCTIONS.
Format instructions as a string.
Parses the given text into an AgentAction or AgentFinish object. If an output fixing parser is defined, uses it to parse the text.
Text to parse.
Promise that resolves to an AgentAction or AgentFinish object.
Generated using TypeDoc
Parses ReAct-style LLM calls that have a single tool input.
Expects output to be in one of two formats.
If the output signals that an action should be taken, should be in the below format. This will result in an AgentAction being returned.
If the output signals that a final answer should be given, should be in the below format. This will result in an AgentFinish being returned.
Example