Replies: 2 comments 4 replies
-
Hey there @Originn! Great to see you diving into another intriguing challenge with LangChain JS. Hope you've been doing awesome since our last chat! 🚀😄 Based on the information provided, it seems you want to integrate a custom tool into the Here's a step-by-step guide based on the context:
Here's a simplified example of adding a custom tool that returns the current date: const currentDateTool = new DynamicTool({
name: "current-date",
description: "Gets the current date.",
func: async () => new Date().toDateString(),
});
// Add the currentDateTool to the tools array
tools.push(currentDateTool);
// Then follow the same steps to create the agent and execute it This example demonstrates how to define a simple tool that returns the current date as a string. You can adapt this pattern to integrate any custom tool into the For more details, you can refer to the source code of the I hope this helps! If you have any further questions, feel free to ask. Sources
|
Beta Was this translation helpful? Give feedback.
-
My temporary solution is to call agentExecutor prior to ConversationalRetrievalQAChain and set a CustomTemplate to return NO if no tool was executed. If the output from agentExecutor is NO then ConversationalRetrievalQAChain is called, but if something else then do some logic with the agentExecutor response. If there is a better solution please let me know. Cheers. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Beta Was this translation helpful? Give feedback.
All reactions