langchainjs
langchainjs copied to clipboard
Unknown agent type when loading from hub
Loading the following agent fails with "UnhandledPromiseRejectionWarning: Error: Unknown agent type":
https://github.com/hwchase17/langchain-hub/tree/master/agents/zero-shot-react-conversation
const model = new ChatOpenAI({ temperature: 0});
const tools: Tool[] = [new SerpAPI(), new Calculator()];
const agent = await loadAgent(
"lc://agents/zero-shot-react-conversation/agent.json",
{ llm: model, tools }
);
However, the other agent works:
https://github.com/hwchase17/langchain-hub/tree/master/agents/zero-shot-react-description
The reason is very clear, only "zero-shot-react-description" is supported:
/**
* Load an agent from a json-like object describing it.
*/
static async deserialize(data) {
switch (data._type) {
case "zero-shot-react-description": {
const { ZeroShotAgent } = await import("./mrkl/index.js");
return ZeroShotAgent.deserialize(data);
}
default:
throw new Error("Unknown agent type");
}
}