Closed shawnesquivel closed 1 year ago
I think you're looking for the DynamicTool
. You can find the documentation here.
The DynamicTool class takes as input a name, a description, and a function. Importantly, the name and the description will be used by the language model to determine when to call this function and with what parameters!
const tools = [
new DynamicTool({
name: "FOO",
description:
"call this to get the value of foo. input should be an empty string.",
func: () => "baz",
}),
new DynamicTool({
name: "BAR",
description:
"call this to get the value of bar. input should be an empty string.",
func: () => "baz1",
}),
];
thanks adam! that's exactly it.
I come from the langchain python docs, where it was quite simple to initialize an agent based on another function. What would be the equivalent of making a custom tool in langchainjs?
Thank you in advance! 🦜
python code i'm trying to replicate into langchainjs: