diff --git a/local-ai-packaged/.env.example b/local-ai-packaged/.env.example new file mode 100644 index 0000000..c6d0332 --- /dev/null +++ b/local-ai-packaged/.env.example @@ -0,0 +1,8 @@ +# Change the name of this file to .env after updating it! + +POSTGRES_USER=root +POSTGRES_PASSWORD=password +POSTGRES_DB=n8n + +N8N_ENCRYPTION_KEY=super-secret-key +N8N_USER_MANAGEMENT_JWT_SECRET=even-more-secret \ No newline at end of file diff --git a/local-ai-packaged/LICENSE b/local-ai-packaged/LICENSE new file mode 100644 index 0000000..6f8b2bf --- /dev/null +++ b/local-ai-packaged/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2024-present n8n GmbH + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/local-ai-packaged/Local_RAG_AI_Agent_n8n_Workflow.json b/local-ai-packaged/Local_RAG_AI_Agent_n8n_Workflow.json new file mode 100644 index 0000000..6ba0169 --- /dev/null +++ b/local-ai-packaged/Local_RAG_AI_Agent_n8n_Workflow.json @@ -0,0 +1,648 @@ +{ + "name": "Local RAG AI Agent", + "nodes": [ + { + "parameters": {}, + "id": "99b30fd7-b36c-44ba-9daa-408585aaaee9", + "name": "Postgres Chat Memory", + "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat", + "typeVersion": 1.1, + "position": [ + 900, + 560 + ], + "credentials": { + "postgres": { + "id": "BAhZ6uu3zrQ3JmQm", + "name": "Postgres account" + } + } + }, + { + "parameters": { + "model": "llama3.1:latest", + "options": {} + }, + "id": "c7632a7c-2661-492e-bd6f-aab994818998", + "name": "Ollama Chat Model", + "type": "@n8n/n8n-nodes-langchain.lmChatOllama", + "typeVersion": 1, + "position": [ + 760, + 560 + ], + "credentials": { + "ollamaApi": { + "id": "tEBwcGKXQiQrbKjH", + "name": "Ollama account" + } + } + }, + { + "parameters": { + "model": "llama3.1:latest", + "options": {} + }, + "id": "73d773a4-5c72-4af3-a52d-144f0e417823", + "name": "Ollama Model", + "type": "@n8n/n8n-nodes-langchain.lmOllama", + "typeVersion": 1, + "position": [ + 1660, + 500 + ], + "credentials": { + "ollamaApi": { + "id": "tEBwcGKXQiQrbKjH", + "name": "Ollama account" + } + } + }, + { + "parameters": { + "name": "documents", + "topK": 3 + }, + "id": "3f882fa7-c8ed-4531-b236-a34c16c55838", + "name": "Vector Store Tool", + "type": "@n8n/n8n-nodes-langchain.toolVectorStore", + "typeVersion": 1, + "position": [ + 1440, + 340 + ] + }, + { + "parameters": { + "model": "nomic-embed-text:latest" + }, + "id": "3a8e3fa0-3997-4bce-985c-975fb5ad4013", + "name": "Embeddings Ollama", + "type": "@n8n/n8n-nodes-langchain.embeddingsOllama", + "typeVersion": 1, + "position": [ + 1540, + 600 + ], + "credentials": { + "ollamaApi": { + "id": "tEBwcGKXQiQrbKjH", + "name": "Ollama account" + } + } + }, + { + "parameters": { + "pollTimes": { + "item": [ + { + "mode": "everyMinute" + } + ] + }, + "triggerOn": "specificFolder", + "folderToWatch": { + "__rl": true, + "value": "1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC", + "mode": "list", + "cachedResultName": "Meeting Notes", + "cachedResultUrl": "https://drive.google.com/drive/folders/1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC" + }, + "event": "fileCreated", + "options": {} + }, + "id": "41fb71dd-236a-48bc-9761-5841d52ca1b3", + "name": "File Created", + "type": "n8n-nodes-base.googleDriveTrigger", + "typeVersion": 1, + "position": [ + 600, + 880 + ], + "credentials": { + "googleDriveOAuth2Api": { + "id": "hKn2avoGUt7FoAyY", + "name": "Google Drive account" + } + } + }, + { + "parameters": { + "pollTimes": { + "item": [ + { + "mode": "everyMinute" + } + ] + }, + "triggerOn": "specificFolder", + "folderToWatch": { + "__rl": true, + "value": "1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC", + "mode": "list", + "cachedResultName": "Meeting Notes", + "cachedResultUrl": "https://drive.google.com/drive/folders/1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC" + }, + "event": "fileUpdated", + "options": {} + }, + "id": "7b904686-89ae-4722-9ce5-a9da1b13b1a1", + "name": "File Updated", + "type": "n8n-nodes-base.googleDriveTrigger", + "typeVersion": 1, + "position": [ + 600, + 1100 + ], + "credentials": { + "googleDriveOAuth2Api": { + "id": "hKn2avoGUt7FoAyY", + "name": "Google Drive account" + } + } + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "10646eae-ae46-4327-a4dc-9987c2d76173", + "name": "file_id", + "value": "={{ $json.id }}", + "type": "string" + }, + { + "id": "dd0aa081-79e7-4714-8a67-1e898285554c", + "name": "folder_id", + "value": "={{ $json.parents[0] }}", + "type": "string" + } + ] + }, + "options": {} + }, + "id": "87f8bbb0-92c5-4b25-be63-7a9d91fc46f8", + "name": "Set File ID", + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 860, + 880 + ] + }, + { + "parameters": { + "operation": "download", + "fileId": { + "__rl": true, + "value": "={{ $('Set File ID').item.json.file_id }}", + "mode": "id" + }, + "options": { + "googleFileConversion": { + "conversion": { + "docsToFormat": "text/plain" + } + } + } + }, + "id": "9f1e08fb-4ef3-4c4d-9473-5a7a1608b8e3", + "name": "Download File", + "type": "n8n-nodes-base.googleDrive", + "typeVersion": 3, + "position": [ + 1300, + 880 + ], + "executeOnce": true, + "credentials": { + "googleDriveOAuth2Api": { + "id": "hKn2avoGUt7FoAyY", + "name": "Google Drive account" + } + } + }, + { + "parameters": { + "operation": "text", + "options": {} + }, + "id": "7efee822-68ad-4fe2-a616-ba19fd127684", + "name": "Extract Document Text", + "type": "n8n-nodes-base.extractFromFile", + "typeVersion": 1, + "position": [ + 1540, + 880 + ], + "alwaysOutputData": true + }, + { + "parameters": { + "options": { + "metadata": { + "metadataValues": [ + { + "name": "file_id", + "value": "={{ $('Set File ID').item.json.file_id }}" + }, + { + "name": "folder_id", + "value": "={{ $('Set File ID').item.json.folder_id }}" + } + ] + } + } + }, + "id": "da4c8b29-4944-43c4-9df3-e380366c594a", + "name": "Default Data Loader", + "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader", + "typeVersion": 1, + "position": [ + 1860, + 1100 + ] + }, + { + "parameters": { + "chunkSize": 100, + "options": {} + }, + "id": "d11c39b9-3fa7-4d5d-838f-da0d258c67c5", + "name": "Recursive Character Text Splitter", + "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter", + "typeVersion": 1, + "position": [ + 1860, + 1320 + ] + }, + { + "parameters": { + "model": "nomic-embed-text:latest" + }, + "id": "8a04559c-dfe8-479f-8998-a2e9bc994a0a", + "name": "Embeddings Ollama1", + "type": "@n8n/n8n-nodes-langchain.embeddingsOllama", + "typeVersion": 1, + "position": [ + 1700, + 1100 + ], + "credentials": { + "ollamaApi": { + "id": "tEBwcGKXQiQrbKjH", + "name": "Ollama account" + } + } + }, + { + "parameters": { + "content": "## Local RAG AI Agent with Chat Interface", + "height": 527.3027193303974, + "width": 670.6821106717343 + }, + "id": "a18773ae-1eb3-46b8-91cf-4184c66cf14f", + "name": "Sticky Note2", + "type": "n8n-nodes-base.stickyNote", + "typeVersion": 1, + "position": [ + 560, + 220 + ] + }, + { + "parameters": { + "content": "## Agent Tools for Local RAG", + "height": 528.85546469693, + "width": 583.4552380860637, + "color": 4 + }, + "id": "fa010a11-3dda-4bd5-b261-463a3a6b88d9", + "name": "Sticky Note", + "type": "n8n-nodes-base.stickyNote", + "typeVersion": 1, + "position": [ + 1240, + 220 + ] + }, + { + "parameters": { + "content": "## Workflow to Create Local Knowledgebase from Google Drive Folder", + "height": 705.2695614889159, + "width": 1568.9362829025763, + "color": 5 + }, + "id": "f29e6cc7-015e-47cb-a4fd-fecd6ffb0d24", + "name": "Sticky Note1", + "type": "n8n-nodes-base.stickyNote", + "typeVersion": 1, + "position": [ + 560, + 760 + ] + }, + { + "parameters": { + "options": {} + }, + "id": "c9dfe906-178b-4375-8bda-f9290f35f222", + "name": "AI Agent", + "type": "@n8n/n8n-nodes-langchain.agent", + "typeVersion": 1.6, + "position": [ + 840, + 340 + ] + }, + { + "parameters": { + "options": {} + }, + "id": "5da52326-dfbd-4350-919c-843461f58913", + "name": "When chat message received", + "type": "@n8n/n8n-nodes-langchain.chatTrigger", + "typeVersion": 1.1, + "position": [ + 620, + 340 + ], + "webhookId": "4b3b1838-d6b3-447e-9d79-d0931eddb9f8" + }, + { + "parameters": { + "qdrantCollection": { + "__rl": true, + "value": "documents", + "mode": "list", + "cachedResultName": "documents" + }, + "options": {} + }, + "id": "355370e0-2174-4e5b-830b-dd0f123b2e40", + "name": "Qdrant Vector Store", + "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant", + "typeVersion": 1, + "position": [ + 1260, + 480 + ], + "credentials": { + "qdrantApi": { + "id": "4sxNvYWRIrm2rKl9", + "name": "QdrantApi account" + } + } + }, + { + "parameters": { + "code": { + "execute": { + "code": "const { QdrantVectorStore } = require(\"@langchain/qdrant\");\nconst { OllamaEmbeddings } = require(\"@langchain/community/embeddings/ollama\");\n\nconst embeddings = new OllamaEmbeddings({\n model: \"nomic-embed-text\",\n baseUrl: \"http://host.docker.internal:11434\"\n});\n\nconst vectorStore = await QdrantVectorStore.fromExistingCollection(\n embeddings,\n {\n url: \"http://host.docker.internal:6333\",\n collectionName: \"documents\",\n }\n);\n\nconst fileIdToDelete = this.getInputData()[0].json.file_id;\n\nconst filter = {\n must: [\n {\n key: \"metadata.file_id\",\n match: {\n value: fileIdToDelete,\n },\n },\n ],\n }\n\n// const results = await vectorStore.similaritySearch(\"this\", 10, filter);\n// const idsToDelete = results.map((doc) => doc.id);\n\n// NOT IMPLEMENTED!\n// await vectorStore.delete({ ids: idsToDelete });\n\nvectorStore.client.delete(\"documents\", {\n filter\n});\n\nreturn [ {json: { file_id: fileIdToDelete } } ];\n" + } + }, + "inputs": { + "input": [ + { + "type": "main", + "required": true + } + ] + }, + "outputs": { + "output": [ + { + "type": "main" + } + ] + } + }, + "id": "b93bd001-0c4d-42fe-939a-eb441f354917", + "name": "Clear Old Vectors", + "type": "@n8n/n8n-nodes-langchain.code", + "typeVersion": 1, + "position": [ + 1080, + 880 + ], + "alwaysOutputData": false + }, + { + "parameters": { + "mode": "insert", + "qdrantCollection": { + "__rl": true, + "value": "documents", + "mode": "list", + "cachedResultName": "documents" + }, + "options": {} + }, + "id": "97ec4618-c0ea-445b-9406-5d41784d7836", + "name": "Qdrant Vector Store Insert", + "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant", + "typeVersion": 1, + "position": [ + 1760, + 880 + ], + "credentials": { + "qdrantApi": { + "id": "4sxNvYWRIrm2rKl9", + "name": "QdrantApi account" + } + } + } + ], + "pinData": {}, + "connections": { + "Postgres Chat Memory": { + "ai_memory": [ + [ + { + "node": "AI Agent", + "type": "ai_memory", + "index": 0 + } + ] + ] + }, + "Ollama Chat Model": { + "ai_languageModel": [ + [ + { + "node": "AI Agent", + "type": "ai_languageModel", + "index": 0 + } + ] + ] + }, + "Ollama Model": { + "ai_languageModel": [ + [ + { + "node": "Vector Store Tool", + "type": "ai_languageModel", + "index": 0 + } + ] + ] + }, + "Vector Store Tool": { + "ai_tool": [ + [ + { + "node": "AI Agent", + "type": "ai_tool", + "index": 0 + } + ] + ] + }, + "Embeddings Ollama": { + "ai_embedding": [ + [ + { + "node": "Qdrant Vector Store", + "type": "ai_embedding", + "index": 0 + } + ] + ] + }, + "File Created": { + "main": [ + [ + { + "node": "Set File ID", + "type": "main", + "index": 0 + } + ] + ] + }, + "File Updated": { + "main": [ + [ + { + "node": "Set File ID", + "type": "main", + "index": 0 + } + ] + ] + }, + "Set File ID": { + "main": [ + [ + { + "node": "Clear Old Vectors", + "type": "main", + "index": 0 + } + ] + ] + }, + "Download File": { + "main": [ + [ + { + "node": "Extract Document Text", + "type": "main", + "index": 0 + } + ] + ] + }, + "Extract Document Text": { + "main": [ + [ + { + "node": "Qdrant Vector Store Insert", + "type": "main", + "index": 0 + } + ] + ] + }, + "Default Data Loader": { + "ai_document": [ + [ + { + "node": "Qdrant Vector Store Insert", + "type": "ai_document", + "index": 0 + } + ] + ] + }, + "Recursive Character Text Splitter": { + "ai_textSplitter": [ + [ + { + "node": "Default Data Loader", + "type": "ai_textSplitter", + "index": 0 + } + ] + ] + }, + "Embeddings Ollama1": { + "ai_embedding": [ + [ + { + "node": "Qdrant Vector Store Insert", + "type": "ai_embedding", + "index": 0 + } + ] + ] + }, + "When chat message received": { + "main": [ + [ + { + "node": "AI Agent", + "type": "main", + "index": 0 + } + ] + ] + }, + "Qdrant Vector Store": { + "ai_vectorStore": [ + [ + { + "node": "Vector Store Tool", + "type": "ai_vectorStore", + "index": 0 + } + ] + ] + }, + "Clear Old Vectors": { + "main": [ + [ + { + "node": "Download File", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "active": false, + "settings": { + "executionOrder": "v1" + }, + "versionId": "24e894e6-ec51-4ed0-a3cb-2de36c5d887a", + "meta": { + "templateCredsSetupCompleted": true, + "instanceId": "eb51798708ee5e41b5338814f84985fff5b79dd7e443bf0d1f51648e6d6e003b" + }, + "id": "vTN9y2dLXqTiDfPT", + "tags": [] +} \ No newline at end of file diff --git a/local-ai-packaged/README.md b/local-ai-packaged/README.md new file mode 100644 index 0000000..b703e32 --- /dev/null +++ b/local-ai-packaged/README.md @@ -0,0 +1,213 @@ +# Self-hosted AI starter kit + +**Self-hosted AI Starter Kit** is an open, docker compose template that +quickly bootstraps a fully featured Local AI and Low Code development +environment. + +This is Cole's version with a couple of improvements! Also, +the local RAG AI Agent workflow from the video will be automatically in your +n8n instance if you use this setup instead of the base one provided by n8n! + +![n8n.io - Screenshot](https://raw.githubusercontent.com/n8n-io/self-hosted-ai-starter-kit/main/assets/n8n-demo.gif) + +Curated by , it combines the self-hosted n8n +platform with a curated list of compatible AI products and components to +quickly get started with building self-hosted AI workflows. + +> [!TIP] +> [Read the announcement](https://blog.n8n.io/self-hosted-ai/) + +### What’s included + +✅ [**Self-hosted n8n**](https://n8n.io/) - Low-code platform with over 400 +integrations and advanced AI components + +✅ [**Ollama**](https://ollama.com/) - Cross-platform LLM platform to install +and run the latest local LLMs + +✅ [**Qdrant**](https://qdrant.tech/) - Open-source, high performance vector +store with an comprehensive API + +✅ [**PostgreSQL**](https://www.postgresql.org/) - Workhorse of the Data +Engineering world, handles large amounts of data safely. + +### What you can build + +⭐️ AI Agents which can schedule appointments + +⭐️ Summarise company PDFs without leaking data + +⭐️ Smarter slack bots for company comms and IT-ops + +⭐️ Analyse financial documents privately and for little cost + +## Installation + +### For Nvidia GPU users + +``` +git clone https://github.com/n8n-io/self-hosted-ai-starter-kit.git +cd self-hosted-ai-starter-kit +docker compose --profile gpu-nvidia up +``` + +> [!NOTE] +> If you have not used your Nvidia GPU with Docker before, please follow the +> [Ollama Docker instructions](https://github.com/ollama/ollama/blob/main/docs/docker.md). + +### For Mac / Apple Silicon users + +If you’re using a Mac with an M1 or newer processor, you can't expose your GPU +to the Docker instance, unfortunately. There are two options in this case: + +1. Run the starter kit fully on CPU, like in the section "For everyone else" + below +2. Run Ollama on your Mac for faster inference, and connect to that from the + n8n instance + +If you want to run Ollama on your mac, check the +[Ollama homepage](https://ollama.com/) +for installation instructions, and run the starter kit as follows: + +``` +git clone https://github.com/n8n-io/self-hosted-ai-starter-kit.git +cd self-hosted-ai-starter-kit +docker compose up +``` + +After you followed the quick start set-up below, change the Ollama credentials +by using `http://host.docker.internal:11434/` as the host. + +### For everyone else + +``` +git clone https://github.com/n8n-io/self-hosted-ai-starter-kit.git +cd self-hosted-ai-starter-kit +docker compose --profile cpu up +``` + +## ⚡️ Quick start and usage + +The main component of the self-hosted AI starter kit is a docker compose file +pre-configured with network and disk so there isn’t much else you need to +install. After completing the installation steps above, follow the steps below +to get started. + +1. Open in your browser to set up n8n. You’ll only + have to do this once. +2. Open the included workflow: + +3. Select **Test workflow** to start running the workflow. +4. If this is the first time you’re running the workflow, you may need to wait + until Ollama finishes downloading Llama3.1. You can inspect the docker + console logs to check on the progress. + +To open n8n at any time, visit in your browser. + +With your n8n instance, you’ll have access to over 400 integrations and a +suite of basic and advanced AI nodes such as +[AI Agent](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/), +[Text classifier](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.text-classifier/), +and [Information Extractor](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.information-extractor/) +nodes. To keep everything local, just remember to use the Ollama node for your +language model and Qdrant as your vector store. + +> [!NOTE] +> This starter kit is designed to help you get started with self-hosted AI +> workflows. While it’s not fully optimized for production environments, it +> combines robust components that work well together for proof-of-concept +> projects. You can customize it to meet your specific needs + +## Upgrading + +### For Nvidia GPU users + +``` +docker compose --profile gpu-nvidia pull +docker compose create && docker compose --profile gpu-nvidia up +``` + +### For Mac / Apple Silicon users + +``` +docker compose pull +docker compose create && docker compose up +``` + +### For everyone else + +``` +docker compose --profile cpu pull +docker compose create && docker compose --profile cpu up +``` + +## 👓 Recommended reading + +n8n is full of useful content for getting started quickly with its AI concepts +and nodes. If you run into an issue, go to [support](#support). + +- [AI agents for developers: from theory to practice with n8n](https://blog.n8n.io/ai-agents/) +- [Tutorial: Build an AI workflow in n8n](https://docs.n8n.io/advanced-ai/intro-tutorial/) +- [Langchain Concepts in n8n](https://docs.n8n.io/advanced-ai/langchain/langchain-n8n/) +- [Demonstration of key differences between agents and chains](https://docs.n8n.io/advanced-ai/examples/agent-chain-comparison/) +- [What are vector databases?](https://docs.n8n.io/advanced-ai/examples/understand-vector-databases/) + +## 🎥 Video walkthrough + +- [Installing and using Local AI for n8n](https://www.youtube.com/watch?v=xz_X2N-hPg0) + +## 🛍️ More AI templates + +For more AI workflow ideas, visit the [**official n8n AI template +gallery**](https://n8n.io/workflows/?categories=AI). From each workflow, +select the **Use workflow** button to automatically import the workflow into +your local n8n instance. + +### Learn AI key concepts + +- [AI Agent Chat](https://n8n.io/workflows/1954-ai-agent-chat/) +- [AI chat with any data source (using the n8n workflow too)](https://n8n.io/workflows/2026-ai-chat-with-any-data-source-using-the-n8n-workflow-tool/) +- [Chat with OpenAI Assistant (by adding a memory)](https://n8n.io/workflows/2098-chat-with-openai-assistant-by-adding-a-memory/) +- [Use an open-source LLM (via HuggingFace)](https://n8n.io/workflows/1980-use-an-open-source-llm-via-huggingface/) +- [Chat with PDF docs using AI (quoting sources)](https://n8n.io/workflows/2165-chat-with-pdf-docs-using-ai-quoting-sources/) +- [AI agent that can scrape webpages](https://n8n.io/workflows/2006-ai-agent-that-can-scrape-webpages/) + +### Local AI templates + +- [Tax Code Assistant](https://n8n.io/workflows/2341-build-a-tax-code-assistant-with-qdrant-mistralai-and-openai/) +- [Breakdown Documents into Study Notes with MistralAI and Qdrant](https://n8n.io/workflows/2339-breakdown-documents-into-study-notes-using-templating-mistralai-and-qdrant/) +- [Financial Documents Assistant using Qdrant and](https://n8n.io/workflows/2335-build-a-financial-documents-assistant-using-qdrant-and-mistralai/) [Mistral.ai](http://mistral.ai/) +- [Recipe Recommendations with Qdrant and Mistral](https://n8n.io/workflows/2333-recipe-recommendations-with-qdrant-and-mistral/) + +## Tips & tricks + +### Accessing local files + +The self-hosted AI starter kit will create a shared folder (by default, +located in the same directory) which is mounted to the n8n container and +allows n8n to access files on disk. This folder within the n8n container is +located at `/data/shared` -- this is the path you’ll need to use in nodes that +interact with the local filesystem. + +**Nodes that interact with the local filesystem** + +- [Read/Write Files from Disk](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.filesreadwrite/) +- [Local File Trigger](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.localfiletrigger/) +- [Execute Command](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executecommand/) + +## 📜 License + +This project is licensed under the Apache License 2.0 - see the +[LICENSE](LICENSE) file for details. + +## 💬 Support + +Join the conversation in the [n8n Forum](https://community.n8n.io/), where you +can: + +- **Share Your Work**: Show off what you’ve built with n8n and inspire others + in the community. +- **Ask Questions**: Whether you’re just getting started or you’re a seasoned + pro, the community and our team are ready to support with any challenges. +- **Propose Ideas**: Have an idea for a feature or improvement? Let us know! + We’re always eager to hear what you’d like to see next. diff --git a/local-ai-packaged/assets/n8n-demo.gif b/local-ai-packaged/assets/n8n-demo.gif new file mode 100644 index 0000000..7efcdc9 Binary files /dev/null and b/local-ai-packaged/assets/n8n-demo.gif differ diff --git a/local-ai-packaged/docker-compose.yml b/local-ai-packaged/docker-compose.yml new file mode 100644 index 0000000..f56ebe6 --- /dev/null +++ b/local-ai-packaged/docker-compose.yml @@ -0,0 +1,129 @@ +volumes: + n8n_storage: + postgres_storage: + ollama_storage: + qdrant_storage: + +networks: + demo: + +x-n8n: &service-n8n + image: n8nio/n8n:latest + networks: ['demo'] + environment: + - DB_TYPE=postgresdb + - DB_POSTGRESDB_HOST=postgres + - DB_POSTGRESDB_USER=${POSTGRES_USER} + - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD} + - N8N_DIAGNOSTICS_ENABLED=false + - N8N_PERSONALIZATION_ENABLED=false + - N8N_ENCRYPTION_KEY + - N8N_USER_MANAGEMENT_JWT_SECRET + links: + - postgres + +x-ollama: &service-ollama + image: ollama/ollama:latest + container_name: ollama + networks: ['demo'] + restart: unless-stopped + ports: + - 11434:11434 + volumes: + - ollama_storage:/root/.ollama + +x-init-ollama: &init-ollama + image: ollama/ollama:latest + networks: ['demo'] + container_name: ollama-pull-llama + volumes: + - ollama_storage:/root/.ollama + entrypoint: /bin/sh + command: + - "-c" + - "sleep 3; OLLAMA_HOST=ollama:11434 ollama pull llama3.1; OLLAMA_HOST=ollama:11434 ollama pull nomic-embed-text" + +services: + postgres: + image: postgres:16-alpine + networks: ['demo'] + restart: unless-stopped + ports: + - 5432:5432 + environment: + - POSTGRES_USER + - POSTGRES_PASSWORD + - POSTGRES_DB + volumes: + - postgres_storage:/var/lib/postgresql/data + healthcheck: + test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}'] + interval: 5s + timeout: 5s + retries: 10 + + n8n-import: + <<: *service-n8n + container_name: n8n-import + entrypoint: /bin/sh + command: + - "-c" + - "n8n import:credentials --separate --input=/backup/credentials && n8n import:workflow --separate --input=/backup/workflows" + volumes: + - ./n8n/backup:/backup + depends_on: + postgres: + condition: service_healthy + + n8n: + <<: *service-n8n + container_name: n8n + restart: unless-stopped + ports: + - 5678:5678 + volumes: + - n8n_storage:/home/node/.n8n + - ./n8n/backup:/backup + - ./shared:/data/shared + depends_on: + postgres: + condition: service_healthy + n8n-import: + condition: service_completed_successfully + + qdrant: + image: qdrant/qdrant + container_name: qdrant + networks: ['demo'] + restart: unless-stopped + ports: + - 6333:6333 + volumes: + - qdrant_storage:/qdrant/storage + + ollama-cpu: + profiles: ["cpu"] + <<: *service-ollama + + ollama-gpu: + profiles: ["gpu-nvidia"] + <<: *service-ollama + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + + ollama-pull-llama-cpu: + profiles: ["cpu"] + <<: *init-ollama + depends_on: + - ollama-cpu + + ollama-pull-llama-gpu: + profiles: ["gpu-nvidia"] + <<: *init-ollama + depends_on: + - ollama-gpu diff --git a/local-ai-packaged/n8n/backup/workflows/Local_RAG_AI_Agent_n8n_Workflow.json b/local-ai-packaged/n8n/backup/workflows/Local_RAG_AI_Agent_n8n_Workflow.json new file mode 100644 index 0000000..c04a38d --- /dev/null +++ b/local-ai-packaged/n8n/backup/workflows/Local_RAG_AI_Agent_n8n_Workflow.json @@ -0,0 +1,648 @@ +{ + "name": "Local RAG AI Agent", + "nodes": [ + { + "parameters": {}, + "id": "99b30fd7-b36c-44ba-9daa-408585aaaee9", + "name": "Postgres Chat Memory", + "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat", + "typeVersion": 1.1, + "position": [ + 900, + 560 + ], + "credentials": { + "postgres": { + "id": "BAhZ6uu3zrQ3JmQm", + "name": "Postgres account" + } + } + }, + { + "parameters": { + "model": "llama3.1:latest", + "options": {} + }, + "id": "c7632a7c-2661-492e-bd6f-aab994818998", + "name": "Ollama Chat Model", + "type": "@n8n/n8n-nodes-langchain.lmChatOllama", + "typeVersion": 1, + "position": [ + 760, + 560 + ], + "credentials": { + "ollamaApi": { + "id": "tEBwcGKXQiQrbKjH", + "name": "Ollama account" + } + } + }, + { + "parameters": { + "model": "llama3.1:latest", + "options": {} + }, + "id": "73d773a4-5c72-4af3-a52d-144f0e417823", + "name": "Ollama Model", + "type": "@n8n/n8n-nodes-langchain.lmOllama", + "typeVersion": 1, + "position": [ + 1660, + 500 + ], + "credentials": { + "ollamaApi": { + "id": "tEBwcGKXQiQrbKjH", + "name": "Ollama account" + } + } + }, + { + "parameters": { + "name": "documents", + "topK": 3 + }, + "id": "3f882fa7-c8ed-4531-b236-a34c16c55838", + "name": "Vector Store Tool", + "type": "@n8n/n8n-nodes-langchain.toolVectorStore", + "typeVersion": 1, + "position": [ + 1440, + 340 + ] + }, + { + "parameters": { + "model": "nomic-embed-text:latest" + }, + "id": "3a8e3fa0-3997-4bce-985c-975fb5ad4013", + "name": "Embeddings Ollama", + "type": "@n8n/n8n-nodes-langchain.embeddingsOllama", + "typeVersion": 1, + "position": [ + 1540, + 600 + ], + "credentials": { + "ollamaApi": { + "id": "tEBwcGKXQiQrbKjH", + "name": "Ollama account" + } + } + }, + { + "parameters": { + "pollTimes": { + "item": [ + { + "mode": "everyMinute" + } + ] + }, + "triggerOn": "specificFolder", + "folderToWatch": { + "__rl": true, + "value": "1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC", + "mode": "list", + "cachedResultName": "Meeting Notes", + "cachedResultUrl": "https://drive.google.com/drive/folders/1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC" + }, + "event": "fileCreated", + "options": {} + }, + "id": "41fb71dd-236a-48bc-9761-5841d52ca1b3", + "name": "File Created", + "type": "n8n-nodes-base.googleDriveTrigger", + "typeVersion": 1, + "position": [ + 600, + 880 + ], + "credentials": { + "googleDriveOAuth2Api": { + "id": "hKn2avoGUt7FoAyY", + "name": "Google Drive account" + } + } + }, + { + "parameters": { + "pollTimes": { + "item": [ + { + "mode": "everyMinute" + } + ] + }, + "triggerOn": "specificFolder", + "folderToWatch": { + "__rl": true, + "value": "1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC", + "mode": "list", + "cachedResultName": "Meeting Notes", + "cachedResultUrl": "https://drive.google.com/drive/folders/1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC" + }, + "event": "fileUpdated", + "options": {} + }, + "id": "7b904686-89ae-4722-9ce5-a9da1b13b1a1", + "name": "File Updated", + "type": "n8n-nodes-base.googleDriveTrigger", + "typeVersion": 1, + "position": [ + 600, + 1100 + ], + "credentials": { + "googleDriveOAuth2Api": { + "id": "hKn2avoGUt7FoAyY", + "name": "Google Drive account" + } + } + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "10646eae-ae46-4327-a4dc-9987c2d76173", + "name": "file_id", + "value": "={{ $json.id }}", + "type": "string" + }, + { + "id": "dd0aa081-79e7-4714-8a67-1e898285554c", + "name": "folder_id", + "value": "={{ $json.parents[0] }}", + "type": "string" + } + ] + }, + "options": {} + }, + "id": "87f8bbb0-92c5-4b25-be63-7a9d91fc46f8", + "name": "Set File ID", + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 860, + 880 + ] + }, + { + "parameters": { + "operation": "download", + "fileId": { + "__rl": true, + "value": "={{ $('Set File ID').item.json.file_id }}", + "mode": "id" + }, + "options": { + "googleFileConversion": { + "conversion": { + "docsToFormat": "text/plain" + } + } + } + }, + "id": "9f1e08fb-4ef3-4c4d-9473-5a7a1608b8e3", + "name": "Download File", + "type": "n8n-nodes-base.googleDrive", + "typeVersion": 3, + "position": [ + 1300, + 880 + ], + "executeOnce": true, + "credentials": { + "googleDriveOAuth2Api": { + "id": "hKn2avoGUt7FoAyY", + "name": "Google Drive account" + } + } + }, + { + "parameters": { + "operation": "text", + "options": {} + }, + "id": "7efee822-68ad-4fe2-a616-ba19fd127684", + "name": "Extract Document Text", + "type": "n8n-nodes-base.extractFromFile", + "typeVersion": 1, + "position": [ + 1540, + 880 + ], + "alwaysOutputData": true + }, + { + "parameters": { + "options": { + "metadata": { + "metadataValues": [ + { + "name": "file_id", + "value": "={{ $('Set File ID').item.json.file_id }}" + }, + { + "name": "folder_id", + "value": "={{ $('Set File ID').item.json.folder_id }}" + } + ] + } + } + }, + "id": "da4c8b29-4944-43c4-9df3-e380366c594a", + "name": "Default Data Loader", + "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader", + "typeVersion": 1, + "position": [ + 1860, + 1100 + ] + }, + { + "parameters": { + "chunkSize": 100, + "options": {} + }, + "id": "d11c39b9-3fa7-4d5d-838f-da0d258c67c5", + "name": "Recursive Character Text Splitter", + "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter", + "typeVersion": 1, + "position": [ + 1860, + 1320 + ] + }, + { + "parameters": { + "model": "nomic-embed-text:latest" + }, + "id": "8a04559c-dfe8-479f-8998-a2e9bc994a0a", + "name": "Embeddings Ollama1", + "type": "@n8n/n8n-nodes-langchain.embeddingsOllama", + "typeVersion": 1, + "position": [ + 1700, + 1100 + ], + "credentials": { + "ollamaApi": { + "id": "tEBwcGKXQiQrbKjH", + "name": "Ollama account" + } + } + }, + { + "parameters": { + "content": "## Local RAG AI Agent with Chat Interface", + "height": 527.3027193303974, + "width": 670.6821106717343 + }, + "id": "a18773ae-1eb3-46b8-91cf-4184c66cf14f", + "name": "Sticky Note2", + "type": "n8n-nodes-base.stickyNote", + "typeVersion": 1, + "position": [ + 560, + 220 + ] + }, + { + "parameters": { + "content": "## Agent Tools for Local RAG", + "height": 528.85546469693, + "width": 583.4552380860637, + "color": 4 + }, + "id": "fa010a11-3dda-4bd5-b261-463a3a6b88d9", + "name": "Sticky Note", + "type": "n8n-nodes-base.stickyNote", + "typeVersion": 1, + "position": [ + 1240, + 220 + ] + }, + { + "parameters": { + "content": "## Workflow to Create Local Knowledgebase from Google Drive Folder", + "height": 705.2695614889159, + "width": 1568.9362829025763, + "color": 5 + }, + "id": "f29e6cc7-015e-47cb-a4fd-fecd6ffb0d24", + "name": "Sticky Note1", + "type": "n8n-nodes-base.stickyNote", + "typeVersion": 1, + "position": [ + 560, + 760 + ] + }, + { + "parameters": { + "options": {} + }, + "id": "c9dfe906-178b-4375-8bda-f9290f35f222", + "name": "AI Agent", + "type": "@n8n/n8n-nodes-langchain.agent", + "typeVersion": 1.6, + "position": [ + 840, + 340 + ] + }, + { + "parameters": { + "options": {} + }, + "id": "5da52326-dfbd-4350-919c-843461f58913", + "name": "When chat message received", + "type": "@n8n/n8n-nodes-langchain.chatTrigger", + "typeVersion": 1.1, + "position": [ + 620, + 340 + ], + "webhookId": "4b3b1838-d6b3-447e-9d79-d0931eddb9f8" + }, + { + "parameters": { + "qdrantCollection": { + "__rl": true, + "value": "documents", + "mode": "list", + "cachedResultName": "documents" + }, + "options": {} + }, + "id": "355370e0-2174-4e5b-830b-dd0f123b2e40", + "name": "Qdrant Vector Store", + "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant", + "typeVersion": 1, + "position": [ + 1260, + 480 + ], + "credentials": { + "qdrantApi": { + "id": "4sxNvYWRIrm2rKl9", + "name": "QdrantApi account" + } + } + }, + { + "parameters": { + "code": { + "execute": { + "code": "const { QdrantVectorStore } = require(\"@langchain/qdrant\");\nconst { OllamaEmbeddings } = require(\"@langchain/community/embeddings/ollama\");\n\nconst embeddings = new OllamaEmbeddings({\n model: \"nomic-embed-text\",\n baseUrl: \"http://host.docker.internal:11434\"\n});\n\nconst vectorStore = await QdrantVectorStore.fromExistingCollection(\n embeddings,\n {\n url: \"http://host.docker.internal:6333\",\n collectionName: \"documents\",\n }\n);\n\nconst fileIdToDelete = this.getInputData()[0].json.file_id;\n\nconst filter = {\n must: [\n {\n key: \"metadata.file_id\",\n match: {\n value: fileIdToDelete,\n },\n },\n ],\n }\n\n// const results = await vectorStore.similaritySearch(\"this\", 10, filter);\n// const idsToDelete = results.map((doc) => doc.id);\n\n// NOT IMPLEMENTED!\n// await vectorStore.delete({ ids: idsToDelete });\n\nvectorStore.client.delete(\"documents\", {\n filter\n});\n\nreturn [ {json: { file_id: fileIdToDelete } } ];\n" + } + }, + "inputs": { + "input": [ + { + "type": "main", + "required": true + } + ] + }, + "outputs": { + "output": [ + { + "type": "main" + } + ] + } + }, + "id": "b93bd001-0c4d-42fe-939a-eb441f354917", + "name": "Clear Old Vectors", + "type": "@n8n/n8n-nodes-langchain.code", + "typeVersion": 1, + "position": [ + 1080, + 880 + ], + "alwaysOutputData": false + }, + { + "parameters": { + "mode": "insert", + "qdrantCollection": { + "__rl": true, + "value": "documents", + "mode": "list", + "cachedResultName": "documents" + }, + "options": {} + }, + "id": "97ec4618-c0ea-445b-9406-5d41784d7836", + "name": "Qdrant Vector Store Insert", + "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant", + "typeVersion": 1, + "position": [ + 1760, + 880 + ], + "credentials": { + "qdrantApi": { + "id": "4sxNvYWRIrm2rKl9", + "name": "QdrantApi account" + } + } + } + ], + "pinData": {}, + "connections": { + "Postgres Chat Memory": { + "ai_memory": [ + [ + { + "node": "AI Agent", + "type": "ai_memory", + "index": 0 + } + ] + ] + }, + "Ollama Chat Model": { + "ai_languageModel": [ + [ + { + "node": "AI Agent", + "type": "ai_languageModel", + "index": 0 + } + ] + ] + }, + "Ollama Model": { + "ai_languageModel": [ + [ + { + "node": "Vector Store Tool", + "type": "ai_languageModel", + "index": 0 + } + ] + ] + }, + "Vector Store Tool": { + "ai_tool": [ + [ + { + "node": "AI Agent", + "type": "ai_tool", + "index": 0 + } + ] + ] + }, + "Embeddings Ollama": { + "ai_embedding": [ + [ + { + "node": "Qdrant Vector Store", + "type": "ai_embedding", + "index": 0 + } + ] + ] + }, + "File Created": { + "main": [ + [ + { + "node": "Set File ID", + "type": "main", + "index": 0 + } + ] + ] + }, + "File Updated": { + "main": [ + [ + { + "node": "Set File ID", + "type": "main", + "index": 0 + } + ] + ] + }, + "Set File ID": { + "main": [ + [ + { + "node": "Clear Old Vectors", + "type": "main", + "index": 0 + } + ] + ] + }, + "Download File": { + "main": [ + [ + { + "node": "Extract Document Text", + "type": "main", + "index": 0 + } + ] + ] + }, + "Extract Document Text": { + "main": [ + [ + { + "node": "Qdrant Vector Store Insert", + "type": "main", + "index": 0 + } + ] + ] + }, + "Default Data Loader": { + "ai_document": [ + [ + { + "node": "Qdrant Vector Store Insert", + "type": "ai_document", + "index": 0 + } + ] + ] + }, + "Recursive Character Text Splitter": { + "ai_textSplitter": [ + [ + { + "node": "Default Data Loader", + "type": "ai_textSplitter", + "index": 0 + } + ] + ] + }, + "Embeddings Ollama1": { + "ai_embedding": [ + [ + { + "node": "Qdrant Vector Store Insert", + "type": "ai_embedding", + "index": 0 + } + ] + ] + }, + "When chat message received": { + "main": [ + [ + { + "node": "AI Agent", + "type": "main", + "index": 0 + } + ] + ] + }, + "Qdrant Vector Store": { + "ai_vectorStore": [ + [ + { + "node": "Vector Store Tool", + "type": "ai_vectorStore", + "index": 0 + } + ] + ] + }, + "Clear Old Vectors": { + "main": [ + [ + { + "node": "Download File", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "active": false, + "settings": { + "executionOrder": "v1" + }, + "versionId": "24e894e6-ec51-4ed0-a3cb-2de36c5d887a", + "meta": { + "templateCredsSetupCompleted": true, + "instanceId": "eb51798708ee5e41b5338814f84985fff5b79dd7e443bf0d1f51648e6d6e003b" + }, + "id": "vTN9y2dLXqTiDfPT", + "tags": [] + } \ No newline at end of file diff --git a/local-ai-packaged/n8n/backup/workflows/srOnR8PAY3u4RSwb.json b/local-ai-packaged/n8n/backup/workflows/srOnR8PAY3u4RSwb.json new file mode 100644 index 0000000..3eda08d --- /dev/null +++ b/local-ai-packaged/n8n/backup/workflows/srOnR8PAY3u4RSwb.json @@ -0,0 +1,87 @@ +{ + "createdAt": "2024-02-23T16:58:31.616Z", + "updatedAt": "2024-02-23T16:58:31.616Z", + "id": "srOnR8PAY3u4RSwb", + "name": "Demo workflow", + "active": false, + "nodes": [ + { + "parameters": {}, + "id": "74003dcd-2ac7-4caa-a1cd-adecc5143c07", + "name": "Chat Trigger", + "type": "@n8n/n8n-nodes-langchain.chatTrigger", + "typeVersion": 1, + "position": [ + 660, + 340 + ], + "webhookId": "cdb5c076-d458-4b9d-8398-f43bd25059b1" + }, + { + "parameters": {}, + "id": "ce8c3da4-899c-4cc4-af73-8096c64eec64", + "name": "Basic LLM Chain", + "type": "@n8n/n8n-nodes-langchain.chainLlm", + "typeVersion": 1.3, + "position": [ + 880, + 340 + ] + }, + { + "parameters": { + "model": "llama3.1:latest", + "options": {} + }, + "id": "3dee878b-d748-4829-ac0a-cfd6705d31e5", + "name": "Ollama Chat Model", + "type": "@n8n/n8n-nodes-langchain.lmChatOllama", + "typeVersion": 1, + "position": [ + 900, + 560 + ], + "credentials": { + "ollamaApi": { + "id": "xHuYe0MDGOs9IpBW", + "name": "Local Ollama service" + } + } + } + ], + "connections": { + "Chat Trigger": { + "main": [ + [ + { + "node": "Basic LLM Chain", + "type": "main", + "index": 0 + } + ] + ] + }, + "Ollama Chat Model": { + "ai_languageModel": [ + [ + { + "node": "Basic LLM Chain", + "type": "ai_languageModel", + "index": 0 + } + ] + ] + } + }, + "settings": { + "executionOrder": "v1" + }, + "staticData": null, + "meta": { + "templateCredsSetupCompleted": true + }, + "pinData": {}, + "versionId": "4e2affe6-bb1c-4ddc-92f9-dde0b7656796", + "triggerCount": 0, + "tags": [] +}