Example

const prompt = ChatPromptTemplate.fromMessages([
HumanMessagePromptTemplate.fromTemplate(AGENT_INSTRUCTIONS),
new MessagesPlaceholder("agent_scratchpad"),
]);
const runnableAgent = RunnableSequence.from([
...rest of runnable
prompt,
new ChatAnthropic({ modelName: "claude-2", temperature: 0 }).bind({
stop: ["</tool_input>", "</final_answer>"],
}),
new XMLAgentOutputParser(),
]);
const result = await executor.invoke({
input: "What is the weather in Honolulu?",
tools: [],
});

Hierarchy (view full)

Constructors

Methods

  • Parses the output text from the agent and returns an AgentAction or AgentFinish object.

    Parameters

    • text: string

      The output text from the agent.

    Returns Promise<any>

    An AgentAction or AgentFinish object.

Generated using TypeDoc