feat: support googleCustomSearchTool

This commit is contained in:
Hk-Gosuto
2023-12-26 13:23:57 +08:00
parent e60c0f009b
commit 1c845c5676
2 changed files with 49 additions and 26 deletions

View File

@@ -242,6 +242,15 @@ export class AgentApi {
func: async (input: string) => serpAPITool.call(input),
});
}
if (process.env.GOOGLE_CSE_ID && process.env.GOOGLE_API_KEY) {
console.log("use googleCustomSearchTool");
let googleCustomSearchTool = new langchainTools["GoogleCustomSearch"]();
searchTool = new DynamicTool({
name: "google_custom_search",
description: googleCustomSearchTool.description,
func: async (input: string) => googleCustomSearchTool.call(input),
});
}
const tools = [];