diff --git a/packages/components/nodes/tools/AIPlugin/AIPlugin.ts b/packages/components/nodes/tools/AIPlugin/AIPlugin.ts new file mode 100644 index 000000000..6e7d9f8cf --- /dev/null +++ b/packages/components/nodes/tools/AIPlugin/AIPlugin.ts @@ -0,0 +1,43 @@ +import { INode, INodeData, INodeParams } from '../../../src/Interface' + +class AIPlugin implements INode { + label: string + name: string + description: string + type: string + icon: string + category: string + baseClasses: string[] + inputs?: INodeParams[] + + constructor() { + this.label = 'AI Plugin' + this.name = 'aiPlugin' + this.type = 'AIPlugin' + this.icon = 'aiplugin.svg' + this.category = 'Tools' + this.description = 'Execute actions using ChatGPT Plugin Url' + this.inputs = [ + { + label: 'Plugin Url', + name: 'pluginUrl', + type: 'string', + placeholder: 'https://www.klarna.com/.well-known/ai-plugin.json' + } + ] + } + + async getBaseClasses(): Promise { + return ['Tool'] + } + + async init(nodeData: INodeData): Promise { + const { AIPluginTool } = await import('langchain/tools') + const pluginUrl = nodeData.inputs?.pluginUrl as string + + const aiplugin = await AIPluginTool.fromPluginUrl(pluginUrl) + return aiplugin + } +} + +module.exports = { nodeClass: AIPlugin } diff --git a/packages/components/nodes/tools/AIPlugin/aiplugin.svg b/packages/components/nodes/tools/AIPlugin/aiplugin.svg new file mode 100644 index 000000000..e617e45c0 --- /dev/null +++ b/packages/components/nodes/tools/AIPlugin/aiplugin.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/packages/components/nodes/tools/RequestsGet/RequestsGet.ts b/packages/components/nodes/tools/RequestsGet/RequestsGet.ts new file mode 100644 index 000000000..379aa8dcb --- /dev/null +++ b/packages/components/nodes/tools/RequestsGet/RequestsGet.ts @@ -0,0 +1,33 @@ +import { INode } from '../../../src/Interface' +import { getBaseClasses } from '../../../src/utils' + +class RequestsGet implements INode { + label: string + name: string + description: string + type: string + icon: string + category: string + baseClasses: string[] + + constructor() { + this.label = 'Requests Get' + this.name = 'requestsGet' + this.type = 'RequestsGet' + this.icon = 'requestsget.svg' + this.category = 'Tools' + this.description = 'Execute HTTP GET requests' + } + + async getBaseClasses(): Promise { + const { RequestsGetTool } = await import('langchain/tools') + return getBaseClasses(RequestsGetTool) + } + + async init(): Promise { + const { RequestsGetTool } = await import('langchain/tools') + return new RequestsGetTool() + } +} + +module.exports = { nodeClass: RequestsGet } diff --git a/packages/components/nodes/tools/RequestsGet/requestsget.svg b/packages/components/nodes/tools/RequestsGet/requestsget.svg new file mode 100644 index 000000000..03777e7cd --- /dev/null +++ b/packages/components/nodes/tools/RequestsGet/requestsget.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/packages/components/nodes/tools/RequestsPost/RequestsPost.ts b/packages/components/nodes/tools/RequestsPost/RequestsPost.ts new file mode 100644 index 000000000..cc9946eab --- /dev/null +++ b/packages/components/nodes/tools/RequestsPost/RequestsPost.ts @@ -0,0 +1,33 @@ +import { INode } from '../../../src/Interface' +import { getBaseClasses } from '../../../src/utils' + +class RequestsPost implements INode { + label: string + name: string + description: string + type: string + icon: string + category: string + baseClasses: string[] + + constructor() { + this.label = 'Requests Post' + this.name = 'requestsPost' + this.type = 'RequestsPost' + this.icon = 'requestspost.svg' + this.category = 'Tools' + this.description = 'Execute HTTP POST requests' + } + + async getBaseClasses(): Promise { + const { RequestsPostTool } = await import('langchain/tools') + return getBaseClasses(RequestsPostTool) + } + + async init(): Promise { + const { RequestsPostTool } = await import('langchain/tools') + return new RequestsPostTool() + } +} + +module.exports = { nodeClass: RequestsPost } diff --git a/packages/components/nodes/tools/RequestsPost/requestspost.svg b/packages/components/nodes/tools/RequestsPost/requestspost.svg new file mode 100644 index 000000000..2bea6e967 --- /dev/null +++ b/packages/components/nodes/tools/RequestsPost/requestspost.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/packages/components/package.json b/packages/components/package.json index 0a211553d..2409969c6 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -27,6 +27,7 @@ "langchain": "^0.0.44", "moment": "^2.29.3", "node-fetch": "2", + "openai": "^3.2.1", "pdfjs-dist": "^3.5.141", "ws": "^8.9.0" },