feat: add folder support for workflows (fixes #70)
This commit is contained in:
@@ -0,0 +1,700 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "77ee6494-4898-47dc-81d9-35daf6f0beea",
|
||||
"name": "WhatsApp Trigger",
|
||||
"type": "n8n-nodes-base.whatsAppTrigger",
|
||||
"position": [
|
||||
1360,
|
||||
-280
|
||||
],
|
||||
"webhookId": "aaa71f03-f7af-4d18-8d9a-0afb86f1b554",
|
||||
"parameters": {
|
||||
"updates": [
|
||||
"messages"
|
||||
]
|
||||
},
|
||||
"credentials": {
|
||||
"whatsAppTriggerApi": {
|
||||
"id": "H3uYNtpeczKMqtYm",
|
||||
"name": "WhatsApp OAuth account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "57210e27-1f89-465a-98cc-43f890a4bf58",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
1960,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o-2024-08-06",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e1053235-0ade-4e36-9ad2-8b29c78fced8",
|
||||
"name": "Window Buffer Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
"position": [
|
||||
2080,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"sessionKey": "=whatsapp-75-{{ $json.messages[0].from }}",
|
||||
"sessionIdType": "customKey"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "69f1b78b-7c93-4713-863a-27e04809996f",
|
||||
"name": "Vector Store Tool",
|
||||
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
|
||||
"position": [
|
||||
2200,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"name": "query_product_brochure",
|
||||
"description": "Call this tool to query the product brochure. Valid for the year 2024."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "170e8f7d-7e14-48dd-9f80-5352cc411fc1",
|
||||
"name": "Embeddings OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
2200,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"model": "text-embedding-3-small",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ee78320b-d407-49e8-b4b8-417582a44709",
|
||||
"name": "OpenAI Chat Model1",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
2440,
|
||||
-60
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o-2024-08-06",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9dd89378-5acf-4ca6-8d84-e6e64254ed02",
|
||||
"name": "When clicking ‘Test workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
0,
|
||||
-240
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e68fc137-1bcb-43f0-b597-3ae07f380c15",
|
||||
"name": "Embeddings OpenAI1",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
760,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"model": "text-embedding-3-small",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2d31e92b-18d4-4f6b-8cdb-bed0056d50d7",
|
||||
"name": "Default Data Loader",
|
||||
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
||||
"position": [
|
||||
900,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"jsonData": "={{ $('Extract from File').item.json.text }}",
|
||||
"jsonMode": "expressionData"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ca0c015e-fba2-4dca-b0fe-bac66681725a",
|
||||
"name": "Recursive Character Text Splitter",
|
||||
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
|
||||
"position": [
|
||||
900,
|
||||
100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"chunkSize": 2000,
|
||||
"chunkOverlap": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "63abb6b2-b955-4e65-9c63-3211dca65613",
|
||||
"name": "Extract from File",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
360,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "pdf"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "be2add9c-3670-4196-8c38-82742bf4f283",
|
||||
"name": "get Product Brochure",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
180,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://usa.yamaha.com/files/download/brochure/1/1474881/Yamaha-Powered-Loudspeakers-brochure-2024-en-web.pdf",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "1ae5a311-36d7-4454-ab14-6788d1331780",
|
||||
"name": "Reply To User",
|
||||
"type": "n8n-nodes-base.whatsApp",
|
||||
"position": [
|
||||
2820,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"textBody": "={{ $json.output }}",
|
||||
"operation": "send",
|
||||
"phoneNumberId": "477115632141067",
|
||||
"requestOptions": {},
|
||||
"additionalFields": {
|
||||
"previewUrl": false
|
||||
},
|
||||
"recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
|
||||
},
|
||||
"credentials": {
|
||||
"whatsAppApi": {
|
||||
"id": "9SFJPeqrpChOkAmw",
|
||||
"name": "WhatsApp account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b6efba81-18b0-4378-bb91-51f39ca57f3e",
|
||||
"name": "Reply To User1",
|
||||
"type": "n8n-nodes-base.whatsApp",
|
||||
"position": [
|
||||
1760,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"textBody": "=I'm unable to process non-text messages. Please send only text messages. Thanks!",
|
||||
"operation": "send",
|
||||
"phoneNumberId": "477115632141067",
|
||||
"requestOptions": {},
|
||||
"additionalFields": {
|
||||
"previewUrl": false
|
||||
},
|
||||
"recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
|
||||
},
|
||||
"credentials": {
|
||||
"whatsAppApi": {
|
||||
"id": "9SFJPeqrpChOkAmw",
|
||||
"name": "WhatsApp account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "52decd86-ac6c-4d91-a938-86f93ec5f822",
|
||||
"name": "Product Catalogue",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
|
||||
"position": [
|
||||
2200,
|
||||
-60
|
||||
],
|
||||
"parameters": {
|
||||
"memoryKey": "whatsapp-75"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6dd5a652-2464-4ab8-8e5f-568529299523",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-88.75,
|
||||
-473.4375
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 640.4375,
|
||||
"height": 434.6875,
|
||||
"content": "## 1. Download Product Brochure PDF\n[Read more about the HTTP Request Tool](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest)\n\nImport your marketing PDF document to build your vector store. This will be used as the knowledgebase by the Sales AI Agent.\n\nFor this demonstration, we'll use the HTTP request node to import the YAMAHA POWERED LOUDSPEAKERS 2024 brochure ([Source](https://usa.yamaha.com/files/download/brochure/1/1474881/Yamaha-Powered-Loudspeakers-brochure-2024-en-web.pdf)) and an Extract from File node to extract the text contents. "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "116663bc-d8d6-41a5-93dc-b219adbb2235",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
580,
|
||||
-476
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 614.6875,
|
||||
"height": 731.1875,
|
||||
"content": "## 2. Create Product Brochure Vector Store\n[Read more about the In-Memory Vector Store](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreinmemory/)\n\nVector stores are powerful databases which serve the purpose of matching a user's questions to relevant parts of a document. By creating a vector store of our product catalog, we'll allow users to query using natural language.\n\nTo keep things simple, we'll use the **In-memory Vector Store** which comes built-in to n8n and doesn't require a separate service. For production deployments, I'd recommend replacing the in-memory vector store with either [Qdrant](https://qdrant.tech) or [Pinecone](https://pinecone.io)."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "86bd5334-d735-4650-aeff-06230119d705",
|
||||
"name": "Create Product Catalogue",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
|
||||
"position": [
|
||||
760,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "insert",
|
||||
"memoryKey": "whatsapp-75",
|
||||
"clearStore": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b8078b0d-cbd7-423f-bb30-13902988be38",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1254,
|
||||
-552
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 546.6875,
|
||||
"height": 484.1875,
|
||||
"content": "## 3. Use the WhatsApp Trigger\n[Learn more about the WhatsApp Trigger](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.whatsapptrigger/)\n\nThe WhatsApp Trigger allows you to receive incoming WhatsApp messages from customers. It requires a bit of setup so remember to follow the documentation carefully! Once ready however, it's quite easy to build powerful workflows which are easily accessible to users.\n\nNote that WhatsApp can send many message types such as audio and video so in this demonstration, we'll filter them out and just accept the text messages."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5bf7ed07-282b-4198-aa90-3e5ae5180404",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1640,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"width": 338,
|
||||
"height": 92,
|
||||
"content": "### Want to handle all message types?\nCheck out my other WhatsApp template in my creator page! https://n8n.io/creators/jimleuk/"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a3661b59-25d2-446e-8462-32b4d692b69d",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1640,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 337.6875,
|
||||
"height": 311.1875,
|
||||
"content": "### 3a. Handle Unsupported Message Types\nFor non-text messages, we'll just reply with a simple message to inform the sender."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ea3c9ee1-505a-40e7-82fe-9169bdbb80af",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1840,
|
||||
-682.5
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 746.6875,
|
||||
"height": 929.1875,
|
||||
"content": "## 4. Sales AI Agent Responds To Customers\n[Learn more about using AI Agents](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/)\n\nn8n's AI agents are powerful nodes which make it incredibly easy to use state-of-the-art AI in your workflows. Not only do they have the ability to remember conversations per individual customer but also tap into resources such as our product catalogue vector store to pull factual information and data for every question.\n\nIn this demonstration, we use an AI agent which is directed to help the user navigate the product brochure. A Chat memory subnode is attached to identify and keep track of the customer session. A Vector store tool is added to allow the Agent to tap into the product catalogue knowledgebase we built earlier."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5c72df8d-bca1-4634-b1ed-61ffec8bd103",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2620,
|
||||
-560
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 495.4375,
|
||||
"height": 484.1875,
|
||||
"content": "## 5. Repond to WhatsApp User\n[Learn more about the WhatsApp Node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.whatsapp/)\n\nThe WhatsApp node is the go-to if you want to interact with WhatsApp users. With this node, you can send text, images, audio and video messages as well as use your WhatsApp message templates.\n\nHere, we'll keep it simple by replying with a text message which is the output of the AI agent."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "48ec809f-ca0e-4052-b403-9ad7077b3fff",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-520,
|
||||
-620
|
||||
],
|
||||
"parameters": {
|
||||
"width": 401.25,
|
||||
"height": 582.6283033962263,
|
||||
"content": "## Try It Out!\n\n### This n8n template builds a simple WhatsApp chabot acting as a Sales Agent. The Agent is backed by a product catalog vector store to better answer user's questions.\n\n* This template is in 2 parts: creating the product catalog vector store and building the WhatsApp AI chatbot.\n* A product brochure is imported via HTTP request node and its text contents extracted.\n* The text contents are then uploaded to the in-memory vector store to build a knowledgebase for the chatbot.\n* A WhatsApp trigger is used to capture messages from customers where non-text messages are filtered out.\n* The customer's message is sent to the AI Agent which queries the product catalogue using the vector store tool.\n* The Agent's response is sent back to the user via the WhatsApp node.\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "87cf9b41-66de-49a7-aeb0-c8809191b5a0",
|
||||
"name": "Handle Message Types",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"position": [
|
||||
1560,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"outputKey": "Supported",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.messages[0].type }}",
|
||||
"rightValue": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "Not Supported",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "89971d8c-a386-4e77-8f6c-f491a8e84cb6",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEquals"
|
||||
},
|
||||
"leftValue": "={{ $json.messages[0].type }}",
|
||||
"rightValue": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.2
|
||||
},
|
||||
{
|
||||
"id": "e52f0a50-0c34-4c4a-b493-4c42ba112277",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-80,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 345.10906976744184,
|
||||
"height": 114.53583720930231,
|
||||
"content": "### You only have to run this part once!\nRun this step to populate our product catalogue vector. Run again if you want to update the vector store with a new version."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c1a7d6d1-191e-4343-af9f-f2c9eb4ecf49",
|
||||
"name": "Sticky Note9",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1260,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 364.6293255813954,
|
||||
"height": 107.02804651162779,
|
||||
"content": "### Activate your workflow to use!\nTo start using the WhatsApp chatbot, you'll need to activate the workflow. If you are self-hosting ensure WhatsApp is able to connect to your server."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a36524d0-22a6-48cc-93fe-b4571cec428a",
|
||||
"name": "AI Sales Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1960,
|
||||
-400
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ $json.messages[0].text.body }}",
|
||||
"options": {
|
||||
"systemMessage": "You are an assistant working for a company who sells Yamaha Powered Loudspeakers and helping the user navigate the product catalog for the year 2024. Your goal is not to facilitate a sale but if the user enquires, direct them to the appropriate website, url or contact information.\n\nDo your best to answer any questions factually. If you don't know the answer or unable to obtain the information from the datastore, then tell the user so."
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"AI Sales Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Reply To User",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"WhatsApp Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Handle Message Types",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Product Catalogue",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract from File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Product Catalogue",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Product Catalogue": {
|
||||
"ai_vectorStore": [
|
||||
[
|
||||
{
|
||||
"node": "Vector Store Tool",
|
||||
"type": "ai_vectorStore",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Vector Store Tool": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI1": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Create Product Catalogue",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model1": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Vector Store Tool",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Default Data Loader": {
|
||||
"ai_document": [
|
||||
[
|
||||
{
|
||||
"node": "Create Product Catalogue",
|
||||
"type": "ai_document",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Handle Message Types": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Reply To User1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Window Buffer Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"get Product Brochure": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract from File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Recursive Character Text Splitter": {
|
||||
"ai_textSplitter": [
|
||||
[
|
||||
{
|
||||
"node": "Default Data Loader",
|
||||
"type": "ai_textSplitter",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "get Product Brochure",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,283 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "f4f5d195bb2162a0972f737368404b18be694648d365d6c6771d7b4909d28167"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "b6cd232e-e82e-457b-9f03-c010b3eba148",
|
||||
"name": "When clicking 'Test workflow'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
-40,
|
||||
0
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2b734806-e3c0-4552-a491-54ca846ed3ac",
|
||||
"name": "Extract from File",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
620,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "binaryToPropery"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2c199499-cc4f-405c-8560-765500b7acba",
|
||||
"name": "Google Drive",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
420,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "18Ac2xorxirIBm9FNFDDB5aVUSPBCCg1U",
|
||||
"cachedResultUrl": "https://drive.google.com/file/d/18Ac2xorxirIBm9FNFDDB5aVUSPBCCg1U/view?usp=drivesdk",
|
||||
"cachedResultName": "Invoice-798FE2FA-0004.pdf"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "download"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "AUEpxwlqBJghNMtb",
|
||||
"name": "Google Drive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "e3031c0c-f059-4f30-9684-10014a277d55",
|
||||
"name": "Call Gemini 2.0 Flash with PDF Capabilities",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
880,
|
||||
220
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"contents\": [\n {\n \"parts\": [\n {\n \"inline_data\": {\n \"mime_type\": \"application/pdf\",\n \"data\": \"{{ $json.data }}\"\n }\n },\n {\n \"text\": \"{{ $('Define Prompt').item.json.prompt }}\"\n }\n ]\n }\n ]\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "googlePalmApi"
|
||||
},
|
||||
"credentials": {
|
||||
"anthropicApi": {
|
||||
"id": "eOt6Ois0jSizRFMJ",
|
||||
"name": "Anthropic Mira Account"
|
||||
},
|
||||
"googlePalmApi": {
|
||||
"id": "IQrjvfoUd5LUft3b",
|
||||
"name": "Google Gemini(PaLM) Api account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "135df716-32a1-47e8-9ed8-30c830b803d6",
|
||||
"name": "Call Claude 3.5 Sonnet with PDF Capabilities",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
880,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.anthropic.com/v1/messages",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"model\": \"claude-3-5-sonnet-20241022\",\n \"max_tokens\": 1024,\n \"messages\": [{\n \"role\": \"user\",\n \"content\": [{\n \"type\": \"document\",\n \"source\": {\n \"type\": \"base64\",\n \"media_type\": \"application/pdf\",\n \"data\": \"{{$json.data}}\"\n }\n },\n {\n \"type\": \"text\",\n \"text\": \"{{ $('Define Prompt').item.json.prompt }}\"\n }]\n }]\n}",
|
||||
"sendBody": true,
|
||||
"sendHeaders": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "anthropic-version",
|
||||
"value": "2023-06-01"
|
||||
},
|
||||
{
|
||||
"name": "content-type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "anthropicApi"
|
||||
},
|
||||
"credentials": {
|
||||
"anthropicApi": {
|
||||
"id": "eOt6Ois0jSizRFMJ",
|
||||
"name": "Anthropic Mira Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "5b8994d1-4bfd-4776-84ac-b3141aca6378",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-700,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 601,
|
||||
"height": 585,
|
||||
"content": "## Workflow: Extract data from PDF with Claude 3.5 Sonnet or Gemini 2.0 Flash\n\n**Overview**\n- This workflow helps you compare Claude 3.5 Sonnet and Gemini 2.0 Flash when extracting data from a PDF\n- This workflow extracts and processes the data within a PDF in **one single step**, **instead of calling an OCR and then an LLM”**\n\n\n**How it works**\n- The initial 2 steps download the PDF and convert it to base64.\n- This base64 string is then sent to both Claude 3.5 Sonnet and Gemini 2.0 Flash to extract information.\n- This workflow is made to let you compare results, latency, and cost (in their dedicated dashboard).\n\n\n**How to use it**\n- Set up your Google Drive if not already done\n- Select a document on your Google Drive\n- Modify the prompt in \"Define Prompt\" to extract the information you need and transform it as wanted.\n- Get a [Claude API key](https://console.anthropic.com/settings/keys) and/or [Gemini API key](https://aistudio.google.com/app/apikey)\n- Note that you can deactivate one of the 2 API calls if you don't want to try both\n- Test the Workflow\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "616241a9-6199-406b-88dc-0afc7d974250",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
820,
|
||||
60
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 320,
|
||||
"height": 360,
|
||||
"content": "You can output the result as JSON by adding the following:\n```\n\"generationConfig\": {\n \"responseMimeType\": \"application/json\"\n```\nor even use a structured output.\n[Check the documentation](https://ai.google.dev/gemini-api/docs/structured-output?lang=rest)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "bbac8d3d-d68f-4aa2-a41a-b06f7de2317b",
|
||||
"name": "Define Prompt",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
180,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "dba23ef5-95df-496a-8e24-c7c1544533d2",
|
||||
"name": "prompt",
|
||||
"type": "string",
|
||||
"value": "Extract the VAT numbers for each country"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "3c2e7265-76e5-4911-a950-7e6b0c89ec5a",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
820,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 320,
|
||||
"height": 240,
|
||||
"content": "You can force Claude to output JSON with [Prefill response format](https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#prefill-claudes-response)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f2b46305-5200-486e-ad4d-ecc0d2a14314",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
380,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 380,
|
||||
"height": 280,
|
||||
"content": "These 2 steps first download the PDF file, and then convert it to base64.\nThis is required by both APIs to process the file."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e5dff70f-b55a-4c23-9025-765a7cf19c4a",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
120,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 220,
|
||||
"height": 280,
|
||||
"content": "This prompt is used in both Gemini’s and Claude’s calls to define what information should be extracted and processed."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Google Drive": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract from File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Define Prompt": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Google Drive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract from File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call Claude 3.5 Sonnet with PDF Capabilities",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Call Gemini 2.0 Flash with PDF Capabilities",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking 'Test workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Define Prompt",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,422 @@
|
||||
{
|
||||
"id": "2Eba0OHGtOmoTWOU",
|
||||
"meta": {
|
||||
"instanceId": "9219ebc7795bea866f70aa3d977d54417fdf06c41944be95e20cfb60f992db19",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "RAG AI Agent with Milvus and Cohere",
|
||||
"tags": [
|
||||
{
|
||||
"id": "yj7cF3GCsZiargFT",
|
||||
"name": "rag",
|
||||
"createdAt": "2025-05-03T17:14:30.099Z",
|
||||
"updatedAt": "2025-05-03T17:14:30.099Z"
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "361065cc-edbf-47da-8da7-c59b564db6f3",
|
||||
"name": "Default Data Loader",
|
||||
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
||||
"position": [
|
||||
0,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a01b9512-ced1-4e28-a2aa-88077ab79d9a",
|
||||
"name": "Embeddings Cohere",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsCohere",
|
||||
"position": [
|
||||
-140,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"modelName": "embed-multilingual-v3.0"
|
||||
},
|
||||
"credentials": {
|
||||
"cohereApi": {
|
||||
"id": "8gcYMleu1b8Hm03D",
|
||||
"name": "CohereApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1da6ea4b-de88-44d3-a215-78c55b5592a2",
|
||||
"name": "When chat message received",
|
||||
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
|
||||
"position": [
|
||||
-800,
|
||||
520
|
||||
],
|
||||
"webhookId": "a4257301-3fb9-4b9d-a965-1fa66f314696",
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "23004477-3f6d-4909-a626-0eba0557a5bd",
|
||||
"name": "Watch New Files",
|
||||
"type": "n8n-nodes-base.googleDriveTrigger",
|
||||
"position": [
|
||||
-800,
|
||||
100
|
||||
],
|
||||
"parameters": {
|
||||
"event": "fileCreated",
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
},
|
||||
"triggerOn": "specificFolder",
|
||||
"folderToWatch": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "15gjDQZiHZuBeVscnK8Ic_kIWt3mOaVfs",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/folders/15gjDQZiHZuBeVscnK8Ic_kIWt3mOaVfs",
|
||||
"cachedResultName": "RAG template"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "r1DVmNxwkIL8JO17",
|
||||
"name": "Google Drive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "001fbdbe-dfcb-4552-bf09-de416b253389",
|
||||
"name": "Download New",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
-580,
|
||||
100
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $json.id }}"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "download"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "r1DVmNxwkIL8JO17",
|
||||
"name": "Google Drive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "c1116cba-beb9-4d28-843d-c5c21c0643de",
|
||||
"name": "Insert into Milvus",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreMilvus",
|
||||
"position": [
|
||||
-124,
|
||||
100
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "insert",
|
||||
"options": {
|
||||
"clearCollection": false
|
||||
},
|
||||
"milvusCollection": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "collectionName",
|
||||
"cachedResultName": "collectionName"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"milvusApi": {
|
||||
"id": "Gpsxqr2l9Qxu48h0",
|
||||
"name": "Milvus account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "2dbc7139-46f6-41d8-8c13-9fafad5aec55",
|
||||
"name": "RAG Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
-540,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.8
|
||||
},
|
||||
{
|
||||
"id": "a103506e-9019-41f2-9b0d-9b831434c9e9",
|
||||
"name": "Retrieve from Milvus",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreMilvus",
|
||||
"position": [
|
||||
-340,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "retrieve-as-tool",
|
||||
"topK": 10,
|
||||
"toolName": "vector_store",
|
||||
"toolDescription": "You are an AI agent that responds based on information received from a vector database.",
|
||||
"milvusCollection": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "collectionName",
|
||||
"cachedResultName": "collectionName"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"milvusApi": {
|
||||
"id": "Gpsxqr2l9Qxu48h0",
|
||||
"name": "Milvus account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "74ccdff1-b976-4e1c-a2c4-237ffff19e34",
|
||||
"name": "OpenAI 4o",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
-580,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o",
|
||||
"cachedResultName": "gpt-4o"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "vupAk5StuhOafQcb",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "36e35eaf-f723-4eeb-9658-143d5bc390a0",
|
||||
"name": "Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
"position": [
|
||||
-460,
|
||||
740
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1.3
|
||||
},
|
||||
{
|
||||
"id": "ec7b6b92-065c-455c-a3f0-17586d9e48d7",
|
||||
"name": "Cohere embeddings",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsCohere",
|
||||
"position": [
|
||||
-220,
|
||||
900
|
||||
],
|
||||
"parameters": {
|
||||
"modelName": "embed-multilingual-v3.0"
|
||||
},
|
||||
"credentials": {
|
||||
"cohereApi": {
|
||||
"id": "8gcYMleu1b8Hm03D",
|
||||
"name": "CohereApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3c3a8900-0b98-4479-8602-16b21e011ba1",
|
||||
"name": "Set Chunks",
|
||||
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
|
||||
"position": [
|
||||
80,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"chunkSize": 700,
|
||||
"chunkOverlap": 60
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3a43bf1a-7e22-4b5e-bbb1-6bb2c1798c07",
|
||||
"name": "Extract from File",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
-360,
|
||||
100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "pdf"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e0c9d4d7-5e3e-4e47-bb1f-dbdca360b20a",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1440,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"color": 2,
|
||||
"width": 540,
|
||||
"height": 600,
|
||||
"content": "## Why Milvus\nBased on comparisons and user feedback, **Milvus is often considered a more performant and scalable vector database solution compared to Supabase**, particularly for demanding use cases involving large datasets, high-volume vector search operations, and multilingual support.\n\n\n### Requirements\n- Create an account on [Zilliz](https://zilliz.com/) to generate the Milvus cluster. \n- There is no need to create docker containers or your own instance, Zilliz provides the cloud infraestructure to build it easily\n- Get your credentials ready from Drive, Milvus (Zilliz), and [Cohere](https://cohere.com)\n\n### Usage\nEvery time a new pdf is added into the Drive folder, it will be inserted into the Milvus Vector Store, allowing for the interaction with the RAG agent in seconds.\n\n## Calculate your company's RAG costs\n\nWant to run Milvus on your own server on n8n? Zilliz provides a great [cost calculator](https://zilliz.com/rag-cost-calculator/)\n\n### Get in touch with us\nWant to implement a RAG AI agent for your company? [Shoot us a message](https://1node.ai)\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": true,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "8b5fc2b8-50f7-425c-8fc8-94ba4f76ecf3",
|
||||
"connections": {
|
||||
"Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "RAG Agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI 4o": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "RAG Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Chunks": {
|
||||
"ai_textSplitter": [
|
||||
[
|
||||
{
|
||||
"node": "Default Data Loader",
|
||||
"type": "ai_textSplitter",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Download New": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract from File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Watch New Files": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Download New",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cohere embeddings": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Retrieve from Milvus",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings Cohere": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Insert into Milvus",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract from File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Insert into Milvus",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Default Data Loader": {
|
||||
"ai_document": [
|
||||
[
|
||||
{
|
||||
"node": "Insert into Milvus",
|
||||
"type": "ai_document",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Retrieve from Milvus": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "RAG Agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When chat message received": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "RAG Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "="
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "a2d54127-d1d1-44d2-859e-b89e2e6c3b4d",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
260,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "=",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "contains"
|
||||
},
|
||||
"leftValue": "={{ $json.subject }}",
|
||||
"rightValue": "CSRD Reporting"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "6a664023-ea8c-4973-b3ac-13a9e0664a58",
|
||||
"name": "Check the format",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
960,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "const content = $input.first().json.xhtml_content;\n\n// Helper to extract tags\nfunction extractTags(tagName) {\n const regex = new RegExp(`<${tagName}[^>]*>(.*?)<\\\\/${tagName}>`, 'gs');\n let matches = [];\n let match;\n while ((match = regex.exec(content)) !== null) {\n matches.push(match[1].trim());\n }\n return matches;\n}\n\n// Basic Tests\nconst headerPresent = /<ix:header>/i.test(content);\nconst governanceTag = /<ix:nonNumeric[^>]*name=\"esrs:SustainabilityGovernance\"/i.test(content);\nconst strategyTag = /<ix:nonNumeric[^>]*name=\"esrs:StrategySustainability\"/i.test(content);\n\n// KPI Tags\nconst kpiTags = [\"esrs:GHGScope1Emissions\", \"esrs:GHGScope2Emissions\", \"esrs:GHGScope3Emissions\"];\nconst kpiMatches = kpiTags.filter(tag => content.includes(tag));\n\n// Check for empty tags\nconst emptyNonNumeric = (content.match(/<ix:nonNumeric[^>]*>\\s*<\\/ix:nonNumeric>/g) || []).length;\n\n// Check duplicate text\nconst nonNumericValues = extractTags(\"ix:nonNumeric\");\nconst duplicates = [...new Set(nonNumericValues.filter((v, i, arr) => arr.indexOf(v) !== i))];\n\n// Final Result\nreturn [\n {\n json: {\n audit_results:{\n total_nonNumeric_tags: nonNumericValues.length,\n total_kpis_found: kpiMatches.length,\n empty_disclosures: emptyNonNumeric,\n governance_check: governanceTag ? \"PASS\" : \"MISSING\",\n strategy_check: strategyTag ? \"PASS\" : \"MISSING\",\n header_check: headerPresent ? \"PASS\" : \"MISSING\",\n duplicate_disclosures: duplicates,\n }\n\n }\n }\n];\n"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "a16b613e-a7c2-4079-9ff9-46c485019ca3",
|
||||
"name": "AI Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1240,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Generate an email to the sustainability team summarizing this CSRD XHTML report audit:\n\n{{JSON.stringify($json.audit_results, null, 2)}}\n\nReturn the output in the following JSON format:\n\n{\n \"subject\": \"...\",\n \"body\": \"...\"\n}",
|
||||
"options": {
|
||||
"systemMessage": "=You are LogiGreen CSRD Audit Bot, an ESG compliance assistant writing professional email summaries based on automated XHTML audits for CSRD compliance. Your role is to translate JSON audit results into clear, actionable summaries. Keep a neutral, helpful tone and highlight any risks or missing disclosures. Include key findings and suggest next steps if needed.\n\nWrite emails in plain English with no markdown (avoid **, #, ##, etc.).\nFormat your message with proper line breaks for readability.\nAlways sign with:\nBest regards,\nLogiGreen CSRD Audit Bot"
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.8
|
||||
},
|
||||
{
|
||||
"id": "3dcbaf39-58be-465e-9ec2-0b2a9a8c8fe3",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
1200,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "6e742627-f315-4ee2-be1b-023b38103978",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
1500,
|
||||
440
|
||||
],
|
||||
"parameters": {
|
||||
"jsonSchemaExample": "{\n \"subject\": \"CSRD XHTML Report Audit – Key Findings and Next Steps\",\n \"body\": \"Content of the email\"\n}"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "994e5b98-5bda-4a4f-a3eb-cb521de9d88a",
|
||||
"name": "Reply",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1620,
|
||||
260
|
||||
],
|
||||
"webhookId": "=",
|
||||
"parameters": {
|
||||
"message": "={{ $json.output.body }}",
|
||||
"options": {},
|
||||
"emailType": "text",
|
||||
"messageId": "={{ $('Gmail').item.json.id }}",
|
||||
"operation": "reply"
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "8a7fbdcb-2197-437e-b3ba-126c7942ba4d",
|
||||
"name": "Extract the HTML",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
800,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "return [\n {\n json: {\n xhtml_content:$input.first().json.data \n }\n }\n];\n"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "90f271b9-4b8b-49ef-90cc-d10d8e22a203",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
20,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 380,
|
||||
"height": 680,
|
||||
"content": "### 1. Workflow Trigger with Gmail Trigger\nThe workflow is triggered by a new email received in your Gmail mailbox. \nIf the subject includes the string \"CSRD Reporting\" we proceed, if not we do nothing.\n\n#### How to setup?\n- **Gmail Trigger Node:** set up your Gmail API credentials\n[Learn more about the Gmail Trigger Node](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.gmailtrigger)\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "803a758c-fba4-4f48-818b-1272c4509e81",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
440,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 640,
|
||||
"height": 680,
|
||||
"content": "### 2. Extract and Process the xHTML report\nThis block extract the attachment file from the email, process the xHTML and perform the audit of the content.\n\n#### How to setup?\n- **Gmail Node:** set up your Gmail API credentials\n[Learn more about the Gmail Trigger Node](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.gmailtrigger)\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0b72f7d8-23ce-4243-b2e5-e3ff5c7f163e",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1120,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 640,
|
||||
"height": 680,
|
||||
"content": "### 3. AI Agent write and sends an audit report to the send\nThis summarize the results of the analysis in an email sent as a reply to the sender.\n\n#### How to setup?\n- **Gmail Node:** set up your Gmail API credentials\n[Learn more about the Gmail Trigger Node](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.gmailtrigger)\n- **AI Agent with the Chat Model**:\n 1. Add a **chat model** with the required credentials *(Example: Open AI 4o-mini)*\n 2. Adapt the system prompt to the format of emails you want to send\n [Learn more about the AI Agent Node](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent)\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "18103fec-6761-4604-872e-dab251211ba0",
|
||||
"name": "HTML from binary",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
660,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "text",
|
||||
"binaryPropertyName": "attachment_0"
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5c31c49d-2324-4d08-a5b5-309925266517",
|
||||
"name": "Email Trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
40,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {},
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "bacbd57d-af9b-49c8-82ae-c74aa2898fc8",
|
||||
"name": "Download Attachment",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
480,
|
||||
260
|
||||
],
|
||||
"webhookId": "=",
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"options": {
|
||||
"downloadAttachments": true
|
||||
},
|
||||
"messageId": "={{ $json.id }}",
|
||||
"operation": "get"
|
||||
},
|
||||
"notesInFlow": true,
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "af087293-0c3c-4c96-9523-ddb9ed238e00",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1780,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"width": 780,
|
||||
"height": 540,
|
||||
"content": "### 4. Do you need more details?\nFind a step-by-step guide in this tutorial\n\n[🎥 Watch My Tutorial](https://www.youtube.com/watch?v=npeJZv5U7og)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"AI Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Reply",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Email Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check the format": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract the HTML": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check the format",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"HTML from binary": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract the HTML",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,915 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "6a2a7715680b8313f7cb4676321c5baa46680adfb913072f089f2766f42e43bd"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "f577f6bd-b1a4-48ec-9329-7bccc3fc1463",
|
||||
"name": "Get All files",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
400,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://yqtvdcvjboenlblgcivl.supabase.co/storage/v1/object/list/private",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"prefix\": \"\",\n \"limit\": 100,\n \"offset\": 0,\n \"sortBy\": {\n \"column\": \"name\",\n \"order\": \"asc\"\n }\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "supabaseApi"
|
||||
},
|
||||
"credentials": {
|
||||
"supabaseApi": {
|
||||
"id": "t8AQJzvZvrOMDLec",
|
||||
"name": "Supabase account My Airtable Gen"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "10693bc8-560d-4cf6-8bd0-2fe3f4d863d1",
|
||||
"name": "Default Data Loader",
|
||||
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
||||
"position": [
|
||||
1780,
|
||||
100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"metadata": {
|
||||
"metadataValues": [
|
||||
{
|
||||
"name": "=file_id",
|
||||
"value": "={{ $json.id }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"jsonData": "={{ $('Merge').item.json.data ?? $('Merge').item.json.text }}",
|
||||
"jsonMode": "expressionData"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "49428060-e707-4269-8344-77b301f56f7c",
|
||||
"name": "Recursive Character Text Splitter",
|
||||
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
|
||||
"position": [
|
||||
1780,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"chunkSize": 500,
|
||||
"chunkOverlap": 200
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "08742063-e235-4874-a128-b352786b19ce",
|
||||
"name": "Extract Document PDF",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
1240,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "pdf"
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "21f19360-d7ce-4106-ae5a-aa0f15b7c4aa",
|
||||
"name": "Embeddings OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
1600,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"model": "text-embedding-3-small",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "fLfRtaXbR0EVD0pl",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4147409f-8686-418f-b979-04f8c8e7fe42",
|
||||
"name": "Create File record2",
|
||||
"type": "n8n-nodes-base.supabase",
|
||||
"position": [
|
||||
1540,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"tableId": "files",
|
||||
"fieldsUi": {
|
||||
"fieldValues": [
|
||||
{
|
||||
"fieldId": "name",
|
||||
"fieldValue": "={{ $('Loop Over Items').item.json.name }}"
|
||||
},
|
||||
{
|
||||
"fieldId": "storage_id",
|
||||
"fieldValue": "={{ $('Loop Over Items').item.json.id }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"supabaseApi": {
|
||||
"id": "t8AQJzvZvrOMDLec",
|
||||
"name": "Supabase account My Airtable Gen"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "016f1afe-172b-4609-b451-8d67609214d3",
|
||||
"name": "If",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
720,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "9b14e306-a04d-40f7-bc5b-b8eda8d8f7f2",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ \n !$('Aggregate').item.json.data || \n !Array.isArray($('Aggregate').item.json.data) || \n !$('Aggregate').item.json.data.some(item => \n item.storage_id === $('Loop Over Items').item.json.id \n ) \n}}",
|
||||
"rightValue": ""
|
||||
},
|
||||
{
|
||||
"id": "c3c0af88-9aea-4539-8948-1b69e601c27c",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEquals"
|
||||
},
|
||||
"leftValue": "={{ $json.name }}",
|
||||
"rightValue": ".emptyFolderPlaceholder"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "75e8a7db-8c4a-4ad8-b902-062cbc93e1eb",
|
||||
"name": "Get All Files",
|
||||
"type": "n8n-nodes-base.supabase",
|
||||
"position": [
|
||||
20,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"tableId": "files",
|
||||
"operation": "getAll"
|
||||
},
|
||||
"credentials": {
|
||||
"supabaseApi": {
|
||||
"id": "t8AQJzvZvrOMDLec",
|
||||
"name": "Supabase account My Airtable Gen"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "b22a3bab-f615-4d8a-8832-ce25b1a385fe",
|
||||
"name": "Download",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
900,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://yqtvdcvjboenlblgcivl.supabase.co/storage/v1/object/private/{{ $json.name }}",
|
||||
"options": {},
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "supabaseApi"
|
||||
},
|
||||
"credentials": {
|
||||
"supabaseApi": {
|
||||
"id": "t8AQJzvZvrOMDLec",
|
||||
"name": "Supabase account My Airtable Gen"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "50d1fede-4bd0-4cd4-b74a-7d689fe211cc",
|
||||
"name": "Loop Over Items",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"position": [
|
||||
560,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"batchSize": "=1"
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "f9c23b5e-0b40-4886-b54f-59fb46132d3f",
|
||||
"name": "When clicking \u2018Test workflow\u2019",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
-160,
|
||||
-100
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0a0ec290-2c3d-40ba-8d03-6abf75202e73",
|
||||
"name": "Aggregate",
|
||||
"type": "n8n-nodes-base.aggregate",
|
||||
"position": [
|
||||
220,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"aggregate": "aggregateAllItemData"
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "32b3e2e1-2d25-4dd1-93e8-3f693beb7b6f",
|
||||
"name": "When chat message received",
|
||||
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
|
||||
"position": [
|
||||
800,
|
||||
-1020
|
||||
],
|
||||
"webhookId": "3c40d311-7996-4ed4-b2fa-c73bea5f4cf5",
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "79073b5c-a4ad-45a6-bbfa-e900a05bfde3",
|
||||
"name": "OpenAI Chat Model1",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
940,
|
||||
-820
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "zJhr5piyEwVnWtaI",
|
||||
"name": "OpenAi club"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f8663483-76d5-4fc8-ad07-7eec815ff7a6",
|
||||
"name": "Embeddings OpenAI2",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
1020,
|
||||
-540
|
||||
],
|
||||
"parameters": {
|
||||
"model": "text-embedding-3-small",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "SphXAX7rlwRLkiox",
|
||||
"name": "Test club key"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a1458799-d379-46de-93e6-a5ba0c665163",
|
||||
"name": "OpenAI Chat Model2",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
1300,
|
||||
-680
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "SphXAX7rlwRLkiox",
|
||||
"name": "Test club key"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "d6eeda2f-c984-406d-a625-726840308413",
|
||||
"name": "Vector Store Tool1",
|
||||
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
|
||||
"position": [
|
||||
1100,
|
||||
-820
|
||||
],
|
||||
"parameters": {
|
||||
"name": "knowledge_base",
|
||||
"topK": 8,
|
||||
"description": "Retrieve data about user request"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e1d9a348-7d44-4ad1-adbd-2c9a31e06876",
|
||||
"name": "Switch",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"position": [
|
||||
1060,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"outputKey": "txt",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 1,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{$binary.data?.fileExtension == undefined }}",
|
||||
"rightValue": "txt"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "pdf",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 1,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "bf04cbec-dd86-4607-988f-4c96b6fd4b58",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{$binary.data.fileExtension }}",
|
||||
"rightValue": "pdf"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.1
|
||||
},
|
||||
{
|
||||
"id": "d38afb92-87ae-4e2a-a712-ec24b1efd105",
|
||||
"name": "Insert into Supabase Vectorstore",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
|
||||
"position": [
|
||||
1700,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "insert",
|
||||
"options": {
|
||||
"queryName": "match_documents"
|
||||
},
|
||||
"tableName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "documents",
|
||||
"cachedResultName": "documents"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"supabaseApi": {
|
||||
"id": "t8AQJzvZvrOMDLec",
|
||||
"name": "Supabase account My Airtable Gen"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1a903b2e-cab0-4798-b820-ec08d6a71ddd",
|
||||
"name": "Merge",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
1380,
|
||||
-100
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "3afd552e-4995-493e-9cd5-ef496dfe359f",
|
||||
"name": "AI Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1020,
|
||||
-1020
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.7
|
||||
},
|
||||
{
|
||||
"id": "d9688acc-311b-42fd-afa8-2c0e493be34b",
|
||||
"name": "Supabase Vector Store",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
|
||||
"position": [
|
||||
1020,
|
||||
-660
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"metadata": {
|
||||
"metadataValues": [
|
||||
{
|
||||
"name": "file_id",
|
||||
"value": "300b0128-0955-4058-b0d3-a9aefe728432"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"tableName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "documents",
|
||||
"cachedResultName": "documents"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"supabaseApi": {
|
||||
"id": "t8AQJzvZvrOMDLec",
|
||||
"name": "Supabase account My Airtable Gen"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "66df007c-0418-4551-950e-32e7d79840bd",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
340,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"height": 89.3775420487804,
|
||||
"content": "### Replace Storage name, database ID and credentials."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b164b520-20dd-44a4-aa3b-647391786b20",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-20,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"height": 80,
|
||||
"content": "### Replace credentials."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8688c219-5af4-4e54-9fd1-91851829445b",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1540,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"height": 80,
|
||||
"content": "### Replace credentials."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "45c6ece4-f849-4496-8149-31385f5e36a4",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
840,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"height": 89.3775420487804,
|
||||
"content": "### Replace Storage name, database ID and credentials."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2ca07cb0-b5f4-4761-b954-faf2131872d9",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1500,
|
||||
220
|
||||
],
|
||||
"parameters": {
|
||||
"height": 80,
|
||||
"content": "### Replace credentials."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8d682dae-6f88-42f0-a717-affffd37d882",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1140,
|
||||
-520
|
||||
],
|
||||
"parameters": {
|
||||
"height": 80,
|
||||
"content": "### Replace credentials."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "796b5dca-d60e-43a9-afe8-194244643557",
|
||||
"name": "Sticky Note9",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-520,
|
||||
-940
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 330.5152611046425,
|
||||
"height": 239.5888196628349,
|
||||
"content": "### ... or watch set up video [10 min]\n[](https://www.youtube.com/watch?v=glWUkdZe_3w)\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "eba121de-a3f7-4ba5-8396-f7d64e648322",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-820,
|
||||
-1460
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 636.2128494576581,
|
||||
"height": 497.1532689930921,
|
||||
"content": "\n## AI Agent To Chat With Files In Supabase Storage\n**Made by [Mark Shcherbakov](https://www.linkedin.com/in/marklowcoding/) from community [5minAI](https://www.skool.com/5minai-2861)**\n\nManually retrieving and analyzing specific information from large document repositories is time-consuming and inefficient. This workflow automates the process by vectorizing documents and enabling AI-powered interactions, making it easy to query and retrieve context-based information from uploaded files.\n\nThe workflow integrates Supabase with an AI-powered chatbot to process, store, and query text and PDF files. The steps include:\n- Fetching and comparing files to avoid duplicate processing.\n- Handling file downloads and extracting content based on the file type.\n- Converting documents into vectorized data for contextual information retrieval.\n- Storing and querying vectorized data from a Supabase vector store.\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "df054036-d6b9-4f53-86cb-85ad96f07d0e",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-820,
|
||||
-940
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 280.2462120317618,
|
||||
"height": 545.9087885077763,
|
||||
"content": "### Set up steps\n\n1. **Fetch File List from Supabase**:\n - Use Supabase to retrieve the stored file list from a specified bucket.\n - Add logic to manage empty folder placeholders returned by Supabase, avoiding incorrect processing.\n\n2. **Compare and Filter Files**:\n - Aggregate the files retrieved from storage and compare them to the existing list in the Supabase `files` table.\n - Exclude duplicates and skip placeholder files to ensure only unprocessed files are handled.\n\n3. **Handle File Downloads**:\n - Download new files using detailed storage configurations for public/private access.\n - Adjust the storage settings and GET requests to match your Supabase setup.\n\n4. **File Type Processing**:\n - Use a Switch node to target specific file types (e.g., PDFs or text files).\n - Employ relevant tools to process the content:\n - For PDFs, extract embedded content.\n - For text files, directly process the text data.\n\n5. **Content Chunking**:\n - Break large text data into smaller chunks using the Text Splitter node.\n - Define chunk size (default: 500 tokens) and overlap to retain necessary context across chunks.\n\n6. **Vector Embedding Creation**:\n - Generate vectorized embeddings for the processed content using OpenAI's embedding tools.\n - Ensure metadata, such as file ID, is included for easy data retrieval.\n\n7. **Store Vectorized Data**:\n - Save the vectorized information into a dedicated Supabase vector store.\n - Use the default schema and table provided by Supabase for seamless setup.\n\n8. **AI Chatbot Integration**:\n - Add a chatbot node to handle user input and retrieve relevant document chunks.\n - Use metadata like file ID for targeted queries, especially when multiple documents are involved."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "450a1e49-4be9-451a-9d05-2860e29c3695",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
540,
|
||||
-1160
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 951.7421645394404,
|
||||
"height": 809.7437181509877,
|
||||
"content": "## Scenario 2 - AI agent"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c3814c5d-8881-4598-897e-268019bee1bc",
|
||||
"name": "Sticky Note10",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-260,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 2304.723519246249,
|
||||
"height": 739.2522526116408,
|
||||
"content": "## Scenario 1 - Flow for adding new files from Supabase storage"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"If": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Download",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create File record2",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Switch": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Extract Document PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Download": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Switch",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Aggregate": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get All files",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get All Files": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Aggregate",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get All files": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Loop Over Items": {
|
||||
"main": [
|
||||
null,
|
||||
[
|
||||
{
|
||||
"node": "If",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Insert into Supabase Vectorstore",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI2": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Supabase Vector Store",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model1": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model2": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Vector Store Tool1",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Vector Store Tool1": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create File record2": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Insert into Supabase Vectorstore",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Default Data Loader": {
|
||||
"ai_document": [
|
||||
[
|
||||
{
|
||||
"node": "Insert into Supabase Vectorstore",
|
||||
"type": "ai_document",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract Document PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Supabase Vector Store": {
|
||||
"ai_vectorStore": [
|
||||
[
|
||||
{
|
||||
"node": "Vector Store Tool1",
|
||||
"type": "ai_vectorStore",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When chat message received": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Insert into Supabase Vectorstore": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Recursive Character Text Splitter": {
|
||||
"ai_textSplitter": [
|
||||
[
|
||||
{
|
||||
"node": "Default Data Loader",
|
||||
"type": "ai_textSplitter",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking \u2018Test workflow\u2019": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get All Files",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,670 @@
|
||||
{
|
||||
"id": "t1P14FvfibKYCh3E",
|
||||
"meta": {
|
||||
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "HR-focused automation pipeline with AI",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "b1092f93-502c-4af0-962e-2b69311b92a3",
|
||||
"name": "On form submission",
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"position": [
|
||||
-520,
|
||||
-200
|
||||
],
|
||||
"webhookId": "2a87705d-8ba1-41f1-80ef-85f364ce253e",
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"formTitle": "Send CV",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "Name",
|
||||
"placeholder": "Name",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldType": "email",
|
||||
"fieldLabel": "Email",
|
||||
"placeholder": "Email",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldType": "file",
|
||||
"fieldLabel": "CV",
|
||||
"requiredField": true,
|
||||
"acceptFileTypes": ".pdf"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "77edfe2a-4c6a-48c8-8dc9-b275491be090",
|
||||
"name": "Extract from File",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
-160,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "pdf",
|
||||
"binaryPropertyName": "CV"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ebf2e194-3515-4c0a-8745-790b63bf336f",
|
||||
"name": "Qualifications",
|
||||
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
|
||||
"position": [
|
||||
160,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ $json.text }}",
|
||||
"options": {
|
||||
"systemPromptTemplate": "You are an expert extraction algorithm.\nOnly extract relevant information from the text.\nIf you do not know the value of an attribute asked to extract, you may omit the attribute's value."
|
||||
},
|
||||
"attributes": {
|
||||
"attributes": [
|
||||
{
|
||||
"name": "Educational qualification",
|
||||
"required": true,
|
||||
"description": "Summary of your academic career. Focus on your high school and university studies. Summarize in 100 words maximum and also include your grade if applicable."
|
||||
},
|
||||
{
|
||||
"name": "Job History",
|
||||
"required": true,
|
||||
"description": "Work history summary. Focus on your most recent work experiences. Summarize in 100 words maximum"
|
||||
},
|
||||
{
|
||||
"name": "Skills",
|
||||
"required": true,
|
||||
"description": "Extract the candidate\u2019s technical skills. What software and frameworks they are proficient in. Make a bulleted list."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4f40404c-1d47-4bde-9b4b-16367cf11e4f",
|
||||
"name": "Summarization Chain",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainSummarization",
|
||||
"position": [
|
||||
900,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"summarizationMethodAndPrompts": {
|
||||
"values": {
|
||||
"prompt": "=Write a concise summary of the following:\n\nCity: {{ $json.output.city }}\nBirthdate: {{ $json.output.birthdate }}\nEducational qualification: {{ $json.output[\"Educational qualification\"] }}\nJob History: {{ $json.output[\"Job History\"] }}\nSkills: {{ $json.output.Skills }}\n\nUse 100 words or less. Be concise and conversational.",
|
||||
"combineMapPrompt": "=Write a concise summary of the following:\n\nCity: {{ $json.output.city }}\nBirthdate: {{ $json.output.birthdate }}\nEducational qualification: {{ $json.output[\"Educational qualification\"] }}\nJob History: {{ $json.output[\"Job History\"] }}\nSkills: {{ $json.output.Skills }}\n\nUse 100 words or less. Be concise and conversational."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "9f9c5f16-1dc2-4928-aef8-284daeb6be51",
|
||||
"name": "Merge",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
660,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {},
|
||||
"combineBy": "combineAll"
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "51bd14cc-2c54-4f72-b162-255f7e277aff",
|
||||
"name": "Profile Wanted",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1300,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "a3d049b0-5a70-4e7b-a6f2-81447da5282a",
|
||||
"name": "profile_wanted",
|
||||
"type": "string",
|
||||
"value": "We are a web agency and we are looking for a full-stack web developer who knows how to use PHP, Python and Javascript. He has experience in the sector and lives in Northern Italy."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "4a120e5d-b849-4a29-b7f3-12c653552367",
|
||||
"name": "Google Sheets",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
1960,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"CITY": "={{ $('Merge').item.json.output.city }}",
|
||||
"DATA": "={{ $now.format('dd/LL/yyyy') }}",
|
||||
"NAME": "={{ $('On form submission').item.json.Nome }}",
|
||||
"VOTE": "={{ $json.output.vote }}",
|
||||
"EMAIL": "={{ $('On form submission').item.json.Email }}",
|
||||
"SKILLS": "={{ $('Merge').item.json.output.Skills }}",
|
||||
"TELEFONO": "={{ $('Merge').item.json.output.telephone }}",
|
||||
"SUMMARIZE": "={{ $('Summarization Chain').item.json.response.text }}",
|
||||
"EDUCATIONAL": "={{ $('Merge').item.json.output[\"Educational qualification\"] }}",
|
||||
"JOB HISTORY": "={{ $('Merge').item.json.output[\"Job History\"] }}",
|
||||
"DATA NASCITA": "={{ $('Merge').item.json.output.birthdate }}",
|
||||
"CONSIDERATION": "={{ $json.output.consideration }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NAME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NAME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "PHONE",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "PHONE",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CITY",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CITY",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "DATA NASCITA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA NASCITA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EDUCATIONAL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EDUCATIONAL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "JOB HISTORY",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "JOB HISTORY",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "SKILLS",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "SKILLS",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "SUMMARIZE",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "SUMMARIZE",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "VOTE",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "VOTE",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CONSIDERATION",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CONSIDERATION",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ssz5RvN1Hr20Q31pnYnbjCLu1MGBvoLttBAjXunMRQE/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1ssz5RvN1Hr20Q31pnYnbjCLu1MGBvoLttBAjXunMRQE",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ssz5RvN1Hr20Q31pnYnbjCLu1MGBvoLttBAjXunMRQE/edit?usp=drivesdk",
|
||||
"cachedResultName": "Ricerca WebDev"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "a154d8a5-9f85-45bb-b082-f702c13c3507",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
1720,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"vote\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"consideration\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "037ac851-7885-4b78-ac75-dfa0ebb6003d",
|
||||
"name": "HR Expert",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
1560,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Profilo ricercato:\n{{ $json.profile_wanted }}\n\nCandidato:\n{{ $('Summarization Chain').item.json.response.text }}",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"message": "Sei un esperto HR e devi capire se il candidato \u00e8 in linea con il profilo ricercato dall'azienda.\n\nDevi dare un voto da 1 a 10 dove 1 significa che il candidato non \u00e8 in linea con quanto richiesto mentre 10 significa che \u00e8 il candidato ideale perch\u00e8 rispecchia in toto il profilo cercato.\n\nInoltre nel campo \"consideration\" motiva il perch\u00e8 hai dato quel voto. "
|
||||
}
|
||||
]
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.5
|
||||
},
|
||||
{
|
||||
"id": "ed5744c4-df06-4a01-a103-af4dd470d482",
|
||||
"name": "Personal Data",
|
||||
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
|
||||
"position": [
|
||||
160,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ $json.text }}",
|
||||
"options": {
|
||||
"systemPromptTemplate": "You are an expert extraction algorithm.\nOnly extract relevant information from the text.\nIf you do not know the value of an attribute asked to extract, you may omit the attribute's value."
|
||||
},
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"telephone\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n \"city\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n \"birthdate\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "181c1249-b05c-4c35-8cac-5f9738cc1fe6",
|
||||
"name": "Upload CV",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
-160,
|
||||
-380
|
||||
],
|
||||
"parameters": {
|
||||
"name": "=CV-{{ $now.format('yyyyLLdd') }}-{{ $json.CV[0].filename }}",
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "My Drive"
|
||||
},
|
||||
"options": {},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1tzeSpx4D3EAGXa3Wg-gqGbdaUk6LIZTV",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/folders/1tzeSpx4D3EAGXa3Wg-gqGbdaUk6LIZTV",
|
||||
"cachedResultName": "CV"
|
||||
},
|
||||
"inputDataFieldName": "CV"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "HEy5EuZkgPZVEa9w",
|
||||
"name": "Google Drive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "d31ee1c4-e4be-41d9-8f36-e6fb797ced8e",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
920,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "0290cb72-a581-4aff-8b5d-1aa63e0a630f",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-560,
|
||||
-680
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 540,
|
||||
"content": "## HR Expert \nThis workflow automates the process of handling job applications by extracting relevant information from submitted CVs, analyzing the candidate's qualifications against a predefined profile, and storing the results in a Google Sheet"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "361084ff-9735-4a56-8988-be573391838b",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-240,
|
||||
-460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 300,
|
||||
"height": 420,
|
||||
"content": "The CV is uploaded to Google Drive and converted so that it can be processed\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4b6f004f-c77b-4522-99d4-737a68f6cfac",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
120,
|
||||
-380
|
||||
],
|
||||
"parameters": {
|
||||
"width": 360,
|
||||
"height": 440,
|
||||
"content": "The essential information for evaluating the candidate is collected in two different chains"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "73e11af9-65e3-4fcd-bb99-8a3f212ce9fb",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
860,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"width": 320,
|
||||
"height": 240,
|
||||
"content": "Summary of relevant information useful for classifying the candidate"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "606711d1-8e6d-44b3-91ac-c047d8a4054f",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1240,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"width": 220,
|
||||
"height": 240,
|
||||
"content": "Characteristics of the profile sought by the company that intends to hire the candidate"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "89c3210c-c599-41dc-97a3-bf8df2beb751",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1500,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"width": 360,
|
||||
"height": 240,
|
||||
"content": "Candidate evaluation with vote and considerations of the HR agent relating the profile sought with the candidate's skills"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "594728c0-b842-404d-8810-c6f7f3f4631d",
|
||||
"connections": {
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Summarization Chain",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Qualifications",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Summarization Chain",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "HR Expert",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Personal Data",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"HR Expert": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Google Sheets",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Upload CV": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Personal Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Profile Wanted": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "HR Expert",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Qualifications": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract from File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Qualifications",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Personal Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On form submission": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract from File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Upload CV",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Summarization Chain": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Profile Wanted",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "HR Expert",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,700 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "77ee6494-4898-47dc-81d9-35daf6f0beea",
|
||||
"name": "WhatsApp Trigger",
|
||||
"type": "n8n-nodes-base.whatsAppTrigger",
|
||||
"position": [
|
||||
1360,
|
||||
-280
|
||||
],
|
||||
"webhookId": "aaa71f03-f7af-4d18-8d9a-0afb86f1b554",
|
||||
"parameters": {
|
||||
"updates": [
|
||||
"messages"
|
||||
]
|
||||
},
|
||||
"credentials": {
|
||||
"whatsAppTriggerApi": {
|
||||
"id": "H3uYNtpeczKMqtYm",
|
||||
"name": "WhatsApp OAuth account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "57210e27-1f89-465a-98cc-43f890a4bf58",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
1960,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o-2024-08-06",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e1053235-0ade-4e36-9ad2-8b29c78fced8",
|
||||
"name": "Window Buffer Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
"position": [
|
||||
2080,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"sessionKey": "=whatsapp-75-{{ $json.messages[0].from }}",
|
||||
"sessionIdType": "customKey"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "69f1b78b-7c93-4713-863a-27e04809996f",
|
||||
"name": "Vector Store Tool",
|
||||
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
|
||||
"position": [
|
||||
2200,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"name": "query_product_brochure",
|
||||
"description": "Call this tool to query the product brochure. Valid for the year 2024."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "170e8f7d-7e14-48dd-9f80-5352cc411fc1",
|
||||
"name": "Embeddings OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
2200,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"model": "text-embedding-3-small",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ee78320b-d407-49e8-b4b8-417582a44709",
|
||||
"name": "OpenAI Chat Model1",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
2440,
|
||||
-60
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o-2024-08-06",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9dd89378-5acf-4ca6-8d84-e6e64254ed02",
|
||||
"name": "When clicking \u2018Test workflow\u2019",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
0,
|
||||
-240
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e68fc137-1bcb-43f0-b597-3ae07f380c15",
|
||||
"name": "Embeddings OpenAI1",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
760,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"model": "text-embedding-3-small",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2d31e92b-18d4-4f6b-8cdb-bed0056d50d7",
|
||||
"name": "Default Data Loader",
|
||||
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
||||
"position": [
|
||||
900,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"jsonData": "={{ $('Extract from File').item.json.text }}",
|
||||
"jsonMode": "expressionData"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ca0c015e-fba2-4dca-b0fe-bac66681725a",
|
||||
"name": "Recursive Character Text Splitter",
|
||||
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
|
||||
"position": [
|
||||
900,
|
||||
100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"chunkSize": 2000,
|
||||
"chunkOverlap": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "63abb6b2-b955-4e65-9c63-3211dca65613",
|
||||
"name": "Extract from File",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
360,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "pdf"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "be2add9c-3670-4196-8c38-82742bf4f283",
|
||||
"name": "get Product Brochure",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
180,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://usa.yamaha.com/files/download/brochure/1/1474881/Yamaha-Powered-Loudspeakers-brochure-2024-en-web.pdf",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "1ae5a311-36d7-4454-ab14-6788d1331780",
|
||||
"name": "Reply To User",
|
||||
"type": "n8n-nodes-base.whatsApp",
|
||||
"position": [
|
||||
2820,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"textBody": "={{ $json.output }}",
|
||||
"operation": "send",
|
||||
"phoneNumberId": "477115632141067",
|
||||
"requestOptions": {},
|
||||
"additionalFields": {
|
||||
"previewUrl": false
|
||||
},
|
||||
"recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
|
||||
},
|
||||
"credentials": {
|
||||
"whatsAppApi": {
|
||||
"id": "9SFJPeqrpChOkAmw",
|
||||
"name": "WhatsApp account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b6efba81-18b0-4378-bb91-51f39ca57f3e",
|
||||
"name": "Reply To User1",
|
||||
"type": "n8n-nodes-base.whatsApp",
|
||||
"position": [
|
||||
1760,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"textBody": "=I'm unable to process non-text messages. Please send only text messages. Thanks!",
|
||||
"operation": "send",
|
||||
"phoneNumberId": "477115632141067",
|
||||
"requestOptions": {},
|
||||
"additionalFields": {
|
||||
"previewUrl": false
|
||||
},
|
||||
"recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
|
||||
},
|
||||
"credentials": {
|
||||
"whatsAppApi": {
|
||||
"id": "9SFJPeqrpChOkAmw",
|
||||
"name": "WhatsApp account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "52decd86-ac6c-4d91-a938-86f93ec5f822",
|
||||
"name": "Product Catalogue",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
|
||||
"position": [
|
||||
2200,
|
||||
-60
|
||||
],
|
||||
"parameters": {
|
||||
"memoryKey": "whatsapp-75"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6dd5a652-2464-4ab8-8e5f-568529299523",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-88.75,
|
||||
-473.4375
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 640.4375,
|
||||
"height": 434.6875,
|
||||
"content": "## 1. Download Product Brochure PDF\n[Read more about the HTTP Request Tool](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest)\n\nImport your marketing PDF document to build your vector store. This will be used as the knowledgebase by the Sales AI Agent.\n\nFor this demonstration, we'll use the HTTP request node to import the YAMAHA POWERED LOUDSPEAKERS 2024 brochure ([Source](https://usa.yamaha.com/files/download/brochure/1/1474881/Yamaha-Powered-Loudspeakers-brochure-2024-en-web.pdf)) and an Extract from File node to extract the text contents. "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "116663bc-d8d6-41a5-93dc-b219adbb2235",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
580,
|
||||
-476
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 614.6875,
|
||||
"height": 731.1875,
|
||||
"content": "## 2. Create Product Brochure Vector Store\n[Read more about the In-Memory Vector Store](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreinmemory/)\n\nVector stores are powerful databases which serve the purpose of matching a user's questions to relevant parts of a document. By creating a vector store of our product catalog, we'll allow users to query using natural language.\n\nTo keep things simple, we'll use the **In-memory Vector Store** which comes built-in to n8n and doesn't require a separate service. For production deployments, I'd recommend replacing the in-memory vector store with either [Qdrant](https://qdrant.tech) or [Pinecone](https://pinecone.io)."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "86bd5334-d735-4650-aeff-06230119d705",
|
||||
"name": "Create Product Catalogue",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
|
||||
"position": [
|
||||
760,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "insert",
|
||||
"memoryKey": "whatsapp-75",
|
||||
"clearStore": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b8078b0d-cbd7-423f-bb30-13902988be38",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1254,
|
||||
-552
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 546.6875,
|
||||
"height": 484.1875,
|
||||
"content": "## 3. Use the WhatsApp Trigger\n[Learn more about the WhatsApp Trigger](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.whatsapptrigger/)\n\nThe WhatsApp Trigger allows you to receive incoming WhatsApp messages from customers. It requires a bit of setup so remember to follow the documentation carefully! Once ready however, it's quite easy to build powerful workflows which are easily accessible to users.\n\nNote that WhatsApp can send many message types such as audio and video so in this demonstration, we'll filter them out and just accept the text messages."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5bf7ed07-282b-4198-aa90-3e5ae5180404",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1640,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"width": 338,
|
||||
"height": 92,
|
||||
"content": "### Want to handle all message types?\nCheck out my other WhatsApp template in my creator page! https://n8n.io/creators/jimleuk/"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a3661b59-25d2-446e-8462-32b4d692b69d",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1640,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 337.6875,
|
||||
"height": 311.1875,
|
||||
"content": "### 3a. Handle Unsupported Message Types\nFor non-text messages, we'll just reply with a simple message to inform the sender."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ea3c9ee1-505a-40e7-82fe-9169bdbb80af",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1840,
|
||||
-682.5
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 746.6875,
|
||||
"height": 929.1875,
|
||||
"content": "## 4. Sales AI Agent Responds To Customers\n[Learn more about using AI Agents](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/)\n\nn8n's AI agents are powerful nodes which make it incredibly easy to use state-of-the-art AI in your workflows. Not only do they have the ability to remember conversations per individual customer but also tap into resources such as our product catalogue vector store to pull factual information and data for every question.\n\nIn this demonstration, we use an AI agent which is directed to help the user navigate the product brochure. A Chat memory subnode is attached to identify and keep track of the customer session. A Vector store tool is added to allow the Agent to tap into the product catalogue knowledgebase we built earlier."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5c72df8d-bca1-4634-b1ed-61ffec8bd103",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2620,
|
||||
-560
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 495.4375,
|
||||
"height": 484.1875,
|
||||
"content": "## 5. Repond to WhatsApp User\n[Learn more about the WhatsApp Node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.whatsapp/)\n\nThe WhatsApp node is the go-to if you want to interact with WhatsApp users. With this node, you can send text, images, audio and video messages as well as use your WhatsApp message templates.\n\nHere, we'll keep it simple by replying with a text message which is the output of the AI agent."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "48ec809f-ca0e-4052-b403-9ad7077b3fff",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-520,
|
||||
-620
|
||||
],
|
||||
"parameters": {
|
||||
"width": 401.25,
|
||||
"height": 582.6283033962263,
|
||||
"content": "## Try It Out!\n\n### This n8n template builds a simple WhatsApp chabot acting as a Sales Agent. The Agent is backed by a product catalog vector store to better answer user's questions.\n\n* This template is in 2 parts: creating the product catalog vector store and building the WhatsApp AI chatbot.\n* A product brochure is imported via HTTP request node and its text contents extracted.\n* The text contents are then uploaded to the in-memory vector store to build a knowledgebase for the chatbot.\n* A WhatsApp trigger is used to capture messages from customers where non-text messages are filtered out.\n* The customer's message is sent to the AI Agent which queries the product catalogue using the vector store tool.\n* The Agent's response is sent back to the user via the WhatsApp node.\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "87cf9b41-66de-49a7-aeb0-c8809191b5a0",
|
||||
"name": "Handle Message Types",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"position": [
|
||||
1560,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"outputKey": "Supported",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.messages[0].type }}",
|
||||
"rightValue": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "Not Supported",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "89971d8c-a386-4e77-8f6c-f491a8e84cb6",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEquals"
|
||||
},
|
||||
"leftValue": "={{ $json.messages[0].type }}",
|
||||
"rightValue": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.2
|
||||
},
|
||||
{
|
||||
"id": "e52f0a50-0c34-4c4a-b493-4c42ba112277",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-80,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 345.10906976744184,
|
||||
"height": 114.53583720930231,
|
||||
"content": "### You only have to run this part once!\nRun this step to populate our product catalogue vector. Run again if you want to update the vector store with a new version."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c1a7d6d1-191e-4343-af9f-f2c9eb4ecf49",
|
||||
"name": "Sticky Note9",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1260,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 364.6293255813954,
|
||||
"height": 107.02804651162779,
|
||||
"content": "### Activate your workflow to use!\nTo start using the WhatsApp chatbot, you'll need to activate the workflow. If you are self-hosting ensure WhatsApp is able to connect to your server."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a36524d0-22a6-48cc-93fe-b4571cec428a",
|
||||
"name": "AI Sales Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1960,
|
||||
-400
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ $json.messages[0].text.body }}",
|
||||
"options": {
|
||||
"systemMessage": "You are an assistant working for a company who sells Yamaha Powered Loudspeakers and helping the user navigate the product catalog for the year 2024. Your goal is not to facilitate a sale but if the user enquires, direct them to the appropriate website, url or contact information.\n\nDo your best to answer any questions factually. If you don't know the answer or unable to obtain the information from the datastore, then tell the user so."
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"AI Sales Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Reply To User",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"WhatsApp Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Handle Message Types",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Product Catalogue",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract from File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Product Catalogue",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Product Catalogue": {
|
||||
"ai_vectorStore": [
|
||||
[
|
||||
{
|
||||
"node": "Vector Store Tool",
|
||||
"type": "ai_vectorStore",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Vector Store Tool": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI1": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Create Product Catalogue",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model1": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Vector Store Tool",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Default Data Loader": {
|
||||
"ai_document": [
|
||||
[
|
||||
{
|
||||
"node": "Create Product Catalogue",
|
||||
"type": "ai_document",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Handle Message Types": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Reply To User1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Window Buffer Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"get Product Brochure": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract from File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Recursive Character Text Splitter": {
|
||||
"ai_textSplitter": [
|
||||
[
|
||||
{
|
||||
"node": "Default Data Loader",
|
||||
"type": "ai_textSplitter",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking \u2018Test workflow\u2019": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "get Product Brochure",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,700 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "77ee6494-4898-47dc-81d9-35daf6f0beea",
|
||||
"name": "WhatsApp Trigger",
|
||||
"type": "n8n-nodes-base.whatsAppTrigger",
|
||||
"position": [
|
||||
1360,
|
||||
-280
|
||||
],
|
||||
"webhookId": "aaa71f03-f7af-4d18-8d9a-0afb86f1b554",
|
||||
"parameters": {
|
||||
"updates": [
|
||||
"messages"
|
||||
]
|
||||
},
|
||||
"credentials": {
|
||||
"whatsAppTriggerApi": {
|
||||
"id": "H3uYNtpeczKMqtYm",
|
||||
"name": "WhatsApp OAuth account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "57210e27-1f89-465a-98cc-43f890a4bf58",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
1960,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o-2024-08-06",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e1053235-0ade-4e36-9ad2-8b29c78fced8",
|
||||
"name": "Window Buffer Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
"position": [
|
||||
2080,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"sessionKey": "=whatsapp-75-{{ $json.messages[0].from }}",
|
||||
"sessionIdType": "customKey"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "69f1b78b-7c93-4713-863a-27e04809996f",
|
||||
"name": "Vector Store Tool",
|
||||
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
|
||||
"position": [
|
||||
2200,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"name": "query_product_brochure",
|
||||
"description": "Call this tool to query the product brochure. Valid for the year 2024."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "170e8f7d-7e14-48dd-9f80-5352cc411fc1",
|
||||
"name": "Embeddings OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
2200,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"model": "text-embedding-3-small",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ee78320b-d407-49e8-b4b8-417582a44709",
|
||||
"name": "OpenAI Chat Model1",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
2440,
|
||||
-60
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o-2024-08-06",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "9dd89378-5acf-4ca6-8d84-e6e64254ed02",
|
||||
"name": "When clicking \u2018Test workflow\u2019",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
0,
|
||||
-240
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e68fc137-1bcb-43f0-b597-3ae07f380c15",
|
||||
"name": "Embeddings OpenAI1",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
|
||||
"position": [
|
||||
760,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"model": "text-embedding-3-small",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2d31e92b-18d4-4f6b-8cdb-bed0056d50d7",
|
||||
"name": "Default Data Loader",
|
||||
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
||||
"position": [
|
||||
900,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"jsonData": "={{ $('Extract from File').item.json.text }}",
|
||||
"jsonMode": "expressionData"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ca0c015e-fba2-4dca-b0fe-bac66681725a",
|
||||
"name": "Recursive Character Text Splitter",
|
||||
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
|
||||
"position": [
|
||||
900,
|
||||
100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"chunkSize": 2000,
|
||||
"chunkOverlap": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "63abb6b2-b955-4e65-9c63-3211dca65613",
|
||||
"name": "Extract from File",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
360,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "pdf"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "be2add9c-3670-4196-8c38-82742bf4f283",
|
||||
"name": "get Product Brochure",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
180,
|
||||
-240
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://usa.yamaha.com/files/download/brochure/1/1474881/Yamaha-Powered-Loudspeakers-brochure-2024-en-web.pdf",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "1ae5a311-36d7-4454-ab14-6788d1331780",
|
||||
"name": "Reply To User",
|
||||
"type": "n8n-nodes-base.whatsApp",
|
||||
"position": [
|
||||
2820,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"textBody": "={{ $json.output }}",
|
||||
"operation": "send",
|
||||
"phoneNumberId": "477115632141067",
|
||||
"requestOptions": {},
|
||||
"additionalFields": {
|
||||
"previewUrl": false
|
||||
},
|
||||
"recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
|
||||
},
|
||||
"credentials": {
|
||||
"whatsAppApi": {
|
||||
"id": "9SFJPeqrpChOkAmw",
|
||||
"name": "WhatsApp account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b6efba81-18b0-4378-bb91-51f39ca57f3e",
|
||||
"name": "Reply To User1",
|
||||
"type": "n8n-nodes-base.whatsApp",
|
||||
"position": [
|
||||
1760,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"textBody": "=I'm unable to process non-text messages. Please send only text messages. Thanks!",
|
||||
"operation": "send",
|
||||
"phoneNumberId": "477115632141067",
|
||||
"requestOptions": {},
|
||||
"additionalFields": {
|
||||
"previewUrl": false
|
||||
},
|
||||
"recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
|
||||
},
|
||||
"credentials": {
|
||||
"whatsAppApi": {
|
||||
"id": "9SFJPeqrpChOkAmw",
|
||||
"name": "WhatsApp account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "52decd86-ac6c-4d91-a938-86f93ec5f822",
|
||||
"name": "Product Catalogue",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
|
||||
"position": [
|
||||
2200,
|
||||
-60
|
||||
],
|
||||
"parameters": {
|
||||
"memoryKey": "whatsapp-75"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6dd5a652-2464-4ab8-8e5f-568529299523",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-88.75,
|
||||
-473.4375
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 640.4375,
|
||||
"height": 434.6875,
|
||||
"content": "## 1. Download Product Brochure PDF\n[Read more about the HTTP Request Tool](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest)\n\nImport your marketing PDF document to build your vector store. This will be used as the knowledgebase by the Sales AI Agent.\n\nFor this demonstration, we'll use the HTTP request node to import the YAMAHA POWERED LOUDSPEAKERS 2024 brochure ([Source](https://usa.yamaha.com/files/download/brochure/1/1474881/Yamaha-Powered-Loudspeakers-brochure-2024-en-web.pdf)) and an Extract from File node to extract the text contents. "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "116663bc-d8d6-41a5-93dc-b219adbb2235",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
580,
|
||||
-476
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 614.6875,
|
||||
"height": 731.1875,
|
||||
"content": "## 2. Create Product Brochure Vector Store\n[Read more about the In-Memory Vector Store](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreinmemory/)\n\nVector stores are powerful databases which serve the purpose of matching a user's questions to relevant parts of a document. By creating a vector store of our product catalog, we'll allow users to query using natural language.\n\nTo keep things simple, we'll use the **In-memory Vector Store** which comes built-in to n8n and doesn't require a separate service. For production deployments, I'd recommend replacing the in-memory vector store with either [Qdrant](https://qdrant.tech) or [Pinecone](https://pinecone.io)."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "86bd5334-d735-4650-aeff-06230119d705",
|
||||
"name": "Create Product Catalogue",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
|
||||
"position": [
|
||||
760,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "insert",
|
||||
"memoryKey": "whatsapp-75",
|
||||
"clearStore": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b8078b0d-cbd7-423f-bb30-13902988be38",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1254,
|
||||
-552
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 546.6875,
|
||||
"height": 484.1875,
|
||||
"content": "## 3. Use the WhatsApp Trigger\n[Learn more about the WhatsApp Trigger](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.whatsapptrigger/)\n\nThe WhatsApp Trigger allows you to receive incoming WhatsApp messages from customers. It requires a bit of setup so remember to follow the documentation carefully! Once ready however, it's quite easy to build powerful workflows which are easily accessible to users.\n\nNote that WhatsApp can send many message types such as audio and video so in this demonstration, we'll filter them out and just accept the text messages."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5bf7ed07-282b-4198-aa90-3e5ae5180404",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1640,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"width": 338,
|
||||
"height": 92,
|
||||
"content": "### Want to handle all message types?\nCheck out my other WhatsApp template in my creator page! https://n8n.io/creators/jimleuk/"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a3661b59-25d2-446e-8462-32b4d692b69d",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1640,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 337.6875,
|
||||
"height": 311.1875,
|
||||
"content": "### 3a. Handle Unsupported Message Types\nFor non-text messages, we'll just reply with a simple message to inform the sender."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ea3c9ee1-505a-40e7-82fe-9169bdbb80af",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1840,
|
||||
-682.5
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 746.6875,
|
||||
"height": 929.1875,
|
||||
"content": "## 4. Sales AI Agent Responds To Customers\n[Learn more about using AI Agents](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/)\n\nn8n's AI agents are powerful nodes which make it incredibly easy to use state-of-the-art AI in your workflows. Not only do they have the ability to remember conversations per individual customer but also tap into resources such as our product catalogue vector store to pull factual information and data for every question.\n\nIn this demonstration, we use an AI agent which is directed to help the user navigate the product brochure. A Chat memory subnode is attached to identify and keep track of the customer session. A Vector store tool is added to allow the Agent to tap into the product catalogue knowledgebase we built earlier."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5c72df8d-bca1-4634-b1ed-61ffec8bd103",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2620,
|
||||
-560
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 495.4375,
|
||||
"height": 484.1875,
|
||||
"content": "## 5. Repond to WhatsApp User\n[Learn more about the WhatsApp Node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.whatsapp/)\n\nThe WhatsApp node is the go-to if you want to interact with WhatsApp users. With this node, you can send text, images, audio and video messages as well as use your WhatsApp message templates.\n\nHere, we'll keep it simple by replying with a text message which is the output of the AI agent."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "48ec809f-ca0e-4052-b403-9ad7077b3fff",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-520,
|
||||
-620
|
||||
],
|
||||
"parameters": {
|
||||
"width": 401.25,
|
||||
"height": 582.6283033962263,
|
||||
"content": "## Try It Out!\n\n### This n8n template builds a simple WhatsApp chabot acting as a Sales Agent. The Agent is backed by a product catalog vector store to better answer user's questions.\n\n* This template is in 2 parts: creating the product catalog vector store and building the WhatsApp AI chatbot.\n* A product brochure is imported via HTTP request node and its text contents extracted.\n* The text contents are then uploaded to the in-memory vector store to build a knowledgebase for the chatbot.\n* A WhatsApp trigger is used to capture messages from customers where non-text messages are filtered out.\n* The customer's message is sent to the AI Agent which queries the product catalogue using the vector store tool.\n* The Agent's response is sent back to the user via the WhatsApp node.\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "87cf9b41-66de-49a7-aeb0-c8809191b5a0",
|
||||
"name": "Handle Message Types",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"position": [
|
||||
1560,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"outputKey": "Supported",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"leftValue": "={{ $json.messages[0].type }}",
|
||||
"rightValue": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "Not Supported",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "89971d8c-a386-4e77-8f6c-f491a8e84cb6",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEquals"
|
||||
},
|
||||
"leftValue": "={{ $json.messages[0].type }}",
|
||||
"rightValue": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3.2
|
||||
},
|
||||
{
|
||||
"id": "e52f0a50-0c34-4c4a-b493-4c42ba112277",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-80,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 345.10906976744184,
|
||||
"height": 114.53583720930231,
|
||||
"content": "### You only have to run this part once!\nRun this step to populate our product catalogue vector. Run again if you want to update the vector store with a new version."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c1a7d6d1-191e-4343-af9f-f2c9eb4ecf49",
|
||||
"name": "Sticky Note9",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1260,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 364.6293255813954,
|
||||
"height": 107.02804651162779,
|
||||
"content": "### Activate your workflow to use!\nTo start using the WhatsApp chatbot, you'll need to activate the workflow. If you are self-hosting ensure WhatsApp is able to connect to your server."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a36524d0-22a6-48cc-93fe-b4571cec428a",
|
||||
"name": "AI Sales Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1960,
|
||||
-400
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ $json.messages[0].text.body }}",
|
||||
"options": {
|
||||
"systemMessage": "You are an assistant working for a company who sells Yamaha Powered Loudspeakers and helping the user navigate the product catalog for the year 2024. Your goal is not to facilitate a sale but if the user enquires, direct them to the appropriate website, url or contact information.\n\nDo your best to answer any questions factually. If you don't know the answer or unable to obtain the information from the datastore, then tell the user so."
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"AI Sales Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Reply To User",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"WhatsApp Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Handle Message Types",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Product Catalogue",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract from File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Product Catalogue",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Product Catalogue": {
|
||||
"ai_vectorStore": [
|
||||
[
|
||||
{
|
||||
"node": "Vector Store Tool",
|
||||
"type": "ai_vectorStore",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Vector Store Tool": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings OpenAI1": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Create Product Catalogue",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model1": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Vector Store Tool",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Default Data Loader": {
|
||||
"ai_document": [
|
||||
[
|
||||
{
|
||||
"node": "Create Product Catalogue",
|
||||
"type": "ai_document",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Handle Message Types": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Reply To User1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Window Buffer Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "AI Sales Agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"get Product Brochure": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract from File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Recursive Character Text Splitter": {
|
||||
"ai_textSplitter": [
|
||||
[
|
||||
{
|
||||
"node": "Default Data Loader",
|
||||
"type": "ai_textSplitter",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking \u2018Test workflow\u2019": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "get Product Brochure",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "f4f5d195bb2162a0972f737368404b18be694648d365d6c6771d7b4909d28167"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "b6cd232e-e82e-457b-9f03-c010b3eba148",
|
||||
"name": "When clicking 'Test workflow'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
-40,
|
||||
0
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2b734806-e3c0-4552-a491-54ca846ed3ac",
|
||||
"name": "Extract from File",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
620,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "binaryToPropery"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2c199499-cc4f-405c-8560-765500b7acba",
|
||||
"name": "Google Drive",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
420,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "18Ac2xorxirIBm9FNFDDB5aVUSPBCCg1U",
|
||||
"cachedResultUrl": "https://drive.google.com/file/d/18Ac2xorxirIBm9FNFDDB5aVUSPBCCg1U/view?usp=drivesdk",
|
||||
"cachedResultName": "Invoice-798FE2FA-0004.pdf"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "download"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "AUEpxwlqBJghNMtb",
|
||||
"name": "Google Drive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "e3031c0c-f059-4f30-9684-10014a277d55",
|
||||
"name": "Call Gemini 2.0 Flash with PDF Capabilities",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
880,
|
||||
220
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"contents\": [\n {\n \"parts\": [\n {\n \"inline_data\": {\n \"mime_type\": \"application/pdf\",\n \"data\": \"{{ $json.data }}\"\n }\n },\n {\n \"text\": \"{{ $('Define Prompt').item.json.prompt }}\"\n }\n ]\n }\n ]\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "googlePalmApi"
|
||||
},
|
||||
"credentials": {
|
||||
"anthropicApi": {
|
||||
"id": "eOt6Ois0jSizRFMJ",
|
||||
"name": "Anthropic Mira Account"
|
||||
},
|
||||
"googlePalmApi": {
|
||||
"id": "IQrjvfoUd5LUft3b",
|
||||
"name": "Google Gemini(PaLM) Api account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "135df716-32a1-47e8-9ed8-30c830b803d6",
|
||||
"name": "Call Claude 3.5 Sonnet with PDF Capabilities",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
880,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.anthropic.com/v1/messages",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"model\": \"claude-3-5-sonnet-20241022\",\n \"max_tokens\": 1024,\n \"messages\": [{\n \"role\": \"user\",\n \"content\": [{\n \"type\": \"document\",\n \"source\": {\n \"type\": \"base64\",\n \"media_type\": \"application/pdf\",\n \"data\": \"{{$json.data}}\"\n }\n },\n {\n \"type\": \"text\",\n \"text\": \"{{ $('Define Prompt').item.json.prompt }}\"\n }]\n }]\n}",
|
||||
"sendBody": true,
|
||||
"sendHeaders": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "anthropic-version",
|
||||
"value": "2023-06-01"
|
||||
},
|
||||
{
|
||||
"name": "content-type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "anthropicApi"
|
||||
},
|
||||
"credentials": {
|
||||
"anthropicApi": {
|
||||
"id": "eOt6Ois0jSizRFMJ",
|
||||
"name": "Anthropic Mira Account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "5b8994d1-4bfd-4776-84ac-b3141aca6378",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-700,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 601,
|
||||
"height": 585,
|
||||
"content": "## Workflow: Extract data from PDF with Claude 3.5 Sonnet or Gemini 2.0 Flash\n\n**Overview**\n- This workflow helps you compare Claude 3.5 Sonnet and Gemini 2.0 Flash when extracting data from a PDF\n- This workflow extracts and processes the data within a PDF in **one single step**, **instead of calling an OCR and then an LLM\u201d**\n\n\n**How it works**\n- The initial 2 steps download the PDF and convert it to base64.\n- This base64 string is then sent to both Claude 3.5 Sonnet and Gemini 2.0 Flash to extract information.\n- This workflow is made to let you compare results, latency, and cost (in their dedicated dashboard).\n\n\n**How to use it**\n- Set up your Google Drive if not already done\n- Select a document on your Google Drive\n- Modify the prompt in \"Define Prompt\" to extract the information you need and transform it as wanted.\n- Get a [Claude API key](https://console.anthropic.com/settings/keys) and/or [Gemini API key](https://aistudio.google.com/app/apikey)\n- Note that you can deactivate one of the 2 API calls if you don't want to try both\n- Test the Workflow\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "616241a9-6199-406b-88dc-0afc7d974250",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
820,
|
||||
60
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 320,
|
||||
"height": 360,
|
||||
"content": "You can output the result as JSON by adding the following:\n```\n\"generationConfig\": {\n \"responseMimeType\": \"application/json\"\n```\nor even use a structured output.\n[Check the documentation](https://ai.google.dev/gemini-api/docs/structured-output?lang=rest)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "bbac8d3d-d68f-4aa2-a41a-b06f7de2317b",
|
||||
"name": "Define Prompt",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
180,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "dba23ef5-95df-496a-8e24-c7c1544533d2",
|
||||
"name": "prompt",
|
||||
"type": "string",
|
||||
"value": "Extract the VAT numbers for each country"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "3c2e7265-76e5-4911-a950-7e6b0c89ec5a",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
820,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 320,
|
||||
"height": 240,
|
||||
"content": "You can force Claude to output JSON with [Prefill response format](https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#prefill-claudes-response)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f2b46305-5200-486e-ad4d-ecc0d2a14314",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
380,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 380,
|
||||
"height": 280,
|
||||
"content": "These 2 steps first download the PDF file, and then convert it to base64.\nThis is required by both APIs to process the file."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e5dff70f-b55a-4c23-9025-765a7cf19c4a",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
120,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 220,
|
||||
"height": 280,
|
||||
"content": "This prompt is used in both Gemini\u2019s and Claude\u2019s calls to define what information should be extracted and processed."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Google Drive": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract from File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Define Prompt": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Google Drive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract from File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call Claude 3.5 Sonnet with PDF Capabilities",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Call Gemini 2.0 Flash with PDF Capabilities",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking 'Test workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Define Prompt",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,500 @@
|
||||
{
|
||||
"id": "sUIPemKdKqmUQFt6",
|
||||
"meta": {
|
||||
"instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Extract text from PDF and image using Vertex AI (Gemini) into CSV",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "f60ef5f9-bc08-4cc9-804e-697ae6f88b9b",
|
||||
"name": "Google Gemini Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
|
||||
"position": [
|
||||
980,
|
||||
920
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"modelName": "models/gemini-1.5-pro-latest"
|
||||
},
|
||||
"credentials": {
|
||||
"googlePalmApi": {
|
||||
"id": "hmNTKSKfppgtDbM5",
|
||||
"name": "Google Gemini(PaLM) Api account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "81d3f7b8-20cb-4aac-82a9-d4e8e6581105",
|
||||
"name": "Get PDF or Images",
|
||||
"type": "n8n-nodes-base.googleDriveTrigger",
|
||||
"position": [
|
||||
220,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"event": "fileCreated",
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
},
|
||||
"triggerOn": "specificFolder",
|
||||
"folderToWatch": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1HOeRP5iwccg93UPUYmWYD7DyDmRREkhj",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/folders/1HOeRP5iwccg93UPUYmWYD7DyDmRREkhj",
|
||||
"cachedResultName": "Actual Budget"
|
||||
},
|
||||
"authentication": "serviceAccount"
|
||||
},
|
||||
"credentials": {
|
||||
"googleApi": {
|
||||
"id": "axkK6IN61bEAT6GM",
|
||||
"name": "Google Service Account account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "fe9a8228-7950-4e2c-8982-328e03725782",
|
||||
"name": "Route based on PDF or Image",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"position": [
|
||||
480,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"rules": [
|
||||
{
|
||||
"value2": "application/pdf",
|
||||
"outputKey": "pdf"
|
||||
},
|
||||
{
|
||||
"value2": "image/",
|
||||
"operation": "contains",
|
||||
"outputKey": "image"
|
||||
}
|
||||
]
|
||||
},
|
||||
"value1": "={{$json.mimeType}}",
|
||||
"dataType": "string"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "f62b71e5-af17-4f85-abff-7cee5100affc",
|
||||
"name": "Download PDF",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
740,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Get PDF or Images').item.json.id }}"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "download",
|
||||
"authentication": "serviceAccount"
|
||||
},
|
||||
"credentials": {
|
||||
"googleApi": {
|
||||
"id": "axkK6IN61bEAT6GM",
|
||||
"name": "Google Service Account account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "fa99fbcf-1353-410d-a0db-48cea1178a76",
|
||||
"name": "Download Image",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
740,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Get PDF or Images').item.json.id }}"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "download",
|
||||
"authentication": "serviceAccount"
|
||||
},
|
||||
"credentials": {
|
||||
"googleApi": {
|
||||
"id": "axkK6IN61bEAT6GM",
|
||||
"name": "Google Service Account account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"retryOnFail": false,
|
||||
"typeVersion": 3,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "e4979746-44bb-493e-b5eb-f9646b510888",
|
||||
"name": "Extract data from PDF",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
980,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "pdf"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6549c335-e749-4b95-b77d-096a5e77af5e",
|
||||
"name": "Send data to A.I.",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1180,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://openrouter.ai/api/v1/chat/completions",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"model\": \"meta-llama/llama-3.1-70b-instruct:free\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"You are given a bank statement.{{encodeURIComponent($json.text)}}. Read the PDF and export all the transactions as CSV. Add a column called category and based on the information assign a category name. Return only the CSV data starting with the header row.\"\n }\n ]\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "WY7UkF14ksPKq3S8",
|
||||
"name": "Header Auth account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "42341f03-c9fc-4290-963e-1a723202a739",
|
||||
"name": "Convert to CSV",
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"position": [
|
||||
1400,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "bb446447-3f46-47e7-96a2-3fc720715828",
|
||||
"name": "Upload to Google Drive",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
1640,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"name": "={{$today}}",
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "My Drive",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
|
||||
"cachedResultName": "My Drive"
|
||||
},
|
||||
"options": {},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1Zo4OFCv1qWRX1jo0VL_iqUBf4v0fZEXe",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/folders/1Zo4OFCv1qWRX1jo0VL_iqUBf4v0fZEXe",
|
||||
"cachedResultName": "CSV Exports"
|
||||
},
|
||||
"authentication": "serviceAccount"
|
||||
},
|
||||
"credentials": {
|
||||
"googleApi": {
|
||||
"id": "axkK6IN61bEAT6GM",
|
||||
"name": "Google Service Account account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "843bc9c1-79a6-4f42-b9ee-fbec5f30b18d",
|
||||
"name": "Convert to CSV2",
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"position": [
|
||||
1360,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "6404bf65-3a7e-4be9-9b7f-98a23dca2ffd",
|
||||
"name": "Upload to Google Drive1",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
1640,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"name": "={{$today}}",
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "My Drive",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
|
||||
"cachedResultName": "My Drive"
|
||||
},
|
||||
"options": {},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1Zo4OFCv1qWRX1jo0VL_iqUBf4v0fZEXe",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/folders/1Zo4OFCv1qWRX1jo0VL_iqUBf4v0fZEXe",
|
||||
"cachedResultName": "CSV Exports"
|
||||
},
|
||||
"authentication": "serviceAccount"
|
||||
},
|
||||
"credentials": {
|
||||
"googleApi": {
|
||||
"id": "axkK6IN61bEAT6GM",
|
||||
"name": "Google Service Account account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "5dd5771f-6ccb-47ab-acbb-d6cbec60d22b",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
220,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"width": 589.0376569037658,
|
||||
"height": 163.2468619246862,
|
||||
"content": "## How to extract PDF and image text into CSV using n8n (without manual data entry)\n\nThis workflow will extract text data from PDF and images, then store it as CSV.\n\n[\ud83d\udca1 You can read more about this workflow here](https://rumjahn.com/how-to-create-an-a-i-agent-to-analyze-matomo-analytics-using-n8n-for-free/)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "37416630-9b52-4ce6-98d0-1bdd39ff0d6b",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
160,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 248.11715481171547,
|
||||
"height": 432.7364016736402,
|
||||
"content": "## Get PDF or image\nYou need to create a new folder inside Google Drive for uploading your PDF and images.\n\nOnce you create a folder, you need to add your Google cloud user by going to Share -> Add user. The user email should be like: n8n-server@n8n-server-435232.iam.gserviceaccount.com"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3ab10f17-de8f-4263-aef8-cc2fb090ffe5",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1120,
|
||||
52.864368048917754
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"height": 446.3929762816575,
|
||||
"content": "## Send to Openrouter\nYou need to set up an Openrouter account to use this. It sends the data to openrouter to extract text.\n\nUse Header Auth. Name is \"Authorization\" and value is \"Bearer {API token}\"."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e966f95c-c54e-4d11-895d-d5f75c53aca5",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
920,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 399.0962343096232,
|
||||
"height": 517.154811715481,
|
||||
"content": "## Vertex AI for image recogniztion\nWe send the photo to Vertex AI to extract text. You'll need to activate Vertex AI and add the correct rights to your Google cloud credentials. \n- Enable Vertex API\n- Add vertex to user account"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "daa3ab66-fa14-4792-96d0-3bcbeffd5d60",
|
||||
"name": "Vertex A.I. extract text",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
980,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Extract the transactions from the image",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"message": "=You are given a screenshot of payment transactions. Read the image and export all the transactions as CSV. Add a column called category and based on the information assign a category name. Return only the CSV data starting with the header row."
|
||||
},
|
||||
{
|
||||
"type": "HumanMessagePromptTemplate",
|
||||
"messageType": "imageBinary"
|
||||
}
|
||||
]
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.4
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "80635382-3d1c-4e46-a753-84b033cfc3a7",
|
||||
"connections": {
|
||||
"Download PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract data from PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert to CSV": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload to Google Drive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Download Image": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Vertex A.I. extract text",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert to CSV2": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload to Google Drive1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get PDF or Images": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Route based on PDF or Image",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Send data to A.I.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert to CSV",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract data from PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send data to A.I.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Google Gemini Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Vertex A.I. extract text",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Vertex A.I. extract text": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert to CSV2",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Route based on PDF or Image": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Download PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Download Image",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,758 @@
|
||||
{
|
||||
"id": "P307QnrxpA1ddsM5",
|
||||
"meta": {
|
||||
"instanceId": "fb924c73af8f703905bc09c9ee8076f48c17b596ed05b18c0ff86915ef8a7c4a",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Generate SQL queries from schema only - AI-powered",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "b7c3ca47-11b3-4378-81fa-68b2f56b295e",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
1460,
|
||||
440
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o",
|
||||
"options": {
|
||||
"temperature": 0.2
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "rveqdSfp7pCRON1T",
|
||||
"name": "Ted's Tech Talks OpenAi"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "977c3a82-440b-4d44-9042-47a673bcb52c",
|
||||
"name": "Window Buffer Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
"position": [
|
||||
1640,
|
||||
440
|
||||
],
|
||||
"parameters": {
|
||||
"contextWindowLength": 10
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "c6e9c0e2-d238-4f0b-a4c8-2271f2c8b31b",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
2340,
|
||||
520
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4c141ae8-d2d1-45c7-bb5d-f33841d3cee6",
|
||||
"name": "List all tables in a database",
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"position": [
|
||||
520,
|
||||
-35
|
||||
],
|
||||
"parameters": {
|
||||
"query": "SHOW TABLES;",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "ICakJ1LRuVl4dRTs",
|
||||
"name": "db4free TTT account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.4
|
||||
},
|
||||
{
|
||||
"id": "54fb3362-041b-4e4f-bfea-f0bc788d8dfd",
|
||||
"name": "Extract database schema",
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"position": [
|
||||
700,
|
||||
-35
|
||||
],
|
||||
"parameters": {
|
||||
"query": "DESCRIBE {{ $json.Tables_in_tttytdb2023 }};",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "ICakJ1LRuVl4dRTs",
|
||||
"name": "db4free TTT account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.4
|
||||
},
|
||||
{
|
||||
"id": "d55e841d-11ed-4ce2-8c8e-840bd807ff2c",
|
||||
"name": "Add table name to output",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
880,
|
||||
-35
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "764176d6-3c89-404d-9c71-301e8a406a68",
|
||||
"name": "table",
|
||||
"type": "string",
|
||||
"value": "={{ $('List all tables in a database').item.json.Tables_in_tttytdb2023 }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "ca8d30d6-c1f1-4e89-8cd5-ea3648dc3b0c",
|
||||
"name": "Convert data to binary",
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"position": [
|
||||
1060,
|
||||
-35
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "toJson"
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "2d89f901-d4e7-4fea-bd69-20b518280bbc",
|
||||
"name": "Save file locally",
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"position": [
|
||||
1220,
|
||||
-35
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fileName": "./chinook_mysql.json",
|
||||
"operation": "write"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "04511c4f-44fa-4c23-87af-54d959e6cb2c",
|
||||
"name": "Extract data from file",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
920,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "fromJson"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "96f129c0-d1d4-4cbf-a24d-0b0cea18a229",
|
||||
"name": "Chat Trigger",
|
||||
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
|
||||
"position": [
|
||||
440,
|
||||
420
|
||||
],
|
||||
"webhookId": "c308dec7-655c-4b79-832e-991bd8ea891f",
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "4d993ed9-3bbe-4bc3-9e5b-c3d738b0e714",
|
||||
"name": "AI Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1480,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Here is the database schema: {{ $json.schema }}\nHere is the user request: {{ $('Chat Trigger').item.json.chatInput }}",
|
||||
"agent": "conversationalAgent",
|
||||
"options": {
|
||||
"humanMessage": "TOOLS\n------\nAssistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:\n\n{tools}\n\n{format_instructions}\n\nUSER'S INPUT\n--------------------\nHere is the user's input (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):\n\n{{input}}",
|
||||
"systemMessage": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n\nHelp user to work with the MySQL database.\n\nPlease wrap any sql commands into triple quotes. You don't have a tool to run SQL, so the user will do that instead of you."
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "f5749b31-b28a-4341-b57f-94ee422d2873",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
320,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 1065.0949045120822,
|
||||
"height": 466.4256045427794,
|
||||
"content": "## Run this part only once\nThis section:\n* loads a list of all tables from the database hosted on [db4free](https://db4free.net/signup.php) \n* extracts the database schema for each table and adds the table name\n* converts the schema into a binary JSON format\n* saves the schema `./chinook_mysql.json` file locally\n\n***Now you can use chat to \"talk\" to your data!*** \ud83c\udf89"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6606abc9-1dcb-4dba-b7ef-e221f892eed8",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1040,
|
||||
-255
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 312.47220527158765,
|
||||
"height": 174.60585869504342,
|
||||
"content": "## Pre-workflow setup \nConnect to a free MySQL server and import your database. Follow Step 1 and 2 in this [tutorial](https://blog.n8n.io/compare-databases/) for more.\n\n*The Chinook data used in this workflow is available on [GitHub](https://github.com/msimanga/chinook/tree/master/mysql).* "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c8ac730a-04ee-499d-b845-1149967d6aa2",
|
||||
"name": "When clicking \"Test workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
360,
|
||||
-35
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6f0b167c-e012-43e1-9892-ded05be47cf8",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
324.32561050665913,
|
||||
209.72072645338642
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 1062.678698911262,
|
||||
"height": 489.29614613074125,
|
||||
"content": "## On every chat message:\n\n* The workflow gets the data from the local schema file and extracts it as a JSON object. This way, we achieve two important improvements:\n * faster processing time as we don't need to fetch the schema for each table from a slow remote database\n * the Agent will know database structure without seeing the actual data\n* DB schema is then converted into a long string, JSON fields from the Chat Trigger are added before they are entered into the Agent node.\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3a79350c-aec1-4ad4-a2e0-679957fa420b",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1400,
|
||||
-15.552780029374958
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 445.66588600071304,
|
||||
"height": 714.7896619176862,
|
||||
"content": "### LangChain AI Agent's system prompt is modified.\nIt uses only the database schema to generate SQL queries. The agent creates these queries but does not execute them. Instead, it passes them to subsequent nodes.\n\n**Example:**\n\"Can you show me the list of all German customers?\" \n\nQueries are generated only when necessary; for some requests, a query may not be needed. This is because certain questions can be answered directly without SQL execution.\n\n**Example:**\n\"Can you list me all tables?\""
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0cd425db-2a8e-4f48-b749-9a082e948395",
|
||||
"name": "Combine schema data and chat input",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1140,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "42abd24e-419a-47d6-bc8b-7146dd0b8314",
|
||||
"name": "sessionId",
|
||||
"type": "string",
|
||||
"value": "={{ $('Chat Trigger').first().json.sessionId }}"
|
||||
},
|
||||
{
|
||||
"id": "39244192-a1a6-42fe-bc75-a6fba1f264df",
|
||||
"name": "action",
|
||||
"type": "string",
|
||||
"value": "={{ $('Chat Trigger').first().json.action }}"
|
||||
},
|
||||
{
|
||||
"id": "f78c57d9-df13-43c7-89a7-5387e528107e",
|
||||
"name": "chatinput",
|
||||
"type": "string",
|
||||
"value": "={{ $('Chat Trigger').first().json.chatInput }}"
|
||||
},
|
||||
{
|
||||
"id": "e42b39eb-dfbd-48d9-94ed-d658bdd41454",
|
||||
"name": "schema",
|
||||
"type": "string",
|
||||
"value": "={{ $json.data }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "e4045e33-bb87-488d-8ccf-b4a94339a841",
|
||||
"name": "Load the schema from the local file",
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"position": [
|
||||
680,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fileSelector": "./chinook_mysql.json"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "367ebe95-0b87-44f6-8392-33fe65446c24",
|
||||
"name": "Extract SQL query",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1900,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "ebbe194a-4b8b-44c9-ac19-03cf69d353bf",
|
||||
"name": "query",
|
||||
"type": "string",
|
||||
"value": "={{ ($json.output.match(/SELECT[\\s\\S]*?;/i) || [])[0] || \"\" }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "b856fe78-2435-4075-97f8-ecbeecf3e780",
|
||||
"name": "Check if query exists",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
2060,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "2963d04d-9d79-49f9-b52a-dc8732aca781",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.query }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "87162d31-2f6c-4f4a-af28-c65cbadd8ed5",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1874,
|
||||
220.45316744685329
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 317.8901548206743,
|
||||
"height": 278.8174358200552,
|
||||
"content": "## SQL query extraction\nCheck if the agent's response contains an SQL query. If it does, we extract the query using a regular expression."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b3e77333-eaa9-4d23-a78c-8a19ae074739",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1860,
|
||||
-16.43746604251737
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 882.7611828369563,
|
||||
"height": 715.7029266156915,
|
||||
"content": ""
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "269ea79d-5f17-4764-aebb-bba31b43d8bb",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1580,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 257.46308756569573,
|
||||
"height": 108.03673727584527,
|
||||
"content": "The AI Agent remembers the schema, questions, and final answers, but not data values, since queries run externally. The agent can't access database content. "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2fd1175c-4110-48be-b6bf-2251c678bc04",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2420,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 308.8514666587585,
|
||||
"height": 123.43139661532095,
|
||||
"content": "- The SQL node accesses the database and executes the query. The results are then formatted for readability.\n- Both the chat response and the query result are displayed in the chat window."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "61ae7f7c-1424-4ecb-8a12-78cd98e94d45",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2480,
|
||||
600
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 250.40895053328057,
|
||||
"height": 89.90186716520257,
|
||||
"content": "When the agent responds without an SQL query, you receive an immediate answer with no additional processing."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "cbb6d1e1-0a75-4b3a-89cd-6bd545b8d414",
|
||||
"name": "Format query results",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2420,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "f944d21f-6aac-4842-8926-4108d6cad4bf",
|
||||
"name": "sqloutput",
|
||||
"type": "string",
|
||||
"value": "={{ Object.keys($jmespath($input.all(),'[].json')[0]).join(' | ') }} \n{{ ($jmespath($input.all(),'[].json')).map(obj => Object.values(obj).join(' | ')).join('\\n') }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "d958de24-84ef-4928-a7f3-32cada09a0eb",
|
||||
"name": "Run SQL query",
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"position": [
|
||||
2260,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"query": "{{ $json.query }}",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "ICakJ1LRuVl4dRTs",
|
||||
"name": "db4free TTT account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.4
|
||||
},
|
||||
{
|
||||
"id": "99a6dc03-1035-4866-81e4-11dc66bf98ec",
|
||||
"name": "Prepare final output",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2560,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "aa55e186-1535-4923-aee4-e088ca69575b",
|
||||
"name": "output",
|
||||
"type": "string",
|
||||
"value": "={{ $json.output }}\n\nSQL result:\n```markdown\n{{ $json.sqloutput }}\n```"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "9380c2f6-15d9-43e4-80a2-3019bcf5ae04",
|
||||
"name": "Combine query result and chat answer",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
2340,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {},
|
||||
"combineBy": "combineByPosition"
|
||||
},
|
||||
"typeVersion": 3
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "15049b13-91cb-46bd-a7a0-ad648b6f667a",
|
||||
"connections": {
|
||||
"AI Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract SQL query",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Chat Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Load the schema from the local file",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Run SQL query": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format query results",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract SQL query": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check if query exists",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format query results": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Combine query result and chat answer",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Window Buffer Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check if query exists": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Run SQL query",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Combine query result and chat answer",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert data to binary": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Save file locally",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract data from file": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Combine schema data and chat input",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract database schema": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add table name to output",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add table name to output": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert data to binary",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"List all tables in a database": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract database schema",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking \"Test workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "List all tables in a database",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Combine schema data and chat input": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Load the schema from the local file": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract data from file",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Combine query result and chat answer": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prepare final output",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,679 @@
|
||||
{
|
||||
"id": "IO0OrQ6ao4vm9urI",
|
||||
"meta": {
|
||||
"instanceId": "0d6ec6d73242e93a616bed7dc657bb92fd6b05466b19318f83d18293848e971a",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Automated Resume Review System Using OpenAI + Google Sheets",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "8585c01d-f26c-453e-a705-7783b3a28a46",
|
||||
"name": "On form submission",
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"position": [
|
||||
-780,
|
||||
180
|
||||
],
|
||||
"webhookId": "6ea62ea0-de12-4134-b646-121474b3b846",
|
||||
"parameters": {
|
||||
"options": {
|
||||
"ignoreBots": true,
|
||||
"appendAttribution": false
|
||||
},
|
||||
"formTitle": "Submit your CV",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "First name",
|
||||
"placeholder": "First Name",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Last Name",
|
||||
"placeholder": "Last Name",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldType": "email",
|
||||
"fieldLabel": "Email",
|
||||
"placeholder": "Email",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldType": "file",
|
||||
"fieldLabel": "Resume",
|
||||
"requiredField": true,
|
||||
"acceptFileTypes": "=.pdf"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "d7acbd9b-f24a-4801-9a00-94308df9a55e",
|
||||
"name": "Merge",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
540,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {},
|
||||
"combineBy": "combineAll"
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "68f1cb96-fca5-473b-b79c-707682206135",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
1600,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"vote\": {\n \"type\": \"string\"\n },\n \"consideration\": {\n \"type\": \"string\"\n }\n }\n}\n"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "04b20070-141a-466c-87d3-7de4323f83df",
|
||||
"name": "Google Sheets",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
1900,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"DOB": "={{ $('Merge').item.json.output.birthdate }}",
|
||||
"City": "={{ $('Merge').item.json.output.city }}",
|
||||
"Vote": "={{ $json.output.vote }}",
|
||||
"Email": "={{ $('Merge').item.json.output.email }}",
|
||||
"Skills": "={{ $('Merge').item.json.output.Skills }}",
|
||||
"Website": "={{ $('Merge').item.json.output.website }}",
|
||||
"Last Name": "={{ $('Merge').item.json.output.last_name }}",
|
||||
"Experience": "={{ $('Merge').item.json.output['Job History'] }}",
|
||||
"First Name": "={{ $('Merge').item.json.output.first_name }}",
|
||||
"Applied Date": "={{ $now.format('MM-dd-yyyy') }}",
|
||||
"Education Qualification": "={{ $('Merge').item.json.output['Educational Qualification'] }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "First Name",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "First Name",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Last Name",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "Last Name",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "City",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "City",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Phone number",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "Phone number",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Email",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "Email",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "LinkedIn",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "LinkedIn",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Website",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "Website",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "DOB",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DOB",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Education Qualification",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "Education Qualification",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Experience",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "Experience",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Skills",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "Skills",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Vote",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "Vote",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Consideration",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "Consideration",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Applied Date",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "Applied Date",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1tmg5CW1d3ZNVJ98hODs24RLGyKul98cAtVHULLNDAyU/edit#gid=0",
|
||||
"cachedResultName": "Sheet1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1tmg5CW1d3ZNVJ98hODs24RLGyKul98cAtVHULLNDAyU",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1tmg5CW1d3ZNVJ98hODs24RLGyKul98cAtVHULLNDAyU/edit?usp=drivesdk",
|
||||
"cachedResultName": "HR New"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "d63Esv5UOI7IgJEf",
|
||||
"name": "Google Sheets account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "dab7587f-890d-4571-b03d-1a2948baa91c",
|
||||
"name": "Personal Info",
|
||||
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
|
||||
"position": [
|
||||
-140,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ $json.text }}",
|
||||
"options": {},
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"first_name\": {\n \"type\": \"string\"\n },\n \"last_name\": {\n \"type\": \"string\"\n },\n \"email\": {\n \"type\": \"string\"\n },\n \"telephone\": {\n \"type\": \"string\"\n },\n \"city\": {\n \"type\": \"string\"\n },\n \"birthdate\": {\n \"type\": \"string\"\n },\n \"linkedin\": {\n \"type\": \"string\"\n },\n \"website\": {\n \"type\": \"string\"\n },\n \"summary\": {\n \"type\": \"string\"\n }\n }\n}\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "5c815337-80c4-4332-9179-77c0a446c205",
|
||||
"name": "Qualification",
|
||||
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
|
||||
"position": [
|
||||
-140,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ $json.text }}",
|
||||
"options": {
|
||||
"systemPromptTemplate": "You are an expert extraction algorithm.\nOnly extract relevant information from the text.\nIf you do not know the value of an attribute asked to extract, you may omit the attribute's value."
|
||||
},
|
||||
"attributes": {
|
||||
"attributes": [
|
||||
{
|
||||
"name": "Educational Qualification",
|
||||
"required": true,
|
||||
"description": "Summary of your academic career. Focus on your high school and university studies. Summarize in 100 words maximum and also include your grade if applicable."
|
||||
},
|
||||
{
|
||||
"name": "Job History",
|
||||
"required": true,
|
||||
"description": "Work history summary. Focus on your most recent work experiences. Summarize in 100 words maximum"
|
||||
},
|
||||
{
|
||||
"name": "Skills",
|
||||
"required": true,
|
||||
"description": "Extract the candidate’s technical skills. What software and frameworks they are proficient in. Make a bulleted list."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ad245152-b1cc-4dcd-b9bc-c8ec8a592115",
|
||||
"name": "HR Expert",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
1500,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Profile:\n{{ $json['wanted-profile'] }}\n\nCandidate:{{ $('Summarizer').item.json.response.text }}",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"message": "=You are an HR expert, and your task is to determine whether a candidate aligns with the company's desired profile. You must assign a rating from 1 to 10, where 1 means the candidate does not meet the requirements, while 10 means the candidate is the perfect match for the role. Additionally, in the \"consideration\" field, explain the reasoning behind the given score."
|
||||
}
|
||||
]
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.5
|
||||
},
|
||||
{
|
||||
"id": "86a37824-a3d0-4199-bb2d-c7608d65f6de",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-820,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"width": 500,
|
||||
"height": 660,
|
||||
"content": "## Submission, Saving to Google Drive & Extraction\n\n**Captures user info from the form.**\n**Uploads resume to Google Drive.**\n**Extracts data from the PDF (resume).**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6a42aedf-e2a0-44fc-ae02-00d25ab56a91",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-300,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 560,
|
||||
"height": 660,
|
||||
"content": "## Extraction (Personal Info & Qualification)\n\n**Extracts personal details (name, city, etc.).**\n**Retrieves educational qualifications and job history.**"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "17134f76-322d-4621-ab85-340d1f9ea115",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
280,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 1120,
|
||||
"height": 660,
|
||||
"content": "## Merge & Summarization\n\n**Merges extracted information.**\n**Generates a concise professional summary.**\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "cf09a615-65dc-4c4d-8419-f05cadeb9405",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1420,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 640,
|
||||
"height": 660,
|
||||
"content": "## Voting, Consideration & Google Sheets\n\n**HR expert reviews and analyzes the summary.\n\nAssigns a rating (1-10) and provides hiring insights.\n\nAppends all details to Google Sheets for record-keeping.**\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ee76a66a-ce2a-4a4f-8c57-0cc48b8f7dcb",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-1960,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"color": 2,
|
||||
"width": 1060,
|
||||
"height": 660,
|
||||
"content": "# Automated Resume Processing & Evaluation System\n\n**This workflow streamlines the process of handling resume submissions, extracting key details, summarizing qualifications, and aiding HR in the decision-making process.**\n\n## 1. Submission, Saving to Google Drive & Extraction\n**The user submits a resume via a form.\nThe system saves the uploaded file to Google Drive for record-keeping.\nAI-powered text extraction retrieves personal details, qualifications, and job history from the document.**\n\n## 2. Extraction (Personal Info & Qualification)\n**The workflow identifies and extracts key details such as the candidate’s name, contact information, and location.\nIt scans for educational background, certifications, and past work experiences.**\n\n## 3. Merge & Summarization\n**The extracted data is merged into a structured format.\nA concise summary is generated, highlighting the candidate’s most relevant qualifications and experiences.**\n\n## 4. Voting, Consideration & Google Sheets\n**HR reviews the summarized profile and assigns a rating (1-10).\nHiring insights and comments are recorded for evaluation.\nAll processed data, including extracted details and review scores, are appended to a Google Sheet for tracking and further consideration.**\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "51e5290b-fadd-4f7c-99fc-8bfd54a1ee27",
|
||||
"name": "Upload to google drive",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
-440,
|
||||
100
|
||||
],
|
||||
"parameters": {
|
||||
"name": "=Resume-{{ $now.format('yyyyLLdd') }}-{{ $json.Resume[0].filename }}",
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "My Drive"
|
||||
},
|
||||
"options": {},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "root",
|
||||
"cachedResultName": "/ (Root folder)"
|
||||
},
|
||||
"inputDataFieldName": "Resume"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "Z5vnQSvmzFvtqQeL",
|
||||
"name": "Google Drive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "b69e22ba-ab56-4199-830a-4d74fd8c8e74",
|
||||
"name": "Resume extraction",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
-440,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "pdf",
|
||||
"binaryPropertyName": "Resume"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "653d83ad-309f-4e09-acf5-e7d0a1890e1e",
|
||||
"name": "wanted profile",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1240,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "8b812d8f-87d6-46e2-855a-b465c1248c2d",
|
||||
"name": "wanted-profile",
|
||||
"type": "string",
|
||||
"value": "We are a web agency looking for an Automation Expert skilled in workflow automation, API integrations, and AI-driven process optimization. The ideal candidate should have expertise in n8n, Python, and JavaScript, with a strong understanding of automation tools and webhooks. Experience in building custom automations for businesses is required. Requirements: Proficiency in n8n, Python, and JavaScript Experience in workflow automation, API integrations, and AI agents Ability to optimize business processes through automation Prior experience in the automation industry Must be based in Northern Italy If you have a passion for automation and want to work with a forward-thinking agency, we'd love to hear from you!"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "9ed47811-30d8-48e7-a05e-e5213f0e0526",
|
||||
"name": "Summarizer",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainSummarization",
|
||||
"position": [
|
||||
840,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"summarizationMethodAndPrompts": {
|
||||
"values": {
|
||||
"prompt": "=Write a concise summary of the following:\nFirst name:{{ $json.output.first_name }}\nLast name:{{ $json.output.last_name }}\nCity: {{ $json.output.city }}\nEducational Qualification:{{ $json.output['Educational Qualification'] }}\nPrevious experience:{{ $json.output['Job History'] }}\nSkills:{{ $json.output.Skills }}\nApplied date:{{$now.format('yyyy-MM-dd')}}\n\nWrite a concise Summary and summary of 100 words or less. Be concise and professional.\n\n",
|
||||
"combineMapPrompt": "=Write a concise summary of the following:\nFirst name:{{ $json.output.first_name }}\nLast name:{{ $json.output.last_name }}\nCity: {{ $json.output.city }}\nEducational Qualification:{{ $json.output['Educational Qualification'] }}\nPrevious experience:{{ $json.output['Job History'] }}\nSkills:{{ $json.output.Skills }}\nApplied date:{{$now.format('yyyy-MM-dd')}}\n\nWrite a concise Summary and summary of 100 words or less. Be concise and professional.\n\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "56329dd0-53e2-4617-ba54-c91e9f96d6ca",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
860,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "n2UwuicTmLclqMaY",
|
||||
"name": "OpenAi account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"callerPolicy": "workflowsFromSameOwner",
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "24ebf6c2-c041-4dc0-8fec-5728f86625f1",
|
||||
"connections": {
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Summarizer",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"HR Expert": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Google Sheets",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Summarizer": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "wanted profile",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Personal Info": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Qualification": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"wanted profile": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "HR Expert",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Qualification",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Personal Info",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Summarizer",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "HR Expert",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Resume extraction": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Personal Info",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Qualification",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On form submission": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload to google drive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Resume extraction",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "HR Expert",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,758 @@
|
||||
{
|
||||
"id": "P307QnrxpA1ddsM5",
|
||||
"meta": {
|
||||
"instanceId": "fb924c73af8f703905bc09c9ee8076f48c17b596ed05b18c0ff86915ef8a7c4a",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Generate SQL queries from schema only - AI-powered",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "b7c3ca47-11b3-4378-81fa-68b2f56b295e",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
1460,
|
||||
440
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o",
|
||||
"options": {
|
||||
"temperature": 0.2
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "rveqdSfp7pCRON1T",
|
||||
"name": "Ted's Tech Talks OpenAi"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "977c3a82-440b-4d44-9042-47a673bcb52c",
|
||||
"name": "Window Buffer Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
"position": [
|
||||
1640,
|
||||
440
|
||||
],
|
||||
"parameters": {
|
||||
"contextWindowLength": 10
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "c6e9c0e2-d238-4f0b-a4c8-2271f2c8b31b",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
2340,
|
||||
520
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4c141ae8-d2d1-45c7-bb5d-f33841d3cee6",
|
||||
"name": "List all tables in a database",
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"position": [
|
||||
520,
|
||||
-35
|
||||
],
|
||||
"parameters": {
|
||||
"query": "SHOW TABLES;",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "ICakJ1LRuVl4dRTs",
|
||||
"name": "db4free TTT account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.4
|
||||
},
|
||||
{
|
||||
"id": "54fb3362-041b-4e4f-bfea-f0bc788d8dfd",
|
||||
"name": "Extract database schema",
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"position": [
|
||||
700,
|
||||
-35
|
||||
],
|
||||
"parameters": {
|
||||
"query": "DESCRIBE {{ $json.Tables_in_tttytdb2023 }};",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "ICakJ1LRuVl4dRTs",
|
||||
"name": "db4free TTT account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.4
|
||||
},
|
||||
{
|
||||
"id": "d55e841d-11ed-4ce2-8c8e-840bd807ff2c",
|
||||
"name": "Add table name to output",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
880,
|
||||
-35
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "764176d6-3c89-404d-9c71-301e8a406a68",
|
||||
"name": "table",
|
||||
"type": "string",
|
||||
"value": "={{ $('List all tables in a database').item.json.Tables_in_tttytdb2023 }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "ca8d30d6-c1f1-4e89-8cd5-ea3648dc3b0c",
|
||||
"name": "Convert data to binary",
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"position": [
|
||||
1060,
|
||||
-35
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "toJson"
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "2d89f901-d4e7-4fea-bd69-20b518280bbc",
|
||||
"name": "Save file locally",
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"position": [
|
||||
1220,
|
||||
-35
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fileName": "./chinook_mysql.json",
|
||||
"operation": "write"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "04511c4f-44fa-4c23-87af-54d959e6cb2c",
|
||||
"name": "Extract data from file",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
920,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "fromJson"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "96f129c0-d1d4-4cbf-a24d-0b0cea18a229",
|
||||
"name": "Chat Trigger",
|
||||
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
|
||||
"position": [
|
||||
440,
|
||||
420
|
||||
],
|
||||
"webhookId": "c308dec7-655c-4b79-832e-991bd8ea891f",
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "4d993ed9-3bbe-4bc3-9e5b-c3d738b0e714",
|
||||
"name": "AI Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1480,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Here is the database schema: {{ $json.schema }}\nHere is the user request: {{ $('Chat Trigger').item.json.chatInput }}",
|
||||
"agent": "conversationalAgent",
|
||||
"options": {
|
||||
"humanMessage": "TOOLS\n------\nAssistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:\n\n{tools}\n\n{format_instructions}\n\nUSER'S INPUT\n--------------------\nHere is the user's input (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):\n\n{{input}}",
|
||||
"systemMessage": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n\nHelp user to work with the MySQL database.\n\nPlease wrap any sql commands into triple quotes. You don't have a tool to run SQL, so the user will do that instead of you."
|
||||
},
|
||||
"promptType": "define"
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "f5749b31-b28a-4341-b57f-94ee422d2873",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
320,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 1065.0949045120822,
|
||||
"height": 466.4256045427794,
|
||||
"content": "## Run this part only once\nThis section:\n* loads a list of all tables from the database hosted on [db4free](https://db4free.net/signup.php) \n* extracts the database schema for each table and adds the table name\n* converts the schema into a binary JSON format\n* saves the schema `./chinook_mysql.json` file locally\n\n***Now you can use chat to \"talk\" to your data!*** 🎉"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6606abc9-1dcb-4dba-b7ef-e221f892eed8",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1040,
|
||||
-255
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 312.47220527158765,
|
||||
"height": 174.60585869504342,
|
||||
"content": "## Pre-workflow setup \nConnect to a free MySQL server and import your database. Follow Step 1 and 2 in this [tutorial](https://blog.n8n.io/compare-databases/) for more.\n\n*The Chinook data used in this workflow is available on [GitHub](https://github.com/msimanga/chinook/tree/master/mysql).* "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c8ac730a-04ee-499d-b845-1149967d6aa2",
|
||||
"name": "When clicking \"Test workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
360,
|
||||
-35
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6f0b167c-e012-43e1-9892-ded05be47cf8",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
324.32561050665913,
|
||||
209.72072645338642
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 1062.678698911262,
|
||||
"height": 489.29614613074125,
|
||||
"content": "## On every chat message:\n\n* The workflow gets the data from the local schema file and extracts it as a JSON object. This way, we achieve two important improvements:\n * faster processing time as we don't need to fetch the schema for each table from a slow remote database\n * the Agent will know database structure without seeing the actual data\n* DB schema is then converted into a long string, JSON fields from the Chat Trigger are added before they are entered into the Agent node.\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3a79350c-aec1-4ad4-a2e0-679957fa420b",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1400,
|
||||
-15.552780029374958
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 445.66588600071304,
|
||||
"height": 714.7896619176862,
|
||||
"content": "### LangChain AI Agent's system prompt is modified.\nIt uses only the database schema to generate SQL queries. The agent creates these queries but does not execute them. Instead, it passes them to subsequent nodes.\n\n**Example:**\n\"Can you show me the list of all German customers?\" \n\nQueries are generated only when necessary; for some requests, a query may not be needed. This is because certain questions can be answered directly without SQL execution.\n\n**Example:**\n\"Can you list me all tables?\""
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0cd425db-2a8e-4f48-b749-9a082e948395",
|
||||
"name": "Combine schema data and chat input",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1140,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "42abd24e-419a-47d6-bc8b-7146dd0b8314",
|
||||
"name": "sessionId",
|
||||
"type": "string",
|
||||
"value": "={{ $('Chat Trigger').first().json.sessionId }}"
|
||||
},
|
||||
{
|
||||
"id": "39244192-a1a6-42fe-bc75-a6fba1f264df",
|
||||
"name": "action",
|
||||
"type": "string",
|
||||
"value": "={{ $('Chat Trigger').first().json.action }}"
|
||||
},
|
||||
{
|
||||
"id": "f78c57d9-df13-43c7-89a7-5387e528107e",
|
||||
"name": "chatinput",
|
||||
"type": "string",
|
||||
"value": "={{ $('Chat Trigger').first().json.chatInput }}"
|
||||
},
|
||||
{
|
||||
"id": "e42b39eb-dfbd-48d9-94ed-d658bdd41454",
|
||||
"name": "schema",
|
||||
"type": "string",
|
||||
"value": "={{ $json.data }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "e4045e33-bb87-488d-8ccf-b4a94339a841",
|
||||
"name": "Load the schema from the local file",
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"position": [
|
||||
680,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fileSelector": "./chinook_mysql.json"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "367ebe95-0b87-44f6-8392-33fe65446c24",
|
||||
"name": "Extract SQL query",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1900,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "ebbe194a-4b8b-44c9-ac19-03cf69d353bf",
|
||||
"name": "query",
|
||||
"type": "string",
|
||||
"value": "={{ ($json.output.match(/SELECT[\\s\\S]*?;/i) || [])[0] || \"\" }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "b856fe78-2435-4075-97f8-ecbeecf3e780",
|
||||
"name": "Check if query exists",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
2060,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 2,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "2963d04d-9d79-49f9-b52a-dc8732aca781",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.query }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "87162d31-2f6c-4f4a-af28-c65cbadd8ed5",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1874,
|
||||
220.45316744685329
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 317.8901548206743,
|
||||
"height": 278.8174358200552,
|
||||
"content": "## SQL query extraction\nCheck if the agent's response contains an SQL query. If it does, we extract the query using a regular expression."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b3e77333-eaa9-4d23-a78c-8a19ae074739",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1860,
|
||||
-16.43746604251737
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 882.7611828369563,
|
||||
"height": 715.7029266156915,
|
||||
"content": ""
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "269ea79d-5f17-4764-aebb-bba31b43d8bb",
|
||||
"name": "Sticky Note7",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1580,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 257.46308756569573,
|
||||
"height": 108.03673727584527,
|
||||
"content": "The AI Agent remembers the schema, questions, and final answers, but not data values, since queries run externally. The agent can't access database content. "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2fd1175c-4110-48be-b6bf-2251c678bc04",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2420,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 308.8514666587585,
|
||||
"height": 123.43139661532095,
|
||||
"content": "- The SQL node accesses the database and executes the query. The results are then formatted for readability.\n- Both the chat response and the query result are displayed in the chat window."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "61ae7f7c-1424-4ecb-8a12-78cd98e94d45",
|
||||
"name": "Sticky Note8",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2480,
|
||||
600
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 250.40895053328057,
|
||||
"height": 89.90186716520257,
|
||||
"content": "When the agent responds without an SQL query, you receive an immediate answer with no additional processing."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "cbb6d1e1-0a75-4b3a-89cd-6bd545b8d414",
|
||||
"name": "Format query results",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2420,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "f944d21f-6aac-4842-8926-4108d6cad4bf",
|
||||
"name": "sqloutput",
|
||||
"type": "string",
|
||||
"value": "={{ Object.keys($jmespath($input.all(),'[].json')[0]).join(' | ') }} \n{{ ($jmespath($input.all(),'[].json')).map(obj => Object.values(obj).join(' | ')).join('\\n') }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "d958de24-84ef-4928-a7f3-32cada09a0eb",
|
||||
"name": "Run SQL query",
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"position": [
|
||||
2260,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"query": "{{ $json.query }}",
|
||||
"options": {},
|
||||
"operation": "executeQuery"
|
||||
},
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "ICakJ1LRuVl4dRTs",
|
||||
"name": "db4free TTT account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.4
|
||||
},
|
||||
{
|
||||
"id": "99a6dc03-1035-4866-81e4-11dc66bf98ec",
|
||||
"name": "Prepare final output",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2560,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "aa55e186-1535-4923-aee4-e088ca69575b",
|
||||
"name": "output",
|
||||
"type": "string",
|
||||
"value": "={{ $json.output }}\n\nSQL result:\n```markdown\n{{ $json.sqloutput }}\n```"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "9380c2f6-15d9-43e4-80a2-3019bcf5ae04",
|
||||
"name": "Combine query result and chat answer",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
2340,
|
||||
340
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {},
|
||||
"combineBy": "combineByPosition"
|
||||
},
|
||||
"typeVersion": 3
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "15049b13-91cb-46bd-a7a0-ad648b6f667a",
|
||||
"connections": {
|
||||
"AI Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract SQL query",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Chat Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Load the schema from the local file",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Run SQL query": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format query results",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract SQL query": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check if query exists",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format query results": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Combine query result and chat answer",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Window Buffer Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check if query exists": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Run SQL query",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Combine query result and chat answer",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert data to binary": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Save file locally",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract data from file": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Combine schema data and chat input",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract database schema": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add table name to output",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add table name to output": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert data to binary",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"List all tables in a database": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract database schema",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking \"Test workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "List all tables in a database",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Combine schema data and chat input": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Load the schema from the local file": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract data from file",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Combine query result and chat answer": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prepare final output",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,368 @@
|
||||
{
|
||||
"id": "SCUbdpVPX4USbQmr",
|
||||
"meta": {
|
||||
"instanceId": "7c617982c5622c49e1ea217f3ee01da25b7fb42fb9e969ce6e4e1b6c269ad0e5",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "youtube chapter generator",
|
||||
"tags": [
|
||||
{
|
||||
"id": "637Ga13eORejFbTG",
|
||||
"name": "youtube",
|
||||
"createdAt": "2025-04-06T16:41:11.086Z",
|
||||
"updatedAt": "2025-04-06T16:41:11.086Z"
|
||||
},
|
||||
{
|
||||
"id": "tfcUyZ2pGsRZFcje",
|
||||
"name": "chapters",
|
||||
"createdAt": "2025-04-06T16:41:28.633Z",
|
||||
"updatedAt": "2025-04-06T16:41:28.633Z"
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "104fa4ce-cd86-4fff-b31c-0ef37fba6d93",
|
||||
"name": "When clicking ‘Test workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
-800,
|
||||
-120
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c3b45480-3098-40f9-a77f-ada54481b590",
|
||||
"name": "Get Caption ID",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
-200,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://www.googleapis.com/youtube/v3/captions?part=snippet&videoId={{ $json.id }}",
|
||||
"options": {},
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "youTubeOAuth2Api"
|
||||
},
|
||||
"credentials": {
|
||||
"youTubeOAuth2Api": {
|
||||
"id": "1TkjUqPfFCQ6NzL7",
|
||||
"name": "YouTube account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "fe08adc4-e6ef-47ae-a946-1e6d5a85e10e",
|
||||
"name": "Get Captions",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
20,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://www.googleapis.com/youtube/v3/captions/{{ $json.items[0].id }}?tfmt=srt",
|
||||
"options": {},
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "youTubeOAuth2Api"
|
||||
},
|
||||
"credentials": {
|
||||
"youTubeOAuth2Api": {
|
||||
"id": "1TkjUqPfFCQ6NzL7",
|
||||
"name": "YouTube account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "0e15f334-9ff8-4a7e-85a9-4cf8cf10ea55",
|
||||
"name": "Extract Captions",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
240,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "text"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "af99a919-7ebc-4a6c-80be-83e2ffa68d05",
|
||||
"name": "Structured Captions",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
640,
|
||||
100
|
||||
],
|
||||
"parameters": {
|
||||
"jsonSchemaExample": "{\n\t\"description\": \"California\"\n\t\n}"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "414a41a2-0715-4a57-a606-9f3678b2472a",
|
||||
"name": "Get Video Meta Data",
|
||||
"type": "n8n-nodes-base.youTube",
|
||||
"position": [
|
||||
-420,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"videoId": "={{ $json.video_id }}",
|
||||
"resource": "video",
|
||||
"operation": "get"
|
||||
},
|
||||
"credentials": {
|
||||
"youTubeOAuth2Api": {
|
||||
"id": "1TkjUqPfFCQ6NzL7",
|
||||
"name": "YouTube account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7304d9b1-5956-41c3-b78a-2c409d0aa726",
|
||||
"name": "Google Gemini Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
|
||||
"position": [
|
||||
460,
|
||||
100
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"modelName": "models/gemini-1.5-flash-8b-exp-0924"
|
||||
},
|
||||
"credentials": {
|
||||
"googlePalmApi": {
|
||||
"id": "FshILEOmCAPVoGfW",
|
||||
"name": "Google Gemini(PaLM) Api account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "867a6ad6-0712-4fbf-97fd-ab054b783172",
|
||||
"name": "Set Video ID",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
-640,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "568762f7-e496-4550-8567-d49e2ce1676d",
|
||||
"name": "video_id",
|
||||
"type": "string",
|
||||
"value": "r1wqsrW2vmE"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "dcd0c9d7-1a69-45e8-98e9-b7cf7d12734e",
|
||||
"name": "Update Chapters",
|
||||
"type": "n8n-nodes-base.youTube",
|
||||
"position": [
|
||||
940,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"title": "={{ $('Get Video Meta Data').item.json.snippet.title }}",
|
||||
"videoId": "={{ $('Get Captions').item.json.items[0].snippet.videoId }}",
|
||||
"resource": "video",
|
||||
"operation": "update",
|
||||
"categoryId": "22",
|
||||
"regionCode": "US",
|
||||
"updateFields": {
|
||||
"description": "={{ $json.output.description }}\nChapters\n{{ $json.output.description }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"youTubeOAuth2Api": {
|
||||
"id": "1TkjUqPfFCQ6NzL7",
|
||||
"name": "YouTube account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "916629c4-6e49-4432-88e8-626748cb3d24",
|
||||
"name": "Tag Chapters in Description",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
460,
|
||||
-120
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=This is an srt format data. please classify this data into chapters\nbased upon this transcript \n{{ $json.data }}\n{\n\"description\":\"00:00 Introduction\n02:15 Topic One\n05:30 Topic Two\n10:45 Conclusion\"\n}\n",
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "b0f56d68-b787-4ccc-8bb5-bdb5b04c3ae4",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-680,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"width": 1040,
|
||||
"height": 440,
|
||||
"content": "\n## Get Captions"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0bcee6b5-0e8b-4f85-8f83-c829e785467a",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
378,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 420,
|
||||
"height": 440,
|
||||
"content": "## Generate Chapters\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0f90f6ec-2154-4945-b262-6531fef2334f",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
820,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 440,
|
||||
"height": 440,
|
||||
"content": "## Update Description\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "27125160-7c64-4431-b243-832c1ae29d29",
|
||||
"connections": {
|
||||
"Get Captions": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract Captions",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Video ID": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Video Meta Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Caption ID": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Captions",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract Captions": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Tag Chapters in Description",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Video Meta Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Caption ID",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Captions": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Tag Chapters in Description",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Google Gemini Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Tag Chapters in Description",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Tag Chapters in Description": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Update Chapters",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Video ID",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,622 @@
|
||||
{
|
||||
"id": "XnGZZfT5u0Cw1X3p",
|
||||
"meta": {
|
||||
"instanceId": "3378b0d68c3b7ebfc71b79896d94e1a044dec38e99a1160aed4e9c323910fbe2",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Attachments Gmail to drive and google sheets",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "0404ef0a-9750-495a-8798-98d4b059a083",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-580,
|
||||
-420
|
||||
],
|
||||
"parameters": {
|
||||
"height": 440,
|
||||
"content": "## Setup\n1. Setup your **Gmail** and **Google Drive** credentials\n2. Setup your **Google Sheets** credentials\n3. Setup your **Openai** api key"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8751a7f1-aae4-4746-aae7-3d8563845b8c",
|
||||
"name": "Gmail Trigger1",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"position": [
|
||||
-640,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"simple": false,
|
||||
"filters": {
|
||||
"readStatus": "unread"
|
||||
},
|
||||
"options": {
|
||||
"downloadAttachments": true
|
||||
},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "v8YJP3VfeGtRk5la",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "40f62192-5acb-4915-aa07-e5a0dfeb7581",
|
||||
"name": "Setup1",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
-300,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "4cca07a2-6a70-4011-a025-65246e652fb9",
|
||||
"name": "url_to_drive_folder",
|
||||
"type": "string",
|
||||
"value": "1fCWCdqrFP3WrjjLc-gJtxMaiaF5lh8Ko"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "d928e797-8851-4ab4-9199-cd555a40eae9",
|
||||
"name": "Upload PDF to Drive1",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"maxTries": 5,
|
||||
"position": [
|
||||
220,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://www.googleapis.com/upload/drive/v3/files",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"sendBody": true,
|
||||
"sendQuery": true,
|
||||
"contentType": "binaryData",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"queryParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "uploadType",
|
||||
"value": "media"
|
||||
}
|
||||
]
|
||||
},
|
||||
"inputDataFieldName": "={{ $binary.attachment_0.mimeType === \"application/pdf\"\n ? \"attachment_0\"\n : \"attachment_1\" }}",
|
||||
"nodeCredentialType": "googleDriveOAuth2Api"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "p5I6S4YkJps1zvwz",
|
||||
"name": "Google Drive account 2"
|
||||
}
|
||||
},
|
||||
"retryOnFail": true,
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "22df6933-a0c7-4cce-8114-5332038a14c3",
|
||||
"name": "Rename file1",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
400,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $json.id }}"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "update",
|
||||
"newUpdatedFileName": "={{ $('Setup1').item.json.subject }}_invoice_{{ $now.format('yyyy-MM-dd') }}.pdf"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "p5I6S4YkJps1zvwz",
|
||||
"name": "Google Drive account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "ce6a6a4c-17ba-4cf7-b07a-97b9d8d80844",
|
||||
"name": "Move to the correct folder1",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
580,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $json.id }}"
|
||||
},
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "My Drive",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
|
||||
"cachedResultName": "My Drive"
|
||||
},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1fCWCdqrFP3WrjjLc-gJtxMaiaF5lh8Ko",
|
||||
"cachedResultUrl": "",
|
||||
"cachedResultName": "2025"
|
||||
},
|
||||
"operation": "move"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "p5I6S4YkJps1zvwz",
|
||||
"name": "Google Drive account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "e64aac5c-a314-46b6-b7db-fc0d6f450e1f",
|
||||
"name": "Gmail",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"position": [
|
||||
1240,
|
||||
0
|
||||
],
|
||||
"webhookId": "556cbee3-8de0-4645-9e91-e7c0c252f2ab",
|
||||
"parameters": {
|
||||
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
|
||||
"operation": "markAsRead"
|
||||
},
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "v8YJP3VfeGtRk5la",
|
||||
"name": "Gmail account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
},
|
||||
{
|
||||
"id": "ea74cfc1-0305-418d-9f5f-bffcfb3bb2c7",
|
||||
"name": "Extract from File2",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
1200,
|
||||
-180
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "pdf"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0398d982-78fd-4830-b5cf-271195af80fd",
|
||||
"name": "Google Drive",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
800,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $json.id }}"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "download"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "p5I6S4YkJps1zvwz",
|
||||
"name": "Google Drive account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "3b4a96d4-a6ee-486a-a795-fe410ccc38b2",
|
||||
"name": "OpenAI Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmOpenAi",
|
||||
"position": [
|
||||
1740,
|
||||
20
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o",
|
||||
"cachedResultName": "gpt-4o"
|
||||
},
|
||||
"options": {
|
||||
"temperature": 0
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "XJdxgMSXFgwReSsh",
|
||||
"name": "n8n key"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a7dd0d95-5e79-4bd2-a8a6-2178264d19fc",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
1940,
|
||||
40
|
||||
],
|
||||
"parameters": {
|
||||
"jsonSchema": "{\n \"Invoice date\": { \"type\": \"date\" },\n \"Invoice description\": { \"type\": \"string\" },\n \"Total price\": { \"type\": \"number\" },\n \"Fichero\": { \"type\": \"string\" }\n}"
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "68d98f4c-e679-48e3-a1a1-529cda4e31a4",
|
||||
"name": "Append to Reconciliation Sheet",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
2280,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {},
|
||||
"schema": [
|
||||
{
|
||||
"id": "Invoice date",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "Invoice date",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Invoice Description",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "Invoice Description",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Total price",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "Total price",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Fichero",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "Fichero",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "autoMapInputData",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "gid=0"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1gIUnjSWUhsoTOVVd4ZoVjARCGQfGE8s7FWcju3lNajM",
|
||||
"cachedResultUrl": "",
|
||||
"cachedResultName": "facturas"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "3IOU2VjBnR4hGohx",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.3
|
||||
},
|
||||
{
|
||||
"id": "80e1c8f4-b593-4c5f-b9e2-f3b7996ee6d4",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1680,
|
||||
-400
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 805.0578351924228,
|
||||
"height": 656.5014186128178,
|
||||
"content": "## 3. Use LLMs to Extract Values from Data\n[Read more about Basic LLM Chain](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainllm/)\n\nLarge language models are perfect for data extraction tasks as they can work across a range of document layouts without human intervention. The extracted data can then be sent to a variety of datastores such as spreadsheets, accounting systems and/or CRMs.\n\n**Tip:** The \"Structured Output Parser\" ensures the AI output can be\ninserted to our spreadsheet without additional clean up and/or formatting. "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3754e10e-a233-4ce0-bc79-bb5c01db9695",
|
||||
"name": "Map Output",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2080,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"options": {},
|
||||
"jsonOutput": "={{ $json.output }}"
|
||||
},
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "a42ff16f-d0df-4b6d-9a36-849f85d1facc",
|
||||
"name": "Apply Data Extraction Rules",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
1740,
|
||||
-140
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Given the following invoice in the <invoice> xml tags, extract the following information as listed below.\nIf you cannot the information for a specific item, then leave blank and skip to the next. \n\n* Invoice date\n* Invoice Description: {{ $('Rename file1').item.json.name }}\n* Total price\n* Fichero: =HYPERLINK(\"https://drive.google.com/file/d/{{ $('Move to the correct folder1').item.json.id }}/view\", \"Ver Documento\")\n\n\n<invoice>{{ $json.text }}</invoice>",
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.4
|
||||
},
|
||||
{
|
||||
"id": "f6de5d5a-d2dc-4590-8f46-3f250b8fca9f",
|
||||
"name": "Sticky Note6",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1860,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"width": 192.26896179623753,
|
||||
"height": 213.73043662572252,
|
||||
"content": "\n\n\n\n\n\n\n\n\n\n\n\n**Need more attributes?**\nChange it here!"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "255fe8c1-5bd7-41cc-b1f9-c8956b5ad101",
|
||||
"name": "Only invoice mails with attachments",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
0,
|
||||
120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"version": 1,
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "or",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "229200d1-ec13-4970-ae0e-2c8e17da0bdf",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "contains"
|
||||
},
|
||||
"leftValue": "={{ $('Gmail Trigger1').item.json.headers['content-type'] }}",
|
||||
"rightValue": "multipart/mixed"
|
||||
},
|
||||
{
|
||||
"id": "new-condition",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "isNotEmpty"
|
||||
},
|
||||
"leftValue": "={{ $json.attachments }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.1
|
||||
}
|
||||
],
|
||||
"active": true,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "eb152808-e993-4e18-9dd8-10f21df57bf1",
|
||||
"connections": {
|
||||
"Gmail": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Setup1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Only invoice mails with attachments",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Map Output": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Append to Reconciliation Sheet",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Google Drive": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract from File2",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Apply Data Extraction Rules",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rename file1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Move to the correct folder1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gmail Trigger1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Setup1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract from File2": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Apply Data Extraction Rules",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Upload PDF to Drive1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Rename file1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Apply Data Extraction Rules",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Apply Data Extraction Rules": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Map Output",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Move to the correct folder1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Google Drive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Only invoice mails with attachments": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload PDF to Drive1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Gmail",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,500 @@
|
||||
{
|
||||
"id": "sUIPemKdKqmUQFt6",
|
||||
"meta": {
|
||||
"instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "Extract text from PDF and image using Vertex AI (Gemini) into CSV",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "f60ef5f9-bc08-4cc9-804e-697ae6f88b9b",
|
||||
"name": "Google Gemini Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
|
||||
"position": [
|
||||
980,
|
||||
920
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"modelName": "models/gemini-1.5-pro-latest"
|
||||
},
|
||||
"credentials": {
|
||||
"googlePalmApi": {
|
||||
"id": "hmNTKSKfppgtDbM5",
|
||||
"name": "Google Gemini(PaLM) Api account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "81d3f7b8-20cb-4aac-82a9-d4e8e6581105",
|
||||
"name": "Get PDF or Images",
|
||||
"type": "n8n-nodes-base.googleDriveTrigger",
|
||||
"position": [
|
||||
220,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"event": "fileCreated",
|
||||
"options": {},
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
},
|
||||
"triggerOn": "specificFolder",
|
||||
"folderToWatch": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1HOeRP5iwccg93UPUYmWYD7DyDmRREkhj",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/folders/1HOeRP5iwccg93UPUYmWYD7DyDmRREkhj",
|
||||
"cachedResultName": "Actual Budget"
|
||||
},
|
||||
"authentication": "serviceAccount"
|
||||
},
|
||||
"credentials": {
|
||||
"googleApi": {
|
||||
"id": "axkK6IN61bEAT6GM",
|
||||
"name": "Google Service Account account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "fe9a8228-7950-4e2c-8982-328e03725782",
|
||||
"name": "Route based on PDF or Image",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"position": [
|
||||
480,
|
||||
420
|
||||
],
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"rules": [
|
||||
{
|
||||
"value2": "application/pdf",
|
||||
"outputKey": "pdf"
|
||||
},
|
||||
{
|
||||
"value2": "image/",
|
||||
"operation": "contains",
|
||||
"outputKey": "image"
|
||||
}
|
||||
]
|
||||
},
|
||||
"value1": "={{$json.mimeType}}",
|
||||
"dataType": "string"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "f62b71e5-af17-4f85-abff-7cee5100affc",
|
||||
"name": "Download PDF",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
740,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Get PDF or Images').item.json.id }}"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "download",
|
||||
"authentication": "serviceAccount"
|
||||
},
|
||||
"credentials": {
|
||||
"googleApi": {
|
||||
"id": "axkK6IN61bEAT6GM",
|
||||
"name": "Google Service Account account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "fa99fbcf-1353-410d-a0db-48cea1178a76",
|
||||
"name": "Download Image",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
740,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Get PDF or Images').item.json.id }}"
|
||||
},
|
||||
"options": {},
|
||||
"operation": "download",
|
||||
"authentication": "serviceAccount"
|
||||
},
|
||||
"credentials": {
|
||||
"googleApi": {
|
||||
"id": "axkK6IN61bEAT6GM",
|
||||
"name": "Google Service Account account"
|
||||
}
|
||||
},
|
||||
"executeOnce": true,
|
||||
"retryOnFail": false,
|
||||
"typeVersion": 3,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "e4979746-44bb-493e-b5eb-f9646b510888",
|
||||
"name": "Extract data from PDF",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
980,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "pdf"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6549c335-e749-4b95-b77d-096a5e77af5e",
|
||||
"name": "Send data to A.I.",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1180,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://openrouter.ai/api/v1/chat/completions",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"model\": \"meta-llama/llama-3.1-70b-instruct:free\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"You are given a bank statement.{{encodeURIComponent($json.text)}}. Read the PDF and export all the transactions as CSV. Add a column called category and based on the information assign a category name. Return only the CSV data starting with the header row.\"\n }\n ]\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "WY7UkF14ksPKq3S8",
|
||||
"name": "Header Auth account 2"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2,
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"id": "42341f03-c9fc-4290-963e-1a723202a739",
|
||||
"name": "Convert to CSV",
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"position": [
|
||||
1400,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "bb446447-3f46-47e7-96a2-3fc720715828",
|
||||
"name": "Upload to Google Drive",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
1640,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"name": "={{$today}}",
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "My Drive",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
|
||||
"cachedResultName": "My Drive"
|
||||
},
|
||||
"options": {},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1Zo4OFCv1qWRX1jo0VL_iqUBf4v0fZEXe",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/folders/1Zo4OFCv1qWRX1jo0VL_iqUBf4v0fZEXe",
|
||||
"cachedResultName": "CSV Exports"
|
||||
},
|
||||
"authentication": "serviceAccount"
|
||||
},
|
||||
"credentials": {
|
||||
"googleApi": {
|
||||
"id": "axkK6IN61bEAT6GM",
|
||||
"name": "Google Service Account account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "843bc9c1-79a6-4f42-b9ee-fbec5f30b18d",
|
||||
"name": "Convert to CSV2",
|
||||
"type": "n8n-nodes-base.convertToFile",
|
||||
"position": [
|
||||
1360,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "6404bf65-3a7e-4be9-9b7f-98a23dca2ffd",
|
||||
"name": "Upload to Google Drive1",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
1640,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"name": "={{$today}}",
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "My Drive",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
|
||||
"cachedResultName": "My Drive"
|
||||
},
|
||||
"options": {},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1Zo4OFCv1qWRX1jo0VL_iqUBf4v0fZEXe",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/folders/1Zo4OFCv1qWRX1jo0VL_iqUBf4v0fZEXe",
|
||||
"cachedResultName": "CSV Exports"
|
||||
},
|
||||
"authentication": "serviceAccount"
|
||||
},
|
||||
"credentials": {
|
||||
"googleApi": {
|
||||
"id": "axkK6IN61bEAT6GM",
|
||||
"name": "Google Service Account account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "5dd5771f-6ccb-47ab-acbb-d6cbec60d22b",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
220,
|
||||
-40
|
||||
],
|
||||
"parameters": {
|
||||
"width": 589.0376569037658,
|
||||
"height": 163.2468619246862,
|
||||
"content": "## How to extract PDF and image text into CSV using n8n (without manual data entry)\n\nThis workflow will extract text data from PDF and images, then store it as CSV.\n\n[💡 You can read more about this workflow here](https://rumjahn.com/how-to-create-an-a-i-agent-to-analyze-matomo-analytics-using-n8n-for-free/)"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "37416630-9b52-4ce6-98d0-1bdd39ff0d6b",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
160,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"color": 4,
|
||||
"width": 248.11715481171547,
|
||||
"height": 432.7364016736402,
|
||||
"content": "## Get PDF or image\nYou need to create a new folder inside Google Drive for uploading your PDF and images.\n\nOnce you create a folder, you need to add your Google cloud user by going to Share -> Add user. The user email should be like: n8n-server@n8n-server-435232.iam.gserviceaccount.com"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3ab10f17-de8f-4263-aef8-cc2fb090ffe5",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1120,
|
||||
52.864368048917754
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"height": 446.3929762816575,
|
||||
"content": "## Send to Openrouter\nYou need to set up an Openrouter account to use this. It sends the data to openrouter to extract text.\n\nUse Header Auth. Name is \"Authorization\" and value is \"Bearer {API token}\"."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e966f95c-c54e-4d11-895d-d5f75c53aca5",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
920,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"color": 6,
|
||||
"width": 399.0962343096232,
|
||||
"height": 517.154811715481,
|
||||
"content": "## Vertex AI for image recogniztion\nWe send the photo to Vertex AI to extract text. You'll need to activate Vertex AI and add the correct rights to your Google cloud credentials. \n- Enable Vertex API\n- Add vertex to user account"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "daa3ab66-fa14-4792-96d0-3bcbeffd5d60",
|
||||
"name": "Vertex A.I. extract text",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
980,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Extract the transactions from the image",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"message": "=You are given a screenshot of payment transactions. Read the image and export all the transactions as CSV. Add a column called category and based on the information assign a category name. Return only the CSV data starting with the header row."
|
||||
},
|
||||
{
|
||||
"type": "HumanMessagePromptTemplate",
|
||||
"messageType": "imageBinary"
|
||||
}
|
||||
]
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.4
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "80635382-3d1c-4e46-a753-84b033cfc3a7",
|
||||
"connections": {
|
||||
"Download PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract data from PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert to CSV": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload to Google Drive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Download Image": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Vertex A.I. extract text",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Convert to CSV2": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload to Google Drive1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get PDF or Images": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Route based on PDF or Image",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Send data to A.I.": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert to CSV",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract data from PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send data to A.I.",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Google Gemini Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Vertex A.I. extract text",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Vertex A.I. extract text": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Convert to CSV2",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Route based on PDF or Image": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Download PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Download Image",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,670 @@
|
||||
{
|
||||
"id": "t1P14FvfibKYCh3E",
|
||||
"meta": {
|
||||
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
|
||||
"templateCredsSetupCompleted": true
|
||||
},
|
||||
"name": "HR-focused automation pipeline with AI",
|
||||
"tags": [],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "b1092f93-502c-4af0-962e-2b69311b92a3",
|
||||
"name": "On form submission",
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"position": [
|
||||
-520,
|
||||
-200
|
||||
],
|
||||
"webhookId": "2a87705d-8ba1-41f1-80ef-85f364ce253e",
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"formTitle": "Send CV",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "Name",
|
||||
"placeholder": "Name",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldType": "email",
|
||||
"fieldLabel": "Email",
|
||||
"placeholder": "Email",
|
||||
"requiredField": true
|
||||
},
|
||||
{
|
||||
"fieldType": "file",
|
||||
"fieldLabel": "CV",
|
||||
"requiredField": true,
|
||||
"acceptFileTypes": ".pdf"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2.2
|
||||
},
|
||||
{
|
||||
"id": "77edfe2a-4c6a-48c8-8dc9-b275491be090",
|
||||
"name": "Extract from File",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
-160,
|
||||
-200
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "pdf",
|
||||
"binaryPropertyName": "CV"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ebf2e194-3515-4c0a-8745-790b63bf336f",
|
||||
"name": "Qualifications",
|
||||
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
|
||||
"position": [
|
||||
160,
|
||||
-100
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ $json.text }}",
|
||||
"options": {
|
||||
"systemPromptTemplate": "You are an expert extraction algorithm.\nOnly extract relevant information from the text.\nIf you do not know the value of an attribute asked to extract, you may omit the attribute's value."
|
||||
},
|
||||
"attributes": {
|
||||
"attributes": [
|
||||
{
|
||||
"name": "Educational qualification",
|
||||
"required": true,
|
||||
"description": "Summary of your academic career. Focus on your high school and university studies. Summarize in 100 words maximum and also include your grade if applicable."
|
||||
},
|
||||
{
|
||||
"name": "Job History",
|
||||
"required": true,
|
||||
"description": "Work history summary. Focus on your most recent work experiences. Summarize in 100 words maximum"
|
||||
},
|
||||
{
|
||||
"name": "Skills",
|
||||
"required": true,
|
||||
"description": "Extract the candidate’s technical skills. What software and frameworks they are proficient in. Make a bulleted list."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4f40404c-1d47-4bde-9b4b-16367cf11e4f",
|
||||
"name": "Summarization Chain",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainSummarization",
|
||||
"position": [
|
||||
900,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"summarizationMethodAndPrompts": {
|
||||
"values": {
|
||||
"prompt": "=Write a concise summary of the following:\n\nCity: {{ $json.output.city }}\nBirthdate: {{ $json.output.birthdate }}\nEducational qualification: {{ $json.output[\"Educational qualification\"] }}\nJob History: {{ $json.output[\"Job History\"] }}\nSkills: {{ $json.output.Skills }}\n\nUse 100 words or less. Be concise and conversational.",
|
||||
"combineMapPrompt": "=Write a concise summary of the following:\n\nCity: {{ $json.output.city }}\nBirthdate: {{ $json.output.birthdate }}\nEducational qualification: {{ $json.output[\"Educational qualification\"] }}\nJob History: {{ $json.output[\"Job History\"] }}\nSkills: {{ $json.output.Skills }}\n\nUse 100 words or less. Be concise and conversational."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "9f9c5f16-1dc2-4928-aef8-284daeb6be51",
|
||||
"name": "Merge",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
660,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"options": {},
|
||||
"combineBy": "combineAll"
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "51bd14cc-2c54-4f72-b162-255f7e277aff",
|
||||
"name": "Profile Wanted",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1300,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "a3d049b0-5a70-4e7b-a6f2-81447da5282a",
|
||||
"name": "profile_wanted",
|
||||
"type": "string",
|
||||
"value": "We are a web agency and we are looking for a full-stack web developer who knows how to use PHP, Python and Javascript. He has experience in the sector and lives in Northern Italy."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "4a120e5d-b849-4a29-b7f3-12c653552367",
|
||||
"name": "Google Sheets",
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"position": [
|
||||
1960,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"columns": {
|
||||
"value": {
|
||||
"CITY": "={{ $('Merge').item.json.output.city }}",
|
||||
"DATA": "={{ $now.format('dd/LL/yyyy') }}",
|
||||
"NAME": "={{ $('On form submission').item.json.Nome }}",
|
||||
"VOTE": "={{ $json.output.vote }}",
|
||||
"EMAIL": "={{ $('On form submission').item.json.Email }}",
|
||||
"SKILLS": "={{ $('Merge').item.json.output.Skills }}",
|
||||
"TELEFONO": "={{ $('Merge').item.json.output.telephone }}",
|
||||
"SUMMARIZE": "={{ $('Summarization Chain').item.json.response.text }}",
|
||||
"EDUCATIONAL": "={{ $('Merge').item.json.output[\"Educational qualification\"] }}",
|
||||
"JOB HISTORY": "={{ $('Merge').item.json.output[\"Job History\"] }}",
|
||||
"DATA NASCITA": "={{ $('Merge').item.json.output.birthdate }}",
|
||||
"CONSIDERATION": "={{ $json.output.consideration }}"
|
||||
},
|
||||
"schema": [
|
||||
{
|
||||
"id": "DATA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "NAME",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "NAME",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "PHONE",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "PHONE",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CITY",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CITY",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EMAIL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EMAIL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "DATA NASCITA",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "DATA NASCITA",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "EDUCATIONAL",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "EDUCATIONAL",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "JOB HISTORY",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "JOB HISTORY",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "SKILLS",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "SKILLS",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "SUMMARIZE",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "SUMMARIZE",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "VOTE",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"removed": false,
|
||||
"required": false,
|
||||
"displayName": "VOTE",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CONSIDERATION",
|
||||
"type": "string",
|
||||
"display": true,
|
||||
"required": false,
|
||||
"displayName": "CONSIDERATION",
|
||||
"defaultMatch": false,
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"mappingMode": "defineBelow",
|
||||
"matchingColumns": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {},
|
||||
"operation": "append",
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gid=0",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ssz5RvN1Hr20Q31pnYnbjCLu1MGBvoLttBAjXunMRQE/edit#gid=0",
|
||||
"cachedResultName": "Foglio1"
|
||||
},
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1ssz5RvN1Hr20Q31pnYnbjCLu1MGBvoLttBAjXunMRQE",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ssz5RvN1Hr20Q31pnYnbjCLu1MGBvoLttBAjXunMRQE/edit?usp=drivesdk",
|
||||
"cachedResultName": "Ricerca WebDev"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "JYR6a64Qecd6t8Hb",
|
||||
"name": "Google Sheets account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.5
|
||||
},
|
||||
{
|
||||
"id": "a154d8a5-9f85-45bb-b082-f702c13c3507",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
1720,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"vote\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"consideration\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "037ac851-7885-4b78-ac75-dfa0ebb6003d",
|
||||
"name": "HR Expert",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"position": [
|
||||
1560,
|
||||
-220
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Profilo ricercato:\n{{ $json.profile_wanted }}\n\nCandidato:\n{{ $('Summarization Chain').item.json.response.text }}",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"message": "Sei un esperto HR e devi capire se il candidato è in linea con il profilo ricercato dall'azienda.\n\nDevi dare un voto da 1 a 10 dove 1 significa che il candidato non è in linea con quanto richiesto mentre 10 significa che è il candidato ideale perchè rispecchia in toto il profilo cercato.\n\nInoltre nel campo \"consideration\" motiva il perchè hai dato quel voto. "
|
||||
}
|
||||
]
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"typeVersion": 1.5
|
||||
},
|
||||
{
|
||||
"id": "ed5744c4-df06-4a01-a103-af4dd470d482",
|
||||
"name": "Personal Data",
|
||||
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
|
||||
"position": [
|
||||
160,
|
||||
-280
|
||||
],
|
||||
"parameters": {
|
||||
"text": "={{ $json.text }}",
|
||||
"options": {
|
||||
"systemPromptTemplate": "You are an expert extraction algorithm.\nOnly extract relevant information from the text.\nIf you do not know the value of an attribute asked to extract, you may omit the attribute's value."
|
||||
},
|
||||
"schemaType": "manual",
|
||||
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"telephone\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n \"city\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n \"birthdate\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "181c1249-b05c-4c35-8cac-5f9738cc1fe6",
|
||||
"name": "Upload CV",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
-160,
|
||||
-380
|
||||
],
|
||||
"parameters": {
|
||||
"name": "=CV-{{ $now.format('yyyyLLdd') }}-{{ $json.CV[0].filename }}",
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "My Drive"
|
||||
},
|
||||
"options": {},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "1tzeSpx4D3EAGXa3Wg-gqGbdaUk6LIZTV",
|
||||
"cachedResultUrl": "https://drive.google.com/drive/folders/1tzeSpx4D3EAGXa3Wg-gqGbdaUk6LIZTV",
|
||||
"cachedResultName": "CV"
|
||||
},
|
||||
"inputDataFieldName": "CV"
|
||||
},
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "HEy5EuZkgPZVEa9w",
|
||||
"name": "Google Drive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "d31ee1c4-e4be-41d9-8f36-e6fb797ced8e",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
920,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o-mini"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "CDX6QM4gLYanh0P4",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "0290cb72-a581-4aff-8b5d-1aa63e0a630f",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-560,
|
||||
-680
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 540,
|
||||
"content": "## HR Expert \nThis workflow automates the process of handling job applications by extracting relevant information from submitted CVs, analyzing the candidate's qualifications against a predefined profile, and storing the results in a Google Sheet"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "361084ff-9735-4a56-8988-be573391838b",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
-240,
|
||||
-460
|
||||
],
|
||||
"parameters": {
|
||||
"width": 300,
|
||||
"height": 420,
|
||||
"content": "The CV is uploaded to Google Drive and converted so that it can be processed\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4b6f004f-c77b-4522-99d4-737a68f6cfac",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
120,
|
||||
-380
|
||||
],
|
||||
"parameters": {
|
||||
"width": 360,
|
||||
"height": 440,
|
||||
"content": "The essential information for evaluating the candidate is collected in two different chains"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "73e11af9-65e3-4fcd-bb99-8a3f212ce9fb",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
860,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"width": 320,
|
||||
"height": 240,
|
||||
"content": "Summary of relevant information useful for classifying the candidate"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "606711d1-8e6d-44b3-91ac-c047d8a4054f",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1240,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"width": 220,
|
||||
"height": 240,
|
||||
"content": "Characteristics of the profile sought by the company that intends to hire the candidate"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "89c3210c-c599-41dc-97a3-bf8df2beb751",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1500,
|
||||
-300
|
||||
],
|
||||
"parameters": {
|
||||
"width": 360,
|
||||
"height": 240,
|
||||
"content": "Candidate evaluation with vote and considerations of the HR agent relating the profile sought with the candidate's skills"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "594728c0-b842-404d-8810-c6f7f3f4631d",
|
||||
"connections": {
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Summarization Chain",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Qualifications",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Summarization Chain",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "HR Expert",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Personal Data",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"HR Expert": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Google Sheets",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Upload CV": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Personal Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Profile Wanted": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "HR Expert",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Qualifications": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract from File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Qualifications",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Personal Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On form submission": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract from File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Upload CV",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Summarization Chain": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Profile Wanted",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "HR Expert",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user