From 3e4278e4fe666eb834a83692316e9df1bdd13c48 Mon Sep 17 00:00:00 2001 From: chungyau97 Date: Tue, 16 May 2023 16:29:10 +0700 Subject: [PATCH] init --- .../nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts | 4 +- .../nodes/tools/ZapierNLA/ZapierNLA.ts | 46 ++++++++++++++++++ .../nodes/tools/ZapierNLA/zapier.png | Bin 0 -> 502 bytes 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts create mode 100644 packages/components/nodes/tools/ZapierNLA/zapier.png diff --git a/packages/components/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts b/packages/components/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts index 499b9383..f0bf54c0 100644 --- a/packages/components/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts +++ b/packages/components/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts @@ -26,7 +26,7 @@ class MRKLAgentLLM_Agents implements INode { { label: 'Allowed Tools', name: 'tools', - type: 'Tool', + type: 'Tool' || 'Tool[]', list: true }, { @@ -40,7 +40,7 @@ class MRKLAgentLLM_Agents implements INode { async init(nodeData: INodeData): Promise { const model = nodeData.inputs?.model as BaseLLM const tools = nodeData.inputs?.tools as Tool[] - + console.log(`something about tools: ${JSON.stringify(tools)}`) const executor = await initializeAgentExecutorWithOptions(tools, model, { agentType: 'zero-shot-react-description', verbose: true diff --git a/packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts b/packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts new file mode 100644 index 00000000..d38da20a --- /dev/null +++ b/packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts @@ -0,0 +1,46 @@ +import { ZapierNLAWrapper, ZapiterNLAWrapperParams } from 'langchain/tools' +import { INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses } from '../../../src/utils' +import { ZapierToolKit, createSqlAgent } from 'langchain/agents' + +class ZapierNLA_Tools implements INode { + label: string + name: string + description: string + type: string + icon: string + category: string + baseClasses: string[] + inputs: INodeParams[] + + constructor() { + this.label = 'Zapier NLA' + this.name = 'zapierNLA' + this.type = 'ZapierNLA' + this.icon = 'zapier.png' + this.category = 'Tools' + this.description = 'Access to apps and actions on Zapier's platform through a natural language API interface' + this.inputs = [ + { + label: 'Zapier NLA Api Key', + name: 'apiKey', + type: 'password' + } + ] + this.baseClasses = [this.type, ...getBaseClasses(ZapierNLAWrapper)] + } + + async init(nodeData: INodeData): Promise { + const apiKey = nodeData.inputs?.apiKey as string + + const obj: Partial = { + apiKey + } + const zapier = new ZapierNLAWrapper(obj) + const toolkit = await ZapierToolKit.fromZapierNLAWrapper(zapier) + + return toolkit.tools + } +} + +module.exports = { nodeClass: ZapierNLA_Tools } diff --git a/packages/components/nodes/tools/ZapierNLA/zapier.png b/packages/components/nodes/tools/ZapierNLA/zapier.png new file mode 100644 index 0000000000000000000000000000000000000000..769716faaadca77fcd3e7ac06c22ba570d37d2e6 GIT binary patch literal 502 zcmeAS@N?(olHy`uVBq!ia0vp^?I6s-1SB`N-i-xPjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL7@`Yh?3y^w370~qErU=qSVy9;*9)~xKIwD z7RFpp7srr_xVIM-MVTELj$9~>2wc9vtS{`rwEm`s`Qk!ziZ33Xs