From 4c576db1eb1346957e63eaf32818a42fdc747e5c Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 22 Apr 2023 15:06:13 +0100 Subject: [PATCH 1/2] add autogpt, readfile and writefile tools --- .../nodes/agents/AutoGPT/AutoGPT.ts | 97 ++++++++++++++++++ .../nodes/agents/AutoGPT/autogpt.png | Bin 0 -> 22256 bytes .../nodes/tools/ReadFile/ReadFile.ts | 42 ++++++++ .../nodes/tools/ReadFile/readfile.svg | 6 ++ .../nodes/tools/WriteFile/WriteFile.ts | 42 ++++++++ .../nodes/tools/WriteFile/writefile.svg | 6 ++ .../Chroma_Existing/Chroma_Existing.ts | 4 +- .../Chroma_Upsert/Chroma_Upsert.ts | 4 +- .../Pinecone_Existing/Pinecone_Existing.ts | 4 +- .../Pinecone_Upsert/Pinecone_Upsert.ts | 4 +- packages/components/package.json | 2 +- packages/ui/src/utils/genericHelper.js | 4 +- 12 files changed, 204 insertions(+), 11 deletions(-) create mode 100644 packages/components/nodes/agents/AutoGPT/AutoGPT.ts create mode 100644 packages/components/nodes/agents/AutoGPT/autogpt.png create mode 100644 packages/components/nodes/tools/ReadFile/ReadFile.ts create mode 100644 packages/components/nodes/tools/ReadFile/readfile.svg create mode 100644 packages/components/nodes/tools/WriteFile/WriteFile.ts create mode 100644 packages/components/nodes/tools/WriteFile/writefile.svg diff --git a/packages/components/nodes/agents/AutoGPT/AutoGPT.ts b/packages/components/nodes/agents/AutoGPT/AutoGPT.ts new file mode 100644 index 000000000..9ae9e90e3 --- /dev/null +++ b/packages/components/nodes/agents/AutoGPT/AutoGPT.ts @@ -0,0 +1,97 @@ +import { INode, INodeData, INodeParams } from '../../../src/Interface' +import { BaseChatModel } from 'langchain/chat_models' +import { AutoGPT } from 'langchain/experimental/autogpt' +import { Tool } from 'langchain/tools' +import { VectorStoreRetriever } from 'langchain/vectorstores/base' + +class AutoGPT_Agents implements INode { + label: string + name: string + description: string + type: string + icon: string + category: string + baseClasses: string[] + inputs: INodeParams[] + + constructor() { + this.label = 'AutoGPT' + this.name = 'autoGPT' + this.type = 'AutoGPT' + this.category = 'Agents' + this.icon = 'autogpt.png' + this.description = 'Autonomous agent with chain of thoughts by GPT4' + this.baseClasses = ['AutoGPT'] + this.inputs = [ + { + label: 'Allowed Tools', + name: 'tools', + type: 'Tool', + list: true + }, + { + label: 'Chat Model', + name: 'model', + type: 'BaseChatModel' + }, + { + label: 'Vector Store Retriever', + name: 'vectorStoreRetriever', + type: 'BaseRetriever' + }, + { + label: 'AutoGPT Name', + name: 'aiName', + type: 'string', + placeholder: 'Tom', + optional: true + }, + { + label: 'AutoGPT Role', + name: 'aiRole', + type: 'string', + placeholder: 'Assistant', + optional: true + }, + { + label: 'Maximum Loop', + name: 'maxLoop', + type: 'number', + default: 5, + optional: true + } + ] + } + + async init(nodeData: INodeData): Promise { + const model = nodeData.inputs?.model as BaseChatModel + const vectorStoreRetriever = nodeData.inputs?.vectorStoreRetriever as VectorStoreRetriever + const tools = nodeData.inputs?.tools as Tool[] + const aiName = (nodeData.inputs?.aiName as string) || 'AutoGPT' + const aiRole = (nodeData.inputs?.aiRole as string) || 'Assistant' + const maxLoop = nodeData.inputs?.maxLoop as string + + const autogpt = AutoGPT.fromLLMAndTools(model, tools, { + memory: vectorStoreRetriever, + aiName, + aiRole + }) + + autogpt.maxIterations = parseInt(maxLoop, 10) + + return autogpt + } + + async run(nodeData: INodeData, input: string): Promise { + const executor = nodeData.instance as AutoGPT + try { + const res = await executor.run([input]) + return res || 'I have completed all my tasks.' + } catch (e) { + console.error(e) + throw new Error(e) + } + } +} + +module.exports = { nodeClass: AutoGPT_Agents } diff --git a/packages/components/nodes/agents/AutoGPT/autogpt.png b/packages/components/nodes/agents/AutoGPT/autogpt.png new file mode 100644 index 0000000000000000000000000000000000000000..bdeff726c9ad905b2293d6a8bc5780fba06bf7f7 GIT binary patch literal 22256 zcma%CQ6F?*a$?y;rN(x~>qZwcin>8u z1Qn!Vlu$(-d6Y0p*+2n5idr#5B;a=d<^MGh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eh0&G8@3k4Z4~ufA-`Scn?cW_=*OY0REdlJ@fya^8ccniD@CBofk*fZf3 zUh`gQlpijaD}U>{XQu>JQRHQ+s@@vY)!UbAynD6kgi~~<<9u750K07oUbaX$+kCa= zLR|D;g&@yc_28j9mp&xE6HDA9QDE@nDP-gpk#Q zNNZ(PzBD7FbsdB!dSn+akQtCEL=i0X91~%{2?gODv4!8%O=}aSbQh7NULuosq!hfm z8S|Dj_8^NnWDpOBj7CKNcRNw=IVCQJ137bSyj{8Sk|P9*5;KsQWB* z;sf#IJiC%}?58cu+Tz&GCdYAJml=gIjw_11(g#=|Vcdo#+=&ocl92K87KwKRenczg zu$Zt3Gw5*Y&|-m!;o=>p2!bXidtfNfW)4BKlET@WW;e;;A}J00030|C61T&GXA6K>z>%07*qoM6N<$f=WfD A0{{R3 literal 0 HcmV?d00001 diff --git a/packages/components/nodes/tools/ReadFile/ReadFile.ts b/packages/components/nodes/tools/ReadFile/ReadFile.ts new file mode 100644 index 000000000..b66789438 --- /dev/null +++ b/packages/components/nodes/tools/ReadFile/ReadFile.ts @@ -0,0 +1,42 @@ +import { INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses } from '../../../src/utils' +import { ReadFileTool } from 'langchain/tools' +import { NodeFileStore } from 'langchain/stores/file/node' + +class ReadFile_Tools implements INode { + label: string + name: string + description: string + type: string + icon: string + category: string + baseClasses: string[] + inputs: INodeParams[] + + constructor() { + this.label = 'Read File' + this.name = 'readFile' + this.type = 'ReadFile' + this.icon = 'readfile.svg' + this.category = 'Tools' + this.description = 'Read file from disk' + this.baseClasses = [this.type, 'Tool', ...getBaseClasses(ReadFileTool)] + this.inputs = [ + { + label: 'Base Path', + name: 'basePath', + placeholder: `C:\\Users\\User\\Desktop`, + type: 'string', + optional: true + } + ] + } + + async init(nodeData: INodeData): Promise { + const basePath = nodeData.inputs?.basePath as string + const store = basePath ? new NodeFileStore(basePath) : new NodeFileStore() + return new ReadFileTool({ store }) + } +} + +module.exports = { nodeClass: ReadFile_Tools } diff --git a/packages/components/nodes/tools/ReadFile/readfile.svg b/packages/components/nodes/tools/ReadFile/readfile.svg new file mode 100644 index 000000000..3a57a762c --- /dev/null +++ b/packages/components/nodes/tools/ReadFile/readfile.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/packages/components/nodes/tools/WriteFile/WriteFile.ts b/packages/components/nodes/tools/WriteFile/WriteFile.ts new file mode 100644 index 000000000..208166d86 --- /dev/null +++ b/packages/components/nodes/tools/WriteFile/WriteFile.ts @@ -0,0 +1,42 @@ +import { INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses } from '../../../src/utils' +import { WriteFileTool } from 'langchain/tools' +import { NodeFileStore } from 'langchain/stores/file/node' + +class WriteFile_Tools implements INode { + label: string + name: string + description: string + type: string + icon: string + category: string + baseClasses: string[] + inputs: INodeParams[] + + constructor() { + this.label = 'Write File' + this.name = 'writeFile' + this.type = 'WriteFile' + this.icon = 'writefile.svg' + this.category = 'Tools' + this.description = 'Write file to disk' + this.baseClasses = [this.type, 'Tool', ...getBaseClasses(WriteFileTool)] + this.inputs = [ + { + label: 'Base Path', + name: 'basePath', + placeholder: `C:\\Users\\User\\Desktop`, + type: 'string', + optional: true + } + ] + } + + async init(nodeData: INodeData): Promise { + const basePath = nodeData.inputs?.basePath as string + const store = basePath ? new NodeFileStore(basePath) : new NodeFileStore() + return new WriteFileTool({ store }) + } +} + +module.exports = { nodeClass: WriteFile_Tools } diff --git a/packages/components/nodes/tools/WriteFile/writefile.svg b/packages/components/nodes/tools/WriteFile/writefile.svg new file mode 100644 index 000000000..72500bf64 --- /dev/null +++ b/packages/components/nodes/tools/WriteFile/writefile.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/packages/components/nodes/vectorstores/Chroma_Existing/Chroma_Existing.ts b/packages/components/nodes/vectorstores/Chroma_Existing/Chroma_Existing.ts index 904c44edc..ec9d28a17 100644 --- a/packages/components/nodes/vectorstores/Chroma_Existing/Chroma_Existing.ts +++ b/packages/components/nodes/vectorstores/Chroma_Existing/Chroma_Existing.ts @@ -21,7 +21,7 @@ class Chroma_Existing_VectorStores implements INode { this.icon = 'chroma.svg' this.category = 'Vector Stores' this.description = 'Load existing index from Chroma (i.e: Document has been upserted)' - this.baseClasses = [this.type, 'BaseRetriever'] + this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.inputs = [ { label: 'Embeddings', @@ -38,7 +38,7 @@ class Chroma_Existing_VectorStores implements INode { { label: 'Chroma Retriever', name: 'retriever', - baseClasses: [this.type, 'BaseRetriever'] + baseClasses: this.baseClasses }, { label: 'Chroma Vector Store', diff --git a/packages/components/nodes/vectorstores/Chroma_Upsert/Chroma_Upsert.ts b/packages/components/nodes/vectorstores/Chroma_Upsert/Chroma_Upsert.ts index d71f96ec9..3f3001709 100644 --- a/packages/components/nodes/vectorstores/Chroma_Upsert/Chroma_Upsert.ts +++ b/packages/components/nodes/vectorstores/Chroma_Upsert/Chroma_Upsert.ts @@ -22,7 +22,7 @@ class ChromaUpsert_VectorStores implements INode { this.icon = 'chroma.svg' this.category = 'Vector Stores' this.description = 'Upsert documents to Chroma' - this.baseClasses = [this.type, 'BaseRetriever'] + this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.inputs = [ { label: 'Document', @@ -44,7 +44,7 @@ class ChromaUpsert_VectorStores implements INode { { label: 'Chroma Retriever', name: 'retriever', - baseClasses: [this.type, 'BaseRetriever'] + baseClasses: this.baseClasses }, { label: 'Chroma Vector Store', diff --git a/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts b/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts index fd55de484..7b3223c89 100644 --- a/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts +++ b/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts @@ -22,7 +22,7 @@ class Pinecone_Existing_VectorStores implements INode { this.icon = 'pinecone.png' this.category = 'Vector Stores' this.description = 'Load existing index from Pinecone (i.e: Document has been upserted)' - this.baseClasses = [this.type, 'BaseRetriever'] + this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.inputs = [ { label: 'Embeddings', @@ -49,7 +49,7 @@ class Pinecone_Existing_VectorStores implements INode { { label: 'Pinecone Retriever', name: 'retriever', - baseClasses: [this.type, 'BaseRetriever'] + baseClasses: this.baseClasses }, { label: 'Pinecone Vector Store', diff --git a/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts b/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts index cbce7b4b2..6f72eb83a 100644 --- a/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts +++ b/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts @@ -23,7 +23,7 @@ class PineconeUpsert_VectorStores implements INode { this.icon = 'pinecone.png' this.category = 'Vector Stores' this.description = 'Upsert documents to Pinecone' - this.baseClasses = [this.type, 'BaseRetriever'] + this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.inputs = [ { label: 'Document', @@ -55,7 +55,7 @@ class PineconeUpsert_VectorStores implements INode { { label: 'Pinecone Retriever', name: 'retriever', - baseClasses: [this.type, 'BaseRetriever'] + baseClasses: this.baseClasses }, { label: 'Pinecone Vector Store', diff --git a/packages/components/package.json b/packages/components/package.json index 56b43d040..79782ca16 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -27,7 +27,7 @@ "dotenv": "^16.0.0", "express": "^4.17.3", "form-data": "^4.0.0", - "langchain": "^0.0.59", + "langchain": "^0.0.60", "moment": "^2.29.3", "node-fetch": "2", "pdf-parse": "^1.1.1", diff --git a/packages/ui/src/utils/genericHelper.js b/packages/ui/src/utils/genericHelper.js index dd63c1313..199373754 100644 --- a/packages/ui/src/utils/genericHelper.js +++ b/packages/ui/src/utils/genericHelper.js @@ -292,9 +292,9 @@ export const rearrangeToolsOrdering = (newValues, sourceNodeId) => { newValues.push(`{{${sourceNodeId}.data.instance}}`) const sortKey = (item) => { - if (item.includes('requestsGet')) { + if (item.includes('requestsGet') || item.includes('readFile')) { return 0 - } else if (item.includes('requestsPost')) { + } else if (item.includes('requestsPost') || item.includes('writeFile')) { return 1 } else { return 2 From aa2308d1aa8c7c80aed974929ebc1c628b926070 Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 22 Apr 2023 15:51:42 +0100 Subject: [PATCH 2/2] add marketplace template --- .../nodes/agents/AutoGPT/AutoGPT.ts | 2 +- packages/server/marketplaces/AutoGPT.json | 521 ++++++++++++++++++ 2 files changed, 522 insertions(+), 1 deletion(-) create mode 100644 packages/server/marketplaces/AutoGPT.json diff --git a/packages/components/nodes/agents/AutoGPT/AutoGPT.ts b/packages/components/nodes/agents/AutoGPT/AutoGPT.ts index 9ae9e90e3..a9314f791 100644 --- a/packages/components/nodes/agents/AutoGPT/AutoGPT.ts +++ b/packages/components/nodes/agents/AutoGPT/AutoGPT.ts @@ -20,7 +20,7 @@ class AutoGPT_Agents implements INode { this.type = 'AutoGPT' this.category = 'Agents' this.icon = 'autogpt.png' - this.description = 'Autonomous agent with chain of thoughts by GPT4' + this.description = 'Autonomous agent with chain of thoughts for self-guided task completion' this.baseClasses = ['AutoGPT'] this.inputs = [ { diff --git a/packages/server/marketplaces/AutoGPT.json b/packages/server/marketplaces/AutoGPT.json new file mode 100644 index 000000000..59d13ce6a --- /dev/null +++ b/packages/server/marketplaces/AutoGPT.json @@ -0,0 +1,521 @@ +{ + "description": "Use AutoGPT - Autonomous agent with chain of thoughts for self-guided task completion", + "nodes": [ + { + "width": 300, + "height": 552, + "id": "pineconeExistingIndex_0", + "position": { + "x": 901.718945246004, + "y": 444.1940851368503 + }, + "type": "customNode", + "data": { + "id": "pineconeExistingIndex_0", + "label": "Pinecone Load Existing Index", + "name": "pineconeExistingIndex", + "type": "Pinecone", + "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Load existing index from Pinecone (i.e: Document has been upserted)", + "inputParams": [ + { + "label": "Pinecone Api Key", + "name": "pineconeApiKey", + "type": "password", + "id": "pineconeExistingIndex_0-input-pineconeApiKey-password" + }, + { + "label": "Pinecone Environment", + "name": "pineconeEnv", + "type": "string", + "id": "pineconeExistingIndex_0-input-pineconeEnv-string" + }, + { + "label": "Pinecone Index", + "name": "pineconeIndex", + "type": "string", + "id": "pineconeExistingIndex_0-input-pineconeIndex-string" + } + ], + "inputAnchors": [ + { + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "pineconeExistingIndex_0-input-embeddings-Embeddings" + } + ], + "inputs": { + "embeddings": "{{openAIEmbeddings_0.data.instance}}", + "pineconeEnv": "us-west4-gcp", + "pineconeIndex": "test" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Pinecone Retriever", + "type": "Pinecone | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore", + "name": "vectorStore", + "label": "Pinecone Vector Store", + "type": "Pinecone | VectorStore" + } + ], + "default": "retriever" + } + ], + "outputs": { + "output": "retriever" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 901.718945246004, + "y": 444.1940851368503 + }, + "dragging": false + }, + { + "width": 300, + "height": 278, + "id": "serpAPI_0", + "position": { + "x": 1227.523512217788, + "y": -238.42913167235224 + }, + "type": "customNode", + "data": { + "id": "serpAPI_0", + "label": "Serp API", + "name": "serpAPI", + "type": "SerpAPI", + "baseClasses": ["SerpAPI", "Tool", "StructuredTool", "BaseLangChain"], + "category": "Tools", + "description": "Wrapper around SerpAPI - a real-time API to access Google search results", + "inputParams": [ + { + "label": "Serp Api Key", + "name": "apiKey", + "type": "password", + "id": "serpAPI_0-input-apiKey-password" + } + ], + "inputAnchors": [], + "inputs": {}, + "outputAnchors": [ + { + "id": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain", + "name": "serpAPI", + "label": "SerpAPI", + "type": "SerpAPI | Tool | StructuredTool | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1227.523512217788, + "y": -238.42913167235224 + }, + "dragging": false + }, + { + "width": 300, + "height": 472, + "id": "chatOpenAI_0", + "position": { + "x": 209.29564045622084, + "y": -57.95595709847885 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "category": "Chat Models", + "description": "Wrapper around OpenAI large language models that use the Chat endpoint", + "inputParams": [ + { + "label": "OpenAI Api Key", + "name": "openAIApiKey", + "type": "password", + "id": "chatOpenAI_0-input-openAIApiKey-password" + }, + { + "label": "Model Name", + "name": "modelName", + "type": "options", + "options": [ + { + "label": "gpt-4", + "name": "gpt-4" + }, + { + "label": "gpt-4-0314", + "name": "gpt-4-0314" + }, + { + "label": "gpt-4-32k-0314", + "name": "gpt-4-32k-0314" + }, + { + "label": "gpt-3.5-turbo", + "name": "gpt-3.5-turbo" + }, + { + "label": "gpt-3.5-turbo-0301", + "name": "gpt-3.5-turbo-0301" + } + ], + "default": "gpt-3.5-turbo", + "optional": true, + "id": "chatOpenAI_0-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": "0" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 209.29564045622084, + "y": -57.95595709847885 + }, + "dragging": false + }, + { + "width": 300, + "height": 278, + "id": "openAIEmbeddings_0", + "position": { + "x": 475.13407328701226, + "y": 487.8126876963096 + }, + "type": "customNode", + "data": { + "id": "openAIEmbeddings_0", + "label": "OpenAI Embeddings", + "name": "openAIEmbeddings", + "type": "OpenAIEmbeddings", + "baseClasses": ["OpenAIEmbeddings", "Embeddings"], + "category": "Embeddings", + "description": "OpenAI API to generate embeddings for a given text", + "inputParams": [ + { + "label": "OpenAI Api Key", + "name": "openAIApiKey", + "type": "password", + "id": "openAIEmbeddings_0-input-openAIApiKey-password" + } + ], + "inputAnchors": [], + "inputs": {}, + "outputAnchors": [ + { + "id": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "name": "openAIEmbeddings", + "label": "OpenAIEmbeddings", + "type": "OpenAIEmbeddings | Embeddings" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 475.13407328701226, + "y": 487.8126876963096 + }, + "dragging": false + }, + { + "width": 300, + "height": 278, + "id": "writeFile_0", + "position": { + "x": 550.6084292669964, + "y": 19.154090284731183 + }, + "type": "customNode", + "data": { + "id": "writeFile_0", + "label": "Write File", + "name": "writeFile", + "type": "WriteFile", + "baseClasses": ["WriteFile", "Tool", "StructuredTool", "BaseLangChain"], + "category": "Tools", + "description": "Write file to disk", + "inputParams": [ + { + "label": "Base Path", + "name": "basePath", + "placeholder": "C:\\Users\\Henry\\Desktop", + "type": "string", + "optional": true, + "id": "writeFile_0-input-basePath-string" + } + ], + "inputAnchors": [], + "inputs": { + "basePath": "C:\\Users\\Henry\\Desktop" + }, + "outputAnchors": [ + { + "id": "writeFile_0-output-writeFile-WriteFile|Tool|StructuredTool|BaseLangChain", + "name": "writeFile", + "label": "WriteFile", + "type": "WriteFile | Tool | StructuredTool | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 550.6084292669964, + "y": 19.154090284731183 + }, + "dragging": false + }, + { + "width": 300, + "height": 278, + "id": "readFile_0", + "position": { + "x": 885.888842186094, + "y": -120.40803047194753 + }, + "type": "customNode", + "data": { + "id": "readFile_0", + "label": "Read File", + "name": "readFile", + "type": "ReadFile", + "baseClasses": ["ReadFile", "Tool", "StructuredTool", "BaseLangChain"], + "category": "Tools", + "description": "Read file from disk", + "inputParams": [ + { + "label": "Base Path", + "name": "basePath", + "placeholder": "C:\\Users\\Henry\\Desktop", + "type": "string", + "optional": true, + "id": "readFile_0-input-basePath-string" + } + ], + "inputAnchors": [], + "inputs": { + "basePath": "C:\\Users\\Henry\\Desktop" + }, + "outputAnchors": [ + { + "id": "readFile_0-output-readFile-ReadFile|Tool|StructuredTool|BaseLangChain", + "name": "readFile", + "label": "ReadFile", + "type": "ReadFile | Tool | StructuredTool | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 885.888842186094, + "y": -120.40803047194753 + }, + "dragging": false + }, + { + "width": 300, + "height": 627, + "id": "autoGPT_0", + "position": { + "x": 1627.8124366169843, + "y": 129.76619452400155 + }, + "type": "customNode", + "data": { + "id": "autoGPT_0", + "label": "AutoGPT", + "name": "autoGPT", + "type": "AutoGPT", + "baseClasses": ["AutoGPT"], + "category": "Agents", + "description": "Autonomous agent with chain of thoughts by GPT4", + "inputParams": [ + { + "label": "AutoGPT Name", + "name": "aiName", + "type": "string", + "placeholder": "Tom", + "optional": true, + "id": "autoGPT_0-input-aiName-string" + }, + { + "label": "AutoGPT Role", + "name": "aiRole", + "type": "string", + "placeholder": "Assistant", + "optional": true, + "id": "autoGPT_0-input-aiRole-string" + }, + { + "label": "Maximum Loop", + "name": "maxLoop", + "type": "number", + "default": 5, + "optional": true, + "id": "autoGPT_0-input-maxLoop-number" + } + ], + "inputAnchors": [ + { + "label": "Allowed Tools", + "name": "tools", + "type": "Tool", + "list": true, + "id": "autoGPT_0-input-tools-Tool" + }, + { + "label": "Chat Model", + "name": "model", + "type": "BaseChatModel", + "id": "autoGPT_0-input-model-BaseChatModel" + }, + { + "label": "Vector Store Retriever", + "name": "vectorStoreRetriever", + "type": "BaseRetriever", + "id": "autoGPT_0-input-vectorStoreRetriever-BaseRetriever" + } + ], + "inputs": { + "tools": ["{{readFile_0.data.instance}}", "{{writeFile_0.data.instance}}", "{{serpAPI_0.data.instance}}"], + "model": "{{chatOpenAI_0.data.instance}}", + "vectorStoreRetriever": "{{pineconeExistingIndex_0.data.instance}}", + "aiName": "", + "aiRole": "", + "maxLoop": 5 + }, + "outputAnchors": [ + { + "id": "autoGPT_0-output-autoGPT-AutoGPT", + "name": "autoGPT", + "label": "AutoGPT", + "type": "AutoGPT" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1627.8124366169843, + "y": 129.76619452400155 + }, + "dragging": false + } + ], + "edges": [ + { + "source": "openAIEmbeddings_0", + "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "target": "pineconeExistingIndex_0", + "targetHandle": "pineconeExistingIndex_0-input-embeddings-Embeddings", + "type": "buttonedge", + "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_0-pineconeExistingIndex_0-input-embeddings-Embeddings", + "data": { + "label": "" + } + }, + { + "source": "serpAPI_0", + "sourceHandle": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain", + "target": "autoGPT_0", + "targetHandle": "autoGPT_0-input-tools-Tool", + "type": "buttonedge", + "id": "serpAPI_0-serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain-autoGPT_0-autoGPT_0-input-tools-Tool", + "data": { + "label": "" + } + }, + { + "source": "readFile_0", + "sourceHandle": "readFile_0-output-readFile-ReadFile|Tool|StructuredTool|BaseLangChain", + "target": "autoGPT_0", + "targetHandle": "autoGPT_0-input-tools-Tool", + "type": "buttonedge", + "id": "readFile_0-readFile_0-output-readFile-ReadFile|Tool|StructuredTool|BaseLangChain-autoGPT_0-autoGPT_0-input-tools-Tool", + "data": { + "label": "" + } + }, + { + "source": "writeFile_0", + "sourceHandle": "writeFile_0-output-writeFile-WriteFile|Tool|StructuredTool|BaseLangChain", + "target": "autoGPT_0", + "targetHandle": "autoGPT_0-input-tools-Tool", + "type": "buttonedge", + "id": "writeFile_0-writeFile_0-output-writeFile-WriteFile|Tool|StructuredTool|BaseLangChain-autoGPT_0-autoGPT_0-input-tools-Tool", + "data": { + "label": "" + } + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "target": "autoGPT_0", + "targetHandle": "autoGPT_0-input-model-BaseChatModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-autoGPT_0-autoGPT_0-input-model-BaseChatModel", + "data": { + "label": "" + } + }, + { + "source": "pineconeExistingIndex_0", + "sourceHandle": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "target": "autoGPT_0", + "targetHandle": "autoGPT_0-input-vectorStoreRetriever-BaseRetriever", + "type": "buttonedge", + "id": "pineconeExistingIndex_0-pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-autoGPT_0-autoGPT_0-input-vectorStoreRetriever-BaseRetriever", + "data": { + "label": "" + } + } + ] +}