text
stringlengths 759
15.2k
| messages
listlengths 3
3
| original_index
int64 0
147
| chunk_index
int64 0
2
| total_chunks
int64 1
3
| is_chunked
bool 2
classes | source_file
stringclasses 1
value | metadata
dict |
|---|---|---|---|---|---|---|---|
[INST] You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate descriptions of workflow functionality.
Generate the n8n workflow JSON based on the user's request.
Input Context:
The workflow aims to create a chatbot that answers questions using a Notion database as its knowledge source.
Analyze this workflow:
```json
{
"meta": {
"instanceId": "205b3bc06c96f2dc835b4f00e1cbf9a937a74eeb3b47c99d0c30b0586dbf85aa"
},
"nodes": [
{
"id": "d1d4291e-fa37-43d0-81e0-f0a594371426",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
680,
620
],
"parameters": {
"model": "gpt-4o",
"options": {
"timeout": 25000,
"temperature": 0.7
}
},
"credentials": {
"openAiApi": {
"id": "AzPPV759YPBxJj3o",
"name": "Max's DevRel OpenAI account"
}
},
"typeVersion": 1
},
{
"id": "68e6805b-9c19-4c9e-a300-8983f2b7c28a",
"name": "Search notion database",
"type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
"position": [
980,
620
],
"parameters": {
"url": "=https://api.notion.com/v1/databases/{{ $json.notionID }}/query",
"method": "POST",
"jsonBody": "{\n \"filter\": {\n \"or\": [\n {\n \"property\": \"question\",\n \"rich_text\": {\n \"contains\": \"{keyword}\"\n }\n },\n {\n \"property\": \"tags\",\n \"multi_select\": {\n \"contains\": \"{tag}\"\n }\n }\n ]\n },\n \"sorts\": [\n {\n \"property\": \"updated_at\",\n \"direction\": \"ascending\"\n }\n ]\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"toolDescription": "=Use this tool to search the \"\" Notion app database.\n\nIt is structured with question and answer format. \nYou can filter query result by:\n- By keyword\n- filter by tag.\n\nKeyword and Tag have an OR relationship not AND.\n\n",
"nodeCredentialType": "notionApi",
"placeholderDefinitions": {
"values": [
{
"name": "keyword",
"description": "Searches question of the record. Use one keyword at a time."
},
{
"name": "tag",
"description": "=Options: {{ $json.tagsOptions }}"
}
]
}
},
"credentials": {
"notionApi": {
"id": "gfNp6Jup8rsmFLRr",
"name": "max-bot"
}
},
"typeVersion": 1.1
},
{
"id": "c3164d38-a9fb-4ee3-b6bd-fccb4aa5a1a4",
"name": "Get database details",
"type": "n8n-nodes-base.notion",
"position": [
420,
380
],
"parameters": {
"simple": false,
"resource": "database",
"databaseId": {
"__rl": true,
"mode": "list",
"value": "7ea9697d-4875-441e-b262-1105337d232e",
"cachedResultUrl": "https://www.notion.so/7ea9697d4875441eb2621105337d232e",
"cachedResultName": "StarLens Company Knowledge Base"
}
},
"credentials": {
"notionApi": {
"id": "gfNp6Jup8rsmFLRr",
"name": "max-bot"
}
},
"typeVersion": 2.2
},
{
"id": "98300243-efcc-4427-88da-c1af8a91ddae",
"name": "Window Buffer Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
820,
620
],
"parameters": {
"contextWindowLength": 4
},
"typeVersion": 1.2
},
{
"id": "a8473f48-1343-4eb2-8e48-ec89377a2a00",
"name": "Search inside database record",
"type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
"notes": " ",
"position": [
1140,
620
],
"parameters": {
"url": "https://api.notion.com/v1/blocks/{page_id}/children",
"fields": "id, type, paragraph.text, heading_1.text, heading_2.text, heading_3.text, bulleted_list_item.text, numbered_list_item.text, to_do.text, children",
"dataField": "results",
"authentication": "predefinedCredentialType",
"fieldsToInclude": "selected",
"toolDescription": "=Use this tool to retrieve Notion page content using the page ID. \n\nIt is structured with question and answer format. \nYou can filter query result by:\n- By keyword\n- filter by tag.\n\nKeyword and Tag have an OR relationship not AND.\n\n",
"optimizeResponse": true,
"nodeCredentialType": "notionApi",
"placeholderDefinitions": {
"values": [
{
"name": "page_id",
"description": "Notion page id from 'Search notion database' tool results"
}
]
}
},
"credentials": {
"notionApi": {
"id": "gfNp6Jup8rsmFLRr",
"name": "max-bot"
}
},
"notesInFlow": true,
"typeVersion": 1.1
},
{
"id": "115c328e-84b0-43d2-8df7-8b3f74cbb2fb",
"name": "Format schema",
"type": "n8n-nodes-base.set",
"position": [
620,
380
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a8e58791-ba51-46a2-8645-386dd1a0ff6e",
"name": "sessionId",
"type": "string",
"value": "={{ $('When chat message received').item.json.sessionId }}"
},
{
"id": "434209de-39d5-43d8-a964-0fcb7396306c",
"name": "action",
"type": "string",
"value": "={{ $('When chat message received').item.json.action }}"
},
{
"id": "cad4c972-51a9-4e16-a627-b00eea77eb30",
"name": "chatInput",
"type": "string",
"value": "={{ $('When chat message received').item.json.chatInput }}"
},
{
"id": "8e88876c-2714-494d-bd5e-5e80c99f83e3",
"name": "notionID",
"type": "string",
"value": "={{ $('Get database details').item.json.id }}"
},
{
"id": "a88a15f6-317c-4d2e-9d64-26f5ccaf7a97",
"name": "databaseName",
"type": "string",
"value": "={{ $json.title[0].text.content }}"
},
{
"id": "7c3bf758-8ed3-469a-8695-6777f4af4fb9",
"name": "tagsOptions",
"type": "string",
"value": "={{ $json.properties.tags.multi_select.options.map(item => item.name).join(',') }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "3b82f4fe-6c0c-4e6e-a387-27de31fec758",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-340,
240
],
"parameters": {
"color": 6,
"width": 462.3561535890252,
"height": 95.12709218477178,
"content": "## Notion knowledge base assistant [v1]\nBuilt as part of the [30 Day AI Sprint](https://30dayaisprint.notion.site/) by [@maxtkacz](https://x.com/maxtkacz)\n"
},
"typeVersion": 1
},
{
"id": "31debc55-6608-4e64-be18-1bc0fc0fbf16",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-340,
1060
],
"parameters": {
"color": 7,
"width": 462.3561535890252,
"height": 172.4760209818479,
"content": "### FAQ\n- In `Get database details` if you see a `The resource you are requesting could not be found` error, you need to add your connection to the database (in the Notion app).\n- The `Get database details` pulls most recent `Tags` and informs AI Agent of them. However this step adds ~250-800ms per run. Watch detailed video to see how to remove this step. "
},
"typeVersion": 1
},
{
"id": "9f48e548-f032-477c-960d-9c99d61443df",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
820,
380
],
"parameters": {
"text": "={{ $json.chatInput }}",
"options": {
"systemMessage": "=# Role:\nYou are a helpful agent. Query the \"{{ $json.databaseName }}\" Notion database to find relevant records or summarize insights based on multiple records.\n\n# Behavior:\n\nBe clear, very concise, efficient, and accurate in responses. Do not hallucinate.\nIf the request is ambiguous, ask for clarification. Do not embellish, only use facts from the Notion records. Do not offer general advice.\n\n# Error Handling:\n\nIf no matching records are found, try alternative search criteria. Example 1: Laptop, then Computer, then Equipment. Example 2: meetings, then meeting.\nClearly explain any issues with queries (e.g., missing fields or unsupported filters).\n\n# Output:\n\nReturn concise, user-friendly results or summaries.\nFor large sets, show top results by default and offer more if needed. Output URLs in markdown format. \n\nWhen a record has the answer to user question, always output the URL to that page. Do not output links twice."
},
"promptType": "define"
},
"typeVersion": 1.6
},
{
"id": "f1274a12-128c-4549-a19b-6bfc3beccd89",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
220,
380
],
"webhookId": "b76d02c0-b406-4d21-b6bf-8ad2c623def3",
"parameters": {
"public": true,
"options": {
"title": "Notion Knowledge Base",
"subtitle": ""
},
"initialMessages": "=Happy {{ $today.weekdayLong }}!\nKnowledge source assistant at your service. How can I help you?"
},
"typeVersion": 1.1
},
{
"id": "2e25e4bc-7970-4d00-a757-ba1e418873aa",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-340,
360
],
"parameters": {
"color": 7,
"width": 463.90418399676537,
"height": 318.2958135288425,
"content": "### Template set up quickstart video 👇\n[](https://www.youtube.com/watch?v=ynLZwS2Nhnc)\n"
},
"typeVersion": 1
},
{
"id": "ba6fe953-fd5c-497f-ac2a-7afa04b7e6cc",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-340,
700
],
"parameters": {
"color": 7,
"width": 461.5634274842711,
"height": 332.14098134070576,
"content": "### Written set up steps\n1. Add a Notion credential to your n8n workspace (follow [this Notion guide](https://developers.notion.com/docs/create-a-notion-integration))\n2. [Duplicate Company knowledge base
|
[
{
"content": "You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate descriptions of workflow functionality.",
"role": "system"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.\n\nWorkflow JSON:\n```json\n{\n \"meta\": {\n \"instanceId\": \"205b3bc06c96f2dc835b4f00e1cbf9a937a74eeb3b47c99d0c30b0586dbf85aa\"\n },\n \"nodes\": [\n {\n \"id\": \"d1d4291e-fa37-43d0-81e0-f0a594371426\",\n \"name\": \"OpenAI Chat Model\",\n \"type\": \"@n8n/n8n-nodes-langchain.lmChatOpenAi\",\n \"position\": [\n 680,\n 620\n ],\n \"parameters\": {\n \"model\": \"gpt-4o\",\n \"options\": {\n \"timeout\": 25000,\n \"temperature\": 0.7\n }\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"AzPPV759YPBxJj3o\",\n \"name\": \"Max's DevRel OpenAI account\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"68e6805b-9c19-4c9e-a300-8983f2b7c28a\",\n \"name\": \"Search notion database\",\n \"type\": \"@n8n/n8n-nodes-langchain.toolHttpRequest\",\n \"position\": [\n 980,\n 620\n ],\n \"parameters\": {\n \"url\": \"=https://api.notion.com/v1/databases/{{ $json.notionID }}/query\",\n \"method\": \"POST\",\n \"jsonBody\": \"{\\n \\\"filter\\\": {\\n \\\"or\\\": [\\n {\\n \\\"property\\\": \\\"question\\\",\\n \\\"rich_text\\\": {\\n \\\"contains\\\": \\\"{keyword}\\\"\\n }\\n },\\n {\\n \\\"property\\\": \\\"tags\\\",\\n \\\"multi_select\\\": {\\n \\\"contains\\\": \\\"{tag}\\\"\\n }\\n }\\n ]\\n },\\n \\\"sorts\\\": [\\n {\\n \\\"property\\\": \\\"updated_at\\\",\\n \\\"direction\\\": \\\"ascending\\\"\\n }\\n ]\\n}\",\n \"sendBody\": true,\n \"specifyBody\": \"json\",\n \"authentication\": \"predefinedCredentialType\",\n \"toolDescription\": \"=Use this tool to search the \\\"\\\" Notion app database.\\n\\nIt is structured with question and answer format. \\nYou can filter query result by:\\n- By keyword\\n- filter by tag.\\n\\nKeyword and Tag have an OR relationship not AND.\\n\\n\",\n \"nodeCredentialType\": \"notionApi\",\n \"placeholderDefinitions\": {\n \"values\": [\n {\n \"name\": \"keyword\",\n \"description\": \"Searches question of the record. Use one keyword at a time.\"\n },\n {\n \"name\": \"tag\",\n \"description\": \"=Options: {{ $json.tagsOptions }}\"\n }\n ]\n }\n },\n \"credentials\": {\n \"notionApi\": {\n \"id\": \"gfNp6Jup8rsmFLRr\",\n \"name\": \"max-bot\"\n }\n },\n \"typeVersion\": 1.1\n },\n {\n \"id\": \"c3164d38-a9fb-4ee3-b6bd-fccb4aa5a1a4\",\n \"name\": \"Get database details\",\n \"type\": \"n8n-nodes-base.notion\",\n \"position\": [\n 420,\n 380\n ],\n \"parameters\": {\n \"simple\": false,\n \"resource\": \"database\",\n \"databaseId\": {\n \"__rl\": true,\n \"mode\": \"list\",\n \"value\": \"7ea9697d-4875-441e-b262-1105337d232e\",\n \"cachedResultUrl\": \"https://www.notion.so/7ea9697d4875441eb2621105337d232e\",\n \"cachedResultName\": \"StarLens Company Knowledge Base\"\n }\n },\n \"credentials\": {\n \"notionApi\": {\n \"id\": \"gfNp6Jup8rsmFLRr\",\n \"name\": \"max-bot\"\n }\n },\n \"typeVersion\": 2.2\n },\n {\n \"id\": \"98300243-efcc-4427-88da-c1af8a91ddae\",\n \"name\": \"Window Buffer Memory\",\n \"type\": \"@n8n/n8n-nodes-langchain.memoryBufferWindow\",\n \"position\": [\n 820,\n 620\n ],\n \"parameters\": {\n \"contextWindowLength\": 4\n },\n \"typeVersion\": 1.2\n },\n {\n \"id\": \"a8473f48-1343-4eb2-8e48-ec89377a2a00\",\n \"name\": \"Search inside database record\",\n \"type\": \"@n8n/n8n-nodes-langchain.toolHttpRequest\",\n \"notes\": \" \",\n \"position\": [\n 1140,\n 620\n ],\n \"parameters\": {\n \"url\": \"https://api.notion.com/v1/blocks/{page_id}/children\",\n \"fields\": \"id, type, paragraph.text, heading_1.text, heading_2.text, heading_3.text, bulleted_list_item.text, numbered_list_item.text, to_do.text, children\",\n \"dataField\": \"results\",\n \"authentication\": \"predefinedCredentialType\",\n \"fieldsToInclude\": \"selected\",\n \"toolDescription\": \"=Use this tool to retrieve Notion page content using the page ID. \\n\\nIt is structured with question and answer format. \\nYou can filter query result by:\\n- By keyword\\n- filter by tag.\\n\\nKeyword and Tag have an OR relationship not AND.\\n\\n\",\n \"optimizeResponse\": true,\n \"nodeCredentialType\": \"notionApi\",\n \"placeholderDefinitions\": {\n \"values\": [\n {\n \"name\": \"page_id\",\n \"description\": \"Notion page id from 'Search notion database' tool results\"\n }\n ]\n }\n },\n \"credentials\": {\n \"notionApi\": {\n \"id\": \"gfNp6Jup8rsmFLRr\",\n \"name\": \"max-bot\"\n }\n },\n \"notesInFlow\": true,\n \"typeVersion\": 1.1\n },\n {\n \"id\": \"115c328e-84b0-43d2-8df7-8b3f74cbb2fb\",\n \"name\": \"Format schema\",\n \"type\": \"n8n-nodes-base.set\",\n \"position\": [\n 620,\n 380\n ],\n \"parameters\": {\n \"options\": {},\n \"assignments\": {\n \"assignments\": [\n {\n \"id\": \"a8e58791-ba51-46a2-8645-386dd1a0ff6e\",\n \"name\": \"sessionId\",\n \"type\": \"string\",\n \"value\": \"={{ $('When chat message received').item.json.sessionId }}\"\n },\n {\n \"id\": \"434209de-39d5-43d8-a964-0fcb7396306c\",\n \"name\": \"action\",\n \"type\": \"string\",\n \"value\": \"={{ $('When chat message received').item.json.action }}\"\n },\n {\n \"id\": \"cad4c972-51a9-4e16-a627-b00eea77eb30\",\n \"name\": \"chatInput\",\n \"type\": \"string\",\n \"value\": \"={{ $('When chat message received').item.json.chatInput }}\"\n },\n {\n \"id\": \"8e88876c-2714-494d-bd5e-5e80c99f83e3\",\n \"name\": \"notionID\",\n \"type\": \"string\",\n \"value\": \"={{ $('Get database details').item.json.id }}\"\n },\n {\n \"id\": \"a88a15f6-317c-4d2e-9d64-26f5ccaf7a97\",\n \"name\": \"databaseName\",\n \"type\": \"string\",\n \"value\": \"={{ $json.title[0].text.content }}\"\n },\n {\n \"id\": \"7c3bf758-8ed3-469a-8695-6777f4af4fb9\",\n \"name\": \"tagsOptions\",\n \"type\": \"string\",\n \"value\": \"={{ $json.properties.tags.multi_select.options.map(item => item.name).join(',') }}\"\n }\n ]\n }\n },\n \"typeVersion\": 3.4\n },\n {\n \"id\": \"3b82f4fe-6c0c-4e6e-a387-27de31fec758\",\n \"name\": \"Sticky Note\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -340,\n 240\n ],\n \"parameters\": {\n \"color\": 6,\n \"width\": 462.3561535890252,\n \"height\": 95.12709218477178,\n \"content\": \"## Notion knowledge base assistant [v1]\\nBuilt as part of the [30 Day AI Sprint](https://30dayaisprint.notion.site/) by [@maxtkacz](https://x.com/maxtkacz)\\n\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"31debc55-6608-4e64-be18-1bc0fc0fbf16\",\n \"name\": \"Sticky Note1\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -340,\n 1060\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 462.3561535890252,\n \"height\": 172.4760209818479,\n \"content\": \"### FAQ\\n- In `Get database details` if you see a `The resource you are requesting could not be found` error, you need to add your connection to the database (in the Notion app).\\n- The `Get database details` pulls most recent `Tags` and informs AI Agent of them. However this step adds ~250-800ms per run. Watch detailed video to see how to remove this step. \"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"9f48e548-f032-477c-960d-9c99d61443df\",\n \"name\": \"AI Agent\",\n \"type\": \"@n8n/n8n-nodes-langchain.agent\",\n \"position\": [\n 820,\n 380\n ],\n \"parameters\": {\n \"text\": \"={{ $json.chatInput }}\",\n \"options\": {\n \"systemMessage\": \"=# Role:\\nYou are a helpful agent. Query the \\\"{{ $json.databaseName }}\\\" Notion database to find relevant records or summarize insights based on multiple records.\\n\\n# Behavior:\\n\\nBe clear, very concise, efficient, and accurate in responses. Do not hallucinate.\\nIf the request is ambiguous, ask for clarification. Do not embellish, only use facts from the Notion records. Do not offer general advice.\\n\\n# Error Handling:\\n\\nIf no matching records are found, try alternative search criteria. Example 1: Laptop, then Computer, then Equipment. Example 2: meetings, then meeting.\\nClearly explain any issues with queries (e.g., missing fields or unsupported filters).\\n\\n# Output:\\n\\nReturn concise, user-friendly results or summaries.\\nFor large sets, show top results by default and offer more if needed. Output URLs in markdown format. \\n\\nWhen a record has the answer to user question, always output the URL to that page. Do not output links twice.\"\n },\n \"promptType\": \"define\"\n },\n \"typeVersion\": 1.6\n },\n {\n \"id\": \"f1274a12-128c-4549-a19b-6bfc3beccd89\",\n \"name\": \"When chat message received\",\n \"type\": \"@n8n/n8n-nodes-langchain.chatTrigger\",\n \"position\": [\n 220,\n 380\n ],\n \"webhookId\": \"b76d02c0-b406-4d21-b6bf-8ad2c623def3\",\n \"parameters\": {\n \"public\": true,\n \"options\": {\n \"title\": \"Notion Knowledge Base\",\n \"subtitle\": \"\"\n },\n \"initialMessages\": \"=Happy {{ $today.weekdayLong }}!\\nKnowledge source assistant at your service. How can I help you?\"\n },\n \"typeVersion\": 1.1\n },\n {\n \"id\": \"2e25e4bc-7970-4d00-a757-ba1e418873aa\",\n \"name\": \"Sticky Note2\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -340,\n 360\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 463.90418399676537,\n \"height\": 318.2958135288425,\n \"content\": \"### Template set up quickstart video 👇\\n[](https://www.youtube.com/watch?v=ynLZwS2Nhnc)\\n\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"ba6fe953-fd5c-497f-ac2a-7afa04b7e6cc\",\n \"name\": \"Sticky Note3\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -340,\n 700\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 461.5634274842711,\n \"height\": 332.14098134070576,\n \"content\": \"### Written set up steps\\n1. Add a Notion credential to your n8n workspace (follow [this Notion guide](https://developers.notion.com/docs/create-a-notion-integration))\\n2. [Duplicate Company knowledge base Notion template](https://www.notion.so/templates/knowledge-base-ai-assistant-with-n8n) to your Notion workspace, then make sure to share the new knowledge base with connection you created in Step 1. \\n3. Add Notion cred to `Get database details`:`Credential to connect with` parameter, then to `Search notion database`:`Notion API` parameter (same for `Search inside database record`)\\n4. Add OpenAI credential to `Open AI Chat Model` node (tested and working with Anthropic Claude 3.5 too)\\n5. In `Get database details`, select the db you created from Step 2 in `Database` dropdown.\\n6. Click `Chat` button to test the workflow. Then Activate it and copy the `Chat URL` from `When chat message received`.\"\n },\n \"typeVersion\": 1\n }\n ],\n \"pinData\": {},\n \"connections\": {\n \"Format schema\": {\n \"main\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"OpenAI Chat Model\": {\n \"ai_languageModel\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_languageModel\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get database details\": {\n \"main\": [\n [\n {\n \"node\": \"Format schema\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Window Buffer Memory\": {\n \"ai_memory\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_memory\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Search notion database\": {\n \"ai_tool\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_tool\",\n \"index\": 0\n }\n ]\n ]\n },\n \"When chat message received\": {\n \"main\": [\n [\n {\n \"node\": \"Get database details\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Search inside database record\": {\n \"ai_tool\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_tool\",\n \"index\": 0\n }\n ]\n ]\n }\n }\n}\n```",
"role": "user"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.",
"role": "assistant"
}
] | 0
| 0
| 2
| true
|
combined_workflows.json
|
{
"input": "The workflow aims to create a chatbot that answers questions using a Notion database as its knowledge source.",
"instruction": "Generate the n8n workflow JSON based on the user's request.",
"is_truncated": false,
"is_workflow": true,
"model_specific": {
"chat_template": true,
"format_version": "1.0",
"model": "mistral"
},
"model_used": "models/gemini-2.0-flash-lite",
"original_size": 9824,
"processed_size": 9824,
"processed_timestamp": "2025-04-09T03:08:36.222137",
"timestamp": "2025-04-09T02:34:24.722123",
"token_count": 4095,
"tokens": 979,
"workflow_chunk_info": {
"is_truncated": false,
"original_size": 9824,
"processed_size": 9824,
"workflow_hash": "b0fe8adadb1e54761be2b06f9ce095d9"
},
"workflow_hash": "b0fe8adadb1e54761be2b06f9ce095d9"
}
|
97f-ac2a-7afa04b7e6cc",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-340,
700
],
"parameters": {
"color": 7,
"width": 461.5634274842711,
"height": 332.14098134070576,
"content": "### Written set up steps\n1. Add a Notion credential to your n8n workspace (follow [this Notion guide](https://developers.notion.com/docs/create-a-notion-integration))\n2. [Duplicate Company knowledge base Notion template](https://www.notion.so/templates/knowledge-base-ai-assistant-with-n8n) to your Notion workspace, then make sure to share the new knowledge base with connection you created in Step 1. \n3. Add Notion cred to `Get database details`:`Credential to connect with` parameter, then to `Search notion database`:`Notion API` parameter (same for `Search inside database record`)\n4. Add OpenAI credential to `Open AI Chat Model` node (tested and working with Anthropic Claude 3.5 too)\n5. In `Get database details`, select the db you created from Step 2 in `Database` dropdown.\n6. Click `Chat` button to test the workflow. Then Activate it and copy the `Chat URL` from `When chat message received`."
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Format schema": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get database details": {
"main": [
[
{
"node": "Format schema",
"type": "main",
"index": 0
}
]
]
},
"Window Buffer Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Search notion database": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Get database details",
"type": "main",
"index": 0
}
]
]
},
"Search inside database record": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}
``` [/INST]Here's the analysis of the workflow functionality:
Generate the n8n workflow JSON based on the user's request.
|
[
{
"content": "You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate descriptions of workflow functionality.",
"role": "system"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.\n\nWorkflow JSON:\n```json\n{\n \"meta\": {\n \"instanceId\": \"205b3bc06c96f2dc835b4f00e1cbf9a937a74eeb3b47c99d0c30b0586dbf85aa\"\n },\n \"nodes\": [\n {\n \"id\": \"d1d4291e-fa37-43d0-81e0-f0a594371426\",\n \"name\": \"OpenAI Chat Model\",\n \"type\": \"@n8n/n8n-nodes-langchain.lmChatOpenAi\",\n \"position\": [\n 680,\n 620\n ],\n \"parameters\": {\n \"model\": \"gpt-4o\",\n \"options\": {\n \"timeout\": 25000,\n \"temperature\": 0.7\n }\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"AzPPV759YPBxJj3o\",\n \"name\": \"Max's DevRel OpenAI account\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"68e6805b-9c19-4c9e-a300-8983f2b7c28a\",\n \"name\": \"Search notion database\",\n \"type\": \"@n8n/n8n-nodes-langchain.toolHttpRequest\",\n \"position\": [\n 980,\n 620\n ],\n \"parameters\": {\n \"url\": \"=https://api.notion.com/v1/databases/{{ $json.notionID }}/query\",\n \"method\": \"POST\",\n \"jsonBody\": \"{\\n \\\"filter\\\": {\\n \\\"or\\\": [\\n {\\n \\\"property\\\": \\\"question\\\",\\n \\\"rich_text\\\": {\\n \\\"contains\\\": \\\"{keyword}\\\"\\n }\\n },\\n {\\n \\\"property\\\": \\\"tags\\\",\\n \\\"multi_select\\\": {\\n \\\"contains\\\": \\\"{tag}\\\"\\n }\\n }\\n ]\\n },\\n \\\"sorts\\\": [\\n {\\n \\\"property\\\": \\\"updated_at\\\",\\n \\\"direction\\\": \\\"ascending\\\"\\n }\\n ]\\n}\",\n \"sendBody\": true,\n \"specifyBody\": \"json\",\n \"authentication\": \"predefinedCredentialType\",\n \"toolDescription\": \"=Use this tool to search the \\\"\\\" Notion app database.\\n\\nIt is structured with question and answer format. \\nYou can filter query result by:\\n- By keyword\\n- filter by tag.\\n\\nKeyword and Tag have an OR relationship not AND.\\n\\n\",\n \"nodeCredentialType\": \"notionApi\",\n \"placeholderDefinitions\": {\n \"values\": [\n {\n \"name\": \"keyword\",\n \"description\": \"Searches question of the record. Use one keyword at a time.\"\n },\n {\n \"name\": \"tag\",\n \"description\": \"=Options: {{ $json.tagsOptions }}\"\n }\n ]\n }\n },\n \"credentials\": {\n \"notionApi\": {\n \"id\": \"gfNp6Jup8rsmFLRr\",\n \"name\": \"max-bot\"\n }\n },\n \"typeVersion\": 1.1\n },\n {\n \"id\": \"c3164d38-a9fb-4ee3-b6bd-fccb4aa5a1a4\",\n \"name\": \"Get database details\",\n \"type\": \"n8n-nodes-base.notion\",\n \"position\": [\n 420,\n 380\n ],\n \"parameters\": {\n \"simple\": false,\n \"resource\": \"database\",\n \"databaseId\": {\n \"__rl\": true,\n \"mode\": \"list\",\n \"value\": \"7ea9697d-4875-441e-b262-1105337d232e\",\n \"cachedResultUrl\": \"https://www.notion.so/7ea9697d4875441eb2621105337d232e\",\n \"cachedResultName\": \"StarLens Company Knowledge Base\"\n }\n },\n \"credentials\": {\n \"notionApi\": {\n \"id\": \"gfNp6Jup8rsmFLRr\",\n \"name\": \"max-bot\"\n }\n },\n \"typeVersion\": 2.2\n },\n {\n \"id\": \"98300243-efcc-4427-88da-c1af8a91ddae\",\n \"name\": \"Window Buffer Memory\",\n \"type\": \"@n8n/n8n-nodes-langchain.memoryBufferWindow\",\n \"position\": [\n 820,\n 620\n ],\n \"parameters\": {\n \"contextWindowLength\": 4\n },\n \"typeVersion\": 1.2\n },\n {\n \"id\": \"a8473f48-1343-4eb2-8e48-ec89377a2a00\",\n \"name\": \"Search inside database record\",\n \"type\": \"@n8n/n8n-nodes-langchain.toolHttpRequest\",\n \"notes\": \" \",\n \"position\": [\n 1140,\n 620\n ],\n \"parameters\": {\n \"url\": \"https://api.notion.com/v1/blocks/{page_id}/children\",\n \"fields\": \"id, type, paragraph.text, heading_1.text, heading_2.text, heading_3.text, bulleted_list_item.text, numbered_list_item.text, to_do.text, children\",\n \"dataField\": \"results\",\n \"authentication\": \"predefinedCredentialType\",\n \"fieldsToInclude\": \"selected\",\n \"toolDescription\": \"=Use this tool to retrieve Notion page content using the page ID. \\n\\nIt is structured with question and answer format. \\nYou can filter query result by:\\n- By keyword\\n- filter by tag.\\n\\nKeyword and Tag have an OR relationship not AND.\\n\\n\",\n \"optimizeResponse\": true,\n \"nodeCredentialType\": \"notionApi\",\n \"placeholderDefinitions\": {\n \"values\": [\n {\n \"name\": \"page_id\",\n \"description\": \"Notion page id from 'Search notion database' tool results\"\n }\n ]\n }\n },\n \"credentials\": {\n \"notionApi\": {\n \"id\": \"gfNp6Jup8rsmFLRr\",\n \"name\": \"max-bot\"\n }\n },\n \"notesInFlow\": true,\n \"typeVersion\": 1.1\n },\n {\n \"id\": \"115c328e-84b0-43d2-8df7-8b3f74cbb2fb\",\n \"name\": \"Format schema\",\n \"type\": \"n8n-nodes-base.set\",\n \"position\": [\n 620,\n 380\n ],\n \"parameters\": {\n \"options\": {},\n \"assignments\": {\n \"assignments\": [\n {\n \"id\": \"a8e58791-ba51-46a2-8645-386dd1a0ff6e\",\n \"name\": \"sessionId\",\n \"type\": \"string\",\n \"value\": \"={{ $('When chat message received').item.json.sessionId }}\"\n },\n {\n \"id\": \"434209de-39d5-43d8-a964-0fcb7396306c\",\n \"name\": \"action\",\n \"type\": \"string\",\n \"value\": \"={{ $('When chat message received').item.json.action }}\"\n },\n {\n \"id\": \"cad4c972-51a9-4e16-a627-b00eea77eb30\",\n \"name\": \"chatInput\",\n \"type\": \"string\",\n \"value\": \"={{ $('When chat message received').item.json.chatInput }}\"\n },\n {\n \"id\": \"8e88876c-2714-494d-bd5e-5e80c99f83e3\",\n \"name\": \"notionID\",\n \"type\": \"string\",\n \"value\": \"={{ $('Get database details').item.json.id }}\"\n },\n {\n \"id\": \"a88a15f6-317c-4d2e-9d64-26f5ccaf7a97\",\n \"name\": \"databaseName\",\n \"type\": \"string\",\n \"value\": \"={{ $json.title[0].text.content }}\"\n },\n {\n \"id\": \"7c3bf758-8ed3-469a-8695-6777f4af4fb9\",\n \"name\": \"tagsOptions\",\n \"type\": \"string\",\n \"value\": \"={{ $json.properties.tags.multi_select.options.map(item => item.name).join(',') }}\"\n }\n ]\n }\n },\n \"typeVersion\": 3.4\n },\n {\n \"id\": \"3b82f4fe-6c0c-4e6e-a387-27de31fec758\",\n \"name\": \"Sticky Note\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -340,\n 240\n ],\n \"parameters\": {\n \"color\": 6,\n \"width\": 462.3561535890252,\n \"height\": 95.12709218477178,\n \"content\": \"## Notion knowledge base assistant [v1]\\nBuilt as part of the [30 Day AI Sprint](https://30dayaisprint.notion.site/) by [@maxtkacz](https://x.com/maxtkacz)\\n\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"31debc55-6608-4e64-be18-1bc0fc0fbf16\",\n \"name\": \"Sticky Note1\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -340,\n 1060\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 462.3561535890252,\n \"height\": 172.4760209818479,\n \"content\": \"### FAQ\\n- In `Get database details` if you see a `The resource you are requesting could not be found` error, you need to add your connection to the database (in the Notion app).\\n- The `Get database details` pulls most recent `Tags` and informs AI Agent of them. However this step adds ~250-800ms per run. Watch detailed video to see how to remove this step. \"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"9f48e548-f032-477c-960d-9c99d61443df\",\n \"name\": \"AI Agent\",\n \"type\": \"@n8n/n8n-nodes-langchain.agent\",\n \"position\": [\n 820,\n 380\n ],\n \"parameters\": {\n \"text\": \"={{ $json.chatInput }}\",\n \"options\": {\n \"systemMessage\": \"=# Role:\\nYou are a helpful agent. Query the \\\"{{ $json.databaseName }}\\\" Notion database to find relevant records or summarize insights based on multiple records.\\n\\n# Behavior:\\n\\nBe clear, very concise, efficient, and accurate in responses. Do not hallucinate.\\nIf the request is ambiguous, ask for clarification. Do not embellish, only use facts from the Notion records. Do not offer general advice.\\n\\n# Error Handling:\\n\\nIf no matching records are found, try alternative search criteria. Example 1: Laptop, then Computer, then Equipment. Example 2: meetings, then meeting.\\nClearly explain any issues with queries (e.g., missing fields or unsupported filters).\\n\\n# Output:\\n\\nReturn concise, user-friendly results or summaries.\\nFor large sets, show top results by default and offer more if needed. Output URLs in markdown format. \\n\\nWhen a record has the answer to user question, always output the URL to that page. Do not output links twice.\"\n },\n \"promptType\": \"define\"\n },\n \"typeVersion\": 1.6\n },\n {\n \"id\": \"f1274a12-128c-4549-a19b-6bfc3beccd89\",\n \"name\": \"When chat message received\",\n \"type\": \"@n8n/n8n-nodes-langchain.chatTrigger\",\n \"position\": [\n 220,\n 380\n ],\n \"webhookId\": \"b76d02c0-b406-4d21-b6bf-8ad2c623def3\",\n \"parameters\": {\n \"public\": true,\n \"options\": {\n \"title\": \"Notion Knowledge Base\",\n \"subtitle\": \"\"\n },\n \"initialMessages\": \"=Happy {{ $today.weekdayLong }}!\\nKnowledge source assistant at your service. How can I help you?\"\n },\n \"typeVersion\": 1.1\n },\n {\n \"id\": \"2e25e4bc-7970-4d00-a757-ba1e418873aa\",\n \"name\": \"Sticky Note2\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -340,\n 360\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 463.90418399676537,\n \"height\": 318.2958135288425,\n \"content\": \"### Template set up quickstart video 👇\\n[](https://www.youtube.com/watch?v=ynLZwS2Nhnc)\\n\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"ba6fe953-fd5c-497f-ac2a-7afa04b7e6cc\",\n \"name\": \"Sticky Note3\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -340,\n 700\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 461.5634274842711,\n \"height\": 332.14098134070576,\n \"content\": \"### Written set up steps\\n1. Add a Notion credential to your n8n workspace (follow [this Notion guide](https://developers.notion.com/docs/create-a-notion-integration))\\n2. [Duplicate Company knowledge base Notion template](https://www.notion.so/templates/knowledge-base-ai-assistant-with-n8n) to your Notion workspace, then make sure to share the new knowledge base with connection you created in Step 1. \\n3. Add Notion cred to `Get database details`:`Credential to connect with` parameter, then to `Search notion database`:`Notion API` parameter (same for `Search inside database record`)\\n4. Add OpenAI credential to `Open AI Chat Model` node (tested and working with Anthropic Claude 3.5 too)\\n5. In `Get database details`, select the db you created from Step 2 in `Database` dropdown.\\n6. Click `Chat` button to test the workflow. Then Activate it and copy the `Chat URL` from `When chat message received`.\"\n },\n \"typeVersion\": 1\n }\n ],\n \"pinData\": {},\n \"connections\": {\n \"Format schema\": {\n \"main\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"OpenAI Chat Model\": {\n \"ai_languageModel\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_languageModel\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get database details\": {\n \"main\": [\n [\n {\n \"node\": \"Format schema\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Window Buffer Memory\": {\n \"ai_memory\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_memory\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Search notion database\": {\n \"ai_tool\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_tool\",\n \"index\": 0\n }\n ]\n ]\n },\n \"When chat message received\": {\n \"main\": [\n [\n {\n \"node\": \"Get database details\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Search inside database record\": {\n \"ai_tool\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_tool\",\n \"index\": 0\n }\n ]\n ]\n }\n }\n}\n```",
"role": "user"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.",
"role": "assistant"
}
] | 0
| 1
| 2
| true
|
combined_workflows.json
|
{
"input": "The workflow aims to create a chatbot that answers questions using a Notion database as its knowledge source.",
"instruction": "Generate the n8n workflow JSON based on the user's request.",
"is_truncated": false,
"is_workflow": true,
"model_specific": {
"chat_template": true,
"format_version": "1.0",
"model": "mistral"
},
"model_used": "models/gemini-2.0-flash-lite",
"original_size": 9824,
"processed_size": 9824,
"processed_timestamp": "2025-04-09T03:08:36.245360",
"timestamp": "2025-04-09T02:34:24.722123",
"token_count": 876,
"tokens": 979,
"workflow_chunk_info": {
"is_truncated": false,
"original_size": 9824,
"processed_size": 9824,
"workflow_hash": "b0fe8adadb1e54761be2b06f9ce095d9"
},
"workflow_hash": "b0fe8adadb1e54761be2b06f9ce095d9"
}
|
<s>[INST] You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate descriptions of workflow functionality.
Generate the n8n workflow JSON based on the user's request.
Input Context:
To create a chatbot that allows users to interact with a PostgreSQL database using natural language.
Analyze this workflow:
```json
{
"id": "eOUewYsEzJmQixI6",
"meta": {
"instanceId": "77c4feba8f41570ef06dc76ece9a6ded0f0d44f7f1477a64c2d71a8508c11faa",
"templateCredsSetupCompleted": true
},
"name": "Chat with Postgresql Database",
"tags": [],
"nodes": [
{
"id": "6501a54f-a68c-452d-b353-d7e871ca3780",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-300,
-80
],
"webhookId": "cf1de04f-3e38-426c-89f0-3bdb110a5dcf",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "cd32221b-2a36-408d-b57e-8115fcd810c9",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
0,
-80
],
"parameters": {
"agent": "openAiFunctionsAgent",
"options": {
"systemMessage": "You are DB assistant. You need to run queries in DB aligned with user requests.\n\nRun custom SQL query to aggregate data and response to user. Make sure every table has schema prefix to it in sql query which you can get from `Get DB Schema and Tables List` tool.\n\nFetch all data to analyse it for response if needed.\n\n## Tools\n\n- Execute SQL query - Executes any sql query generated by AI\n- Get DB Schema and Tables List - Lists all the tables in database with its schema name\n- Get Table Definition - Gets the table definition from db using table name and schema name"
}
},
"typeVersion": 1.7
},
{
"id": "8accbeeb-7eaf-4e9e-aabc-de8ab3a0459b",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-60,
160
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "48uG61Ilo8jndw3r",
"name": "Your OpenAI Account Credentials"
}
},
"typeVersion": 1.2
},
{
"id": "11f2013f-a080-4c9e-8773-c90492e2c628",
"name": "Get Table Definition",
"type": "n8n-nodes-base.postgresTool",
"position": [
780,
140
],
"parameters": {
"query": "select\n c.column_name,\n c.data_type,\n c.is_nullable,\n c.column_default,\n tc.constraint_type,\n ccu.table_name AS referenced_table,\n ccu.column_name AS referenced_column\nfrom\n information_schema.columns c\nLEFT join\n information_schema.key_column_usage kcu\n ON c.table_name = kcu.table_name\n AND c.column_name = kcu.column_name\nLEFT join\n information_schema.table_constraints tc\n ON kcu.constraint_name = tc.constraint_name\n AND tc.constraint_type = 'FOREIGN KEY'\nLEFT join\n information_schema.constraint_column_usage ccu\n ON tc.constraint_name = ccu.constraint_name\nwhere\n c.table_name = '{{ $fromAI(\"table_name\") }}'\n AND c.table_schema = '{{ $fromAI(\"schema_name\") }}'\norder by\n c.ordinal_position",
"options": {},
"operation": "executeQuery",
"descriptionType": "manual",
"toolDescription": "Get table definition to find all columns and types"
},
"credentials": {
"postgres": {
"id": "nGI61D0TEEZz18rr",
"name": "Your Postgresql Database Credentials"
}
},
"typeVersion": 2.5
},
{
"id": "760bc9bc-0057-4088-b3f0-3ee37b3519df",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-300,
-240
],
"parameters": {
"color": 5,
"width": 560,
"height": 120,
"content": "### 👨🎤 Setup\n1. Add your **postgresql** and **OpenAI** credentials.\n2. Click **Chat** button and start asking questions to your database.\n3. Activate the workflow and you can make the chat publicly available."
},
"typeVersion": 1
},
{
"id": "0df33341-c859-4a54-b6d9-a99670e8d76d",
"name": "Chat History",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
120,
160
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "4938b22e-f187-4ca0-b9f1-60835e823799",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
360,
300
],
"parameters": {
"color": 7,
"width": 562,
"height": 156,
"content": "🛠️ Tools Used:\n1. Execute SQL Query: Used to execute any query generated by the agent.\n2. Get DB Schema and Tables List: It returns the list of all the tables with its schema name.\n3. Get Table Definition: It returns table details like column names, foreign keys and more of a particular table in a schema."
},
"typeVersion": 1
},
{
"id": "39780c78-4fbc-403e-a220-aa6a4b06df8c",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-100,
300
],
"parameters": {
"color": 7,
"width": 162,
"height": 99,
"content": "👆 You can exchange this with any other chat model of your choice."
},
"typeVersion": 1
},
{
"id": "28a5692c-5003-46cb-9a09-b7867734f446",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
100,
300
],
"parameters": {
"color": 7,
"width": 162,
"height": 159,
"content": "👆 You can change how many number of messages to keep using `Context Window Length` option. It's 5 by default."
},
"typeVersion": 1
},
{
"id": "c18ced71-6330-4ba0-9c52-1bb5852b3039",
"name": "Execute SQL Query",
"type": "n8n-nodes-base.postgresTool",
"position": [
380,
140
],
"parameters": {
"query": "{{ $fromAI(\"sql_query\", \"SQL Query\") }}",
"options": {},
"operation": "executeQuery",
"descriptionType": "manual",
"toolDescription": "Get all the data from Postgres, make sure you append the tables with correct schema. Every table is associated with some schema in the database."
},
"credentials": {
"postgres": {
"id": "nGI61D0TEEZz18rr",
"name": "Your Postgresql Database Credentials"
}
},
"typeVersion": 2.5
},
{
"id": "557623c6-e499-48a6-a066-744f64f8b6f3",
"name": "Get DB Schema and Tables List",
"type": "n8n-nodes-base.postgresTool",
"position": [
580,
140
],
"parameters": {
"query": "SELECT \n table_schema,\n table_name\nFROM information_schema.tables\nWHERE table_type = 'BASE TABLE'\n AND table_schema NOT IN ('pg_catalog', 'information_schema')\nORDER BY table_schema, table_name;",
"options": {},
"operation": "executeQuery",
"descriptionType": "manual",
"toolDescription": "Get list of all tables with their schema in the database"
},
"credentials": {
"postgres": {
"id": "nGI61D0TEEZz18rr",
"name": "Your Postgresql Database Credentials"
}
},
"typeVersion": 2.5
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "10c7c74e-b383-4ac7-8cb2-c9a15a2818fe",
"connections": {
"Chat History": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Execute SQL Query": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get Table Definition": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Get DB Schema and Tables List": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}
``` [/INST]Here's the analysis of the workflow functionality:
Generate the n8n workflow JSON based on the user's request.</s>
|
[
{
"content": "You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate descriptions of workflow functionality.",
"role": "system"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.\n\nWorkflow JSON:\n```json\n{\n \"id\": \"eOUewYsEzJmQixI6\",\n \"meta\": {\n \"instanceId\": \"77c4feba8f41570ef06dc76ece9a6ded0f0d44f7f1477a64c2d71a8508c11faa\",\n \"templateCredsSetupCompleted\": true\n },\n \"name\": \"Chat with Postgresql Database\",\n \"tags\": [],\n \"nodes\": [\n {\n \"id\": \"6501a54f-a68c-452d-b353-d7e871ca3780\",\n \"name\": \"When chat message received\",\n \"type\": \"@n8n/n8n-nodes-langchain.chatTrigger\",\n \"position\": [\n -300,\n -80\n ],\n \"webhookId\": \"cf1de04f-3e38-426c-89f0-3bdb110a5dcf\",\n \"parameters\": {\n \"options\": {}\n },\n \"typeVersion\": 1.1\n },\n {\n \"id\": \"cd32221b-2a36-408d-b57e-8115fcd810c9\",\n \"name\": \"AI Agent\",\n \"type\": \"@n8n/n8n-nodes-langchain.agent\",\n \"position\": [\n 0,\n -80\n ],\n \"parameters\": {\n \"agent\": \"openAiFunctionsAgent\",\n \"options\": {\n \"systemMessage\": \"You are DB assistant. You need to run queries in DB aligned with user requests.\\n\\nRun custom SQL query to aggregate data and response to user. Make sure every table has schema prefix to it in sql query which you can get from `Get DB Schema and Tables List` tool.\\n\\nFetch all data to analyse it for response if needed.\\n\\n## Tools\\n\\n- Execute SQL query - Executes any sql query generated by AI\\n- Get DB Schema and Tables List - Lists all the tables in database with its schema name\\n- Get Table Definition - Gets the table definition from db using table name and schema name\"\n }\n },\n \"typeVersion\": 1.7\n },\n {\n \"id\": \"8accbeeb-7eaf-4e9e-aabc-de8ab3a0459b\",\n \"name\": \"OpenAI Chat Model\",\n \"type\": \"@n8n/n8n-nodes-langchain.lmChatOpenAi\",\n \"position\": [\n -60,\n 160\n ],\n \"parameters\": {\n \"model\": {\n \"__rl\": true,\n \"mode\": \"list\",\n \"value\": \"gpt-4o-mini\"\n },\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"48uG61Ilo8jndw3r\",\n \"name\": \"Your OpenAI Account Credentials\"\n }\n },\n \"typeVersion\": 1.2\n },\n {\n \"id\": \"11f2013f-a080-4c9e-8773-c90492e2c628\",\n \"name\": \"Get Table Definition\",\n \"type\": \"n8n-nodes-base.postgresTool\",\n \"position\": [\n 780,\n 140\n ],\n \"parameters\": {\n \"query\": \"select\\n c.column_name,\\n c.data_type,\\n c.is_nullable,\\n c.column_default,\\n tc.constraint_type,\\n ccu.table_name AS referenced_table,\\n ccu.column_name AS referenced_column\\nfrom\\n information_schema.columns c\\nLEFT join\\n information_schema.key_column_usage kcu\\n ON c.table_name = kcu.table_name\\n AND c.column_name = kcu.column_name\\nLEFT join\\n information_schema.table_constraints tc\\n ON kcu.constraint_name = tc.constraint_name\\n AND tc.constraint_type = 'FOREIGN KEY'\\nLEFT join\\n information_schema.constraint_column_usage ccu\\n ON tc.constraint_name = ccu.constraint_name\\nwhere\\n c.table_name = '{{ $fromAI(\\\"table_name\\\") }}'\\n AND c.table_schema = '{{ $fromAI(\\\"schema_name\\\") }}'\\norder by\\n c.ordinal_position\",\n \"options\": {},\n \"operation\": \"executeQuery\",\n \"descriptionType\": \"manual\",\n \"toolDescription\": \"Get table definition to find all columns and types\"\n },\n \"credentials\": {\n \"postgres\": {\n \"id\": \"nGI61D0TEEZz18rr\",\n \"name\": \"Your Postgresql Database Credentials\"\n }\n },\n \"typeVersion\": 2.5\n },\n {\n \"id\": \"760bc9bc-0057-4088-b3f0-3ee37b3519df\",\n \"name\": \"Sticky Note\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -300,\n -240\n ],\n \"parameters\": {\n \"color\": 5,\n \"width\": 560,\n \"height\": 120,\n \"content\": \"### 👨🎤 Setup\\n1. Add your **postgresql** and **OpenAI** credentials.\\n2. Click **Chat** button and start asking questions to your database.\\n3. Activate the workflow and you can make the chat publicly available.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"0df33341-c859-4a54-b6d9-a99670e8d76d\",\n \"name\": \"Chat History\",\n \"type\": \"@n8n/n8n-nodes-langchain.memoryBufferWindow\",\n \"position\": [\n 120,\n 160\n ],\n \"parameters\": {},\n \"typeVersion\": 1.3\n },\n {\n \"id\": \"4938b22e-f187-4ca0-b9f1-60835e823799\",\n \"name\": \"Sticky Note3\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 360,\n 300\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 562,\n \"height\": 156,\n \"content\": \"🛠️ Tools Used:\\n1. Execute SQL Query: Used to execute any query generated by the agent.\\n2. Get DB Schema and Tables List: It returns the list of all the tables with its schema name.\\n3. Get Table Definition: It returns table details like column names, foreign keys and more of a particular table in a schema.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"39780c78-4fbc-403e-a220-aa6a4b06df8c\",\n \"name\": \"Sticky Note1\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -100,\n 300\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 162,\n \"height\": 99,\n \"content\": \"👆 You can exchange this with any other chat model of your choice.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"28a5692c-5003-46cb-9a09-b7867734f446\",\n \"name\": \"Sticky Note2\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 100,\n 300\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 162,\n \"height\": 159,\n \"content\": \"👆 You can change how many number of messages to keep using `Context Window Length` option. It's 5 by default.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"c18ced71-6330-4ba0-9c52-1bb5852b3039\",\n \"name\": \"Execute SQL Query\",\n \"type\": \"n8n-nodes-base.postgresTool\",\n \"position\": [\n 380,\n 140\n ],\n \"parameters\": {\n \"query\": \"{{ $fromAI(\\\"sql_query\\\", \\\"SQL Query\\\") }}\",\n \"options\": {},\n \"operation\": \"executeQuery\",\n \"descriptionType\": \"manual\",\n \"toolDescription\": \"Get all the data from Postgres, make sure you append the tables with correct schema. Every table is associated with some schema in the database.\"\n },\n \"credentials\": {\n \"postgres\": {\n \"id\": \"nGI61D0TEEZz18rr\",\n \"name\": \"Your Postgresql Database Credentials\"\n }\n },\n \"typeVersion\": 2.5\n },\n {\n \"id\": \"557623c6-e499-48a6-a066-744f64f8b6f3\",\n \"name\": \"Get DB Schema and Tables List\",\n \"type\": \"n8n-nodes-base.postgresTool\",\n \"position\": [\n 580,\n 140\n ],\n \"parameters\": {\n \"query\": \"SELECT \\n table_schema,\\n table_name\\nFROM information_schema.tables\\nWHERE table_type = 'BASE TABLE'\\n AND table_schema NOT IN ('pg_catalog', 'information_schema')\\nORDER BY table_schema, table_name;\",\n \"options\": {},\n \"operation\": \"executeQuery\",\n \"descriptionType\": \"manual\",\n \"toolDescription\": \"Get list of all tables with their schema in the database\"\n },\n \"credentials\": {\n \"postgres\": {\n \"id\": \"nGI61D0TEEZz18rr\",\n \"name\": \"Your Postgresql Database Credentials\"\n }\n },\n \"typeVersion\": 2.5\n }\n ],\n \"active\": false,\n \"pinData\": {},\n \"settings\": {\n \"executionOrder\": \"v1\"\n },\n \"versionId\": \"10c7c74e-b383-4ac7-8cb2-c9a15a2818fe\",\n \"connections\": {\n \"Chat History\": {\n \"ai_memory\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_memory\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Execute SQL Query\": {\n \"ai_tool\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_tool\",\n \"index\": 0\n }\n ]\n ]\n },\n \"OpenAI Chat Model\": {\n \"ai_languageModel\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_languageModel\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get Table Definition\": {\n \"ai_tool\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_tool\",\n \"index\": 0\n }\n ]\n ]\n },\n \"When chat message received\": {\n \"main\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get DB Schema and Tables List\": {\n \"ai_tool\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_tool\",\n \"index\": 0\n }\n ]\n ]\n }\n }\n}\n```",
"role": "user"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.",
"role": "assistant"
}
] | 1
| 0
| 1
| false
|
combined_workflows.json
|
{
"input": "To create a chatbot that allows users to interact with a PostgreSQL database using natural language.",
"instruction": "Generate the n8n workflow JSON based on the user's request.",
"is_truncated": false,
"is_workflow": true,
"model_specific": {
"chat_template": true,
"format_version": "1.0",
"model": "mistral"
},
"model_used": "models/gemini-2.0-flash-lite",
"original_size": 6656,
"processed_size": 6656,
"processed_timestamp": "2025-04-09T03:08:36.294972",
"timestamp": "2025-04-09T02:34:24.762535",
"token_count": 3299,
"tokens": 697,
"workflow_chunk_info": {
"is_truncated": false,
"original_size": 6656,
"processed_size": 6656,
"workflow_hash": "89d3a942c529b44fbe0a91050c63fbe7"
},
"workflow_hash": "89d3a942c529b44fbe0a91050c63fbe7"
}
|
[INST] You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate descriptions of workflow functionality.
Generate the n8n workflow JSON based on the user's request.
Input Context:
This workflow aims to extract, process, and store files from a Supabase storage, enabling an AI agent to chat with the files. It involves fetching files, downloading them, extracting content, splitting text, generating embeddings, and storing them in a vector database.
Analyze this workflow:
```json
{
"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 ‘Test workflow’",
"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":
|
[
{
"content": "You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate descriptions of workflow functionality.",
"role": "system"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.\n\nWorkflow JSON:\n```json\n{\n \"meta\": {\n \"instanceId\": \"6a2a7715680b8313f7cb4676321c5baa46680adfb913072f089f2766f42e43bd\"\n },\n \"nodes\": [\n {\n \"id\": \"f577f6bd-b1a4-48ec-9329-7bccc3fc1463\",\n \"name\": \"Get All files\",\n \"type\": \"n8n-nodes-base.httpRequest\",\n \"position\": [\n 400,\n -100\n ],\n \"parameters\": {\n \"url\": \"=https://yqtvdcvjboenlblgcivl.supabase.co/storage/v1/object/list/private\",\n \"method\": \"POST\",\n \"options\": {},\n \"jsonBody\": \"={\\n \\\"prefix\\\": \\\"\\\",\\n \\\"limit\\\": 100,\\n \\\"offset\\\": 0,\\n \\\"sortBy\\\": {\\n \\\"column\\\": \\\"name\\\",\\n \\\"order\\\": \\\"asc\\\"\\n }\\n}\",\n \"sendBody\": true,\n \"specifyBody\": \"json\",\n \"authentication\": \"predefinedCredentialType\",\n \"nodeCredentialType\": \"supabaseApi\"\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 4.2\n },\n {\n \"id\": \"10693bc8-560d-4cf6-8bd0-2fe3f4d863d1\",\n \"name\": \"Default Data Loader\",\n \"type\": \"@n8n/n8n-nodes-langchain.documentDefaultDataLoader\",\n \"position\": [\n 1780,\n 100\n ],\n \"parameters\": {\n \"options\": {\n \"metadata\": {\n \"metadataValues\": [\n {\n \"name\": \"=file_id\",\n \"value\": \"={{ $json.id }}\"\n }\n ]\n }\n },\n \"jsonData\": \"={{ $('Merge').item.json.data ?? $('Merge').item.json.text }}\",\n \"jsonMode\": \"expressionData\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"49428060-e707-4269-8344-77b301f56f7c\",\n \"name\": \"Recursive Character Text Splitter\",\n \"type\": \"@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter\",\n \"position\": [\n 1780,\n 280\n ],\n \"parameters\": {\n \"options\": {},\n \"chunkSize\": 500,\n \"chunkOverlap\": 200\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"08742063-e235-4874-a128-b352786b19ce\",\n \"name\": \"Extract Document PDF\",\n \"type\": \"n8n-nodes-base.extractFromFile\",\n \"position\": [\n 1240,\n 0\n ],\n \"parameters\": {\n \"options\": {},\n \"operation\": \"pdf\"\n },\n \"typeVersion\": 1,\n \"alwaysOutputData\": false\n },\n {\n \"id\": \"21f19360-d7ce-4106-ae5a-aa0f15b7c4aa\",\n \"name\": \"Embeddings OpenAI\",\n \"type\": \"@n8n/n8n-nodes-langchain.embeddingsOpenAi\",\n \"position\": [\n 1600,\n 80\n ],\n \"parameters\": {\n \"model\": \"text-embedding-3-small\",\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"fLfRtaXbR0EVD0pl\",\n \"name\": \"OpenAi account\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"4147409f-8686-418f-b979-04f8c8e7fe42\",\n \"name\": \"Create File record2\",\n \"type\": \"n8n-nodes-base.supabase\",\n \"position\": [\n 1540,\n -100\n ],\n \"parameters\": {\n \"tableId\": \"files\",\n \"fieldsUi\": {\n \"fieldValues\": [\n {\n \"fieldId\": \"name\",\n \"fieldValue\": \"={{ $('Loop Over Items').item.json.name }}\"\n },\n {\n \"fieldId\": \"storage_id\",\n \"fieldValue\": \"={{ $('Loop Over Items').item.json.id }}\"\n }\n ]\n }\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"016f1afe-172b-4609-b451-8d67609214d3\",\n \"name\": \"If\",\n \"type\": \"n8n-nodes-base.if\",\n \"position\": [\n 720,\n -100\n ],\n \"parameters\": {\n \"options\": {},\n \"conditions\": {\n \"options\": {\n \"version\": 2,\n \"leftValue\": \"\",\n \"caseSensitive\": true,\n \"typeValidation\": \"strict\"\n },\n \"combinator\": \"and\",\n \"conditions\": [\n {\n \"id\": \"9b14e306-a04d-40f7-bc5b-b8eda8d8f7f2\",\n \"operator\": {\n \"type\": \"boolean\",\n \"operation\": \"true\",\n \"singleValue\": true\n },\n \"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}}\",\n \"rightValue\": \"\"\n },\n {\n \"id\": \"c3c0af88-9aea-4539-8948-1b69e601c27c\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"notEquals\"\n },\n \"leftValue\": \"={{ $json.name }}\",\n \"rightValue\": \".emptyFolderPlaceholder\"\n }\n ]\n }\n },\n \"typeVersion\": 2.2\n },\n {\n \"id\": \"75e8a7db-8c4a-4ad8-b902-062cbc93e1eb\",\n \"name\": \"Get All Files\",\n \"type\": \"n8n-nodes-base.supabase\",\n \"position\": [\n 20,\n -100\n ],\n \"parameters\": {\n \"tableId\": \"files\",\n \"operation\": \"getAll\"\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1,\n \"alwaysOutputData\": true\n },\n {\n \"id\": \"b22a3bab-f615-4d8a-8832-ce25b1a385fe\",\n \"name\": \"Download\",\n \"type\": \"n8n-nodes-base.httpRequest\",\n \"position\": [\n 900,\n -100\n ],\n \"parameters\": {\n \"url\": \"=https://yqtvdcvjboenlblgcivl.supabase.co/storage/v1/object/private/{{ $json.name }}\",\n \"options\": {},\n \"authentication\": \"predefinedCredentialType\",\n \"nodeCredentialType\": \"supabaseApi\"\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 4.2\n },\n {\n \"id\": \"50d1fede-4bd0-4cd4-b74a-7d689fe211cc\",\n \"name\": \"Loop Over Items\",\n \"type\": \"n8n-nodes-base.splitInBatches\",\n \"position\": [\n 560,\n -100\n ],\n \"parameters\": {\n \"options\": {},\n \"batchSize\": \"=1\"\n },\n \"typeVersion\": 3\n },\n {\n \"id\": \"f9c23b5e-0b40-4886-b54f-59fb46132d3f\",\n \"name\": \"When clicking ‘Test workflow’\",\n \"type\": \"n8n-nodes-base.manualTrigger\",\n \"position\": [\n -160,\n -100\n ],\n \"parameters\": {},\n \"typeVersion\": 1\n },\n {\n \"id\": \"0a0ec290-2c3d-40ba-8d03-6abf75202e73\",\n \"name\": \"Aggregate\",\n \"type\": \"n8n-nodes-base.aggregate\",\n \"position\": [\n 220,\n -100\n ],\n \"parameters\": {\n \"options\": {},\n \"aggregate\": \"aggregateAllItemData\"\n },\n \"typeVersion\": 1,\n \"alwaysOutputData\": true\n },\n {\n \"id\": \"32b3e2e1-2d25-4dd1-93e8-3f693beb7b6f\",\n \"name\": \"When chat message received\",\n \"type\": \"@n8n/n8n-nodes-langchain.chatTrigger\",\n \"position\": [\n 800,\n -1020\n ],\n \"webhookId\": \"3c40d311-7996-4ed4-b2fa-c73bea5f4cf5\",\n \"parameters\": {\n \"options\": {}\n },\n \"typeVersion\": 1.1\n },\n {\n \"id\": \"79073b5c-a4ad-45a6-bbfa-e900a05bfde3\",\n \"name\": \"OpenAI Chat Model1\",\n \"type\": \"@n8n/n8n-nodes-langchain.lmChatOpenAi\",\n \"position\": [\n 940,\n -820\n ],\n \"parameters\": {\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"zJhr5piyEwVnWtaI\",\n \"name\": \"OpenAi club\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"f8663483-76d5-4fc8-ad07-7eec815ff7a6\",\n \"name\": \"Embeddings OpenAI2\",\n \"type\": \"@n8n/n8n-nodes-langchain.embeddingsOpenAi\",\n \"position\": [\n 1020,\n -540\n ],\n \"parameters\": {\n \"model\": \"text-embedding-3-small\",\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"SphXAX7rlwRLkiox\",\n \"name\": \"Test club key\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"a1458799-d379-46de-93e6-a5ba0c665163\",\n \"name\": \"OpenAI Chat Model2\",\n \"type\": \"@n8n/n8n-nodes-langchain.lmChatOpenAi\",\n \"position\": [\n 1300,\n -680\n ],\n \"parameters\": {\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"SphXAX7rlwRLkiox\",\n \"name\": \"Test club key\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"d6eeda2f-c984-406d-a625-726840308413\",\n \"name\": \"Vector Store Tool1\",\n \"type\": \"@n8n/n8n-nodes-langchain.toolVectorStore\",\n \"position\": [\n 1100,\n -820\n ],\n \"parameters\": {\n \"name\": \"knowledge_base\",\n \"topK\": 8,\n \"description\": \"Retrieve data about user request\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"e1d9a348-7d44-4ad1-adbd-2c9a31e06876\",\n \"name\": \"Switch\",\n \"type\": \"n8n-nodes-base.switch\",\n \"position\": [\n 1060,\n -100\n ],\n \"parameters\": {\n \"rules\": {\n \"values\": [\n {\n \"outputKey\": \"txt\",\n \"conditions\": {\n \"options\": {\n \"version\": 1,\n \"leftValue\": \"\",\n \"caseSensitive\": true,\n \"typeValidation\": \"strict\"\n },\n \"combinator\": \"and\",\n \"conditions\": [\n {\n \"operator\": {\n \"type\": \"boolean\",\n \"operation\": \"true\",\n \"singleValue\": true\n },\n \"leftValue\": \"={{$binary.data?.fileExtension == undefined }}\",\n \"rightValue\": \"txt\"\n }\n ]\n },\n \"renameOutput\": true\n },\n {\n \"outputKey\": \"pdf\",\n \"conditions\": {\n \"options\": {\n \"version\": 1,\n \"leftValue\": \"\",\n \"caseSensitive\": true,\n \"typeValidation\": \"strict\"\n },\n \"combinator\": \"and\",\n \"conditions\": [\n {\n \"id\": \"bf04cbec-dd86-4607-988f-4c96b6fd4b58\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"equals\"\n },\n \"leftValue\": \"={{$binary.data.fileExtension }}\",\n \"rightValue\": \"pdf\"\n }\n ]\n },\n \"renameOutput\": true\n }\n ]\n },\n \"options\": {}\n },\n \"typeVersion\": 3.1\n },\n {\n \"id\": \"d38afb92-87ae-4e2a-a712-ec24b1efd105\",\n \"name\": \"Insert into Supabase Vectorstore\",\n \"type\": \"@n8n/n8n-nodes-langchain.vectorStoreSupabase\",\n \"position\": [\n 1700,\n -100\n ],\n \"parameters\": {\n \"mode\": \"insert\",\n \"options\": {\n \"queryName\": \"match_documents\"\n },\n \"tableName\": {\n \"__rl\": true,\n \"mode\": \"list\",\n \"value\": \"documents\",\n \"cachedResultName\": \"documents\"\n }\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"1a903b2e-cab0-4798-b820-ec08d6a71ddd\",\n \"name\": \"Merge\",\n \"type\": \"n8n-nodes-base.merge\",\n \"position\": [\n 1380,\n -100\n ],\n \"parameters\": {},\n \"typeVersion\": 3\n },\n {\n \"id\": \"3afd552e-4995-493e-9cd5-ef496dfe359f\",\n \"name\": \"AI Agent\",\n \"type\": \"@n8n/n8n-nodes-langchain.agent\",\n \"position\": [\n 1020,\n -1020\n ],\n \"parameters\": {\n \"options\": {}\n },\n \"typeVersion\": 1.7\n },\n {\n \"id\": \"d9688acc-311b-42fd-afa8-2c0e493be34b\",\n \"name\": \"Supabase Vector Store\",\n \"type\": \"@n8n/n8n-nodes-langchain.vectorStoreSupabase\",\n \"position\": [\n 1020,\n -660\n ],\n \"parameters\": {\n \"options\": {\n \"metadata\": {\n \"metadataValues\": [\n {\n \"name\": \"file_id\",\n \"value\": \"300b0128-0955-4058-b0d3-a9aefe728432\"\n }\n ]\n }\n },\n \"tableName\": {\n \"__rl\": true,\n \"mode\": \"list\",\n \"value\": \"documents\",\n \"cachedResultName\": \"documents\"\n }\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"66df007c-0418-4551-950e-32e7d79840bd\",\n \"name\": \"Sticky Note\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 340,\n -220\n ],\n \"parameters\": {\n \"height\": 89.3775420487804,\n \"content\": \"### Replace Storage name, database ID and credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"b164b520-20dd-44a4-aa3b-647391786b20\",\n \"name\": \"Sticky Note1\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -20,\n -220\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"8688c219-5af4-4e54-9fd1-91851829445b\",\n \"name\": \"Sticky Note2\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 1540,\n -220\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"45c6ece4-f849-4496-8149-31385f5e36a4\",\n \"name\": \"Sticky Note3\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 840,\n -220\n ],\n \"parameters\": {\n \"height\": 89.3775420487804,\n \"content\": \"### Replace Storage name, database ID and credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"2ca07cb0-b5f4-4761-b954-faf2131872d9\",\n \"name\": \"Sticky Note4\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 1500,\n 220\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"8d682dae-6f88-42f0-a717-affffd37d882\",\n \"name\": \"Sticky Note5\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 1140,\n -520\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"796b5dca-d60e-43a9-afe8-194244643557\",\n \"name\": \"Sticky Note9\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -520,\n -940\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 330.5152611046425,\n \"height\": 239.5888196628349,\n \"content\": \"### ... or watch set up video [10 min]\\n[](https://www.youtube.com/watch?v=glWUkdZe_3w)\\n\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"eba121de-a3f7-4ba5-8396-f7d64e648322\",\n \"name\": \"Sticky Note7\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -820,\n -1460\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 636.2128494576581,\n \"height\": 497.1532689930921,\n \"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\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"df054036-d6b9-4f53-86cb-85ad96f07d0e\",\n \"name\": \"Sticky Note6\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -820,\n -940\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 280.2462120317618,\n \"height\": 545.9087885077763,\n \"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.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"450a1e49-4be9-451a-9d05-2860e29c3695\",\n \"name\": \"Sticky Note8\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 540,\n -1160\n ],\n \"parameters\": {\n \"color\": 5,\n \"width\": 951.7421645394404,\n \"height\": 809.7437181509877,\n \"content\": \"## Scenario 2 - AI agent\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"c3814c5d-8881-4598-897e-268019bee1bc\",\n \"name\": \"Sticky Note10\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -260,\n -280\n ],\n \"parameters\": {\n \"color\": 5,\n \"width\": 2304.723519246249,\n \"height\": 739.2522526116408,\n \"content\": \"## Scenario 1 - Flow for adding new files from Supabase storage\"\n },\n \"typeVersion\": 1\n }\n ],\n \"pinData\": {},\n \"connections\": {\n \"If\": {\n \"main\": [\n [\n {\n \"node\": \"Download\",\n \"type\": \"main\",\n \"index\": 0\n }\n ],\n [\n {\n \"node\": \"Loop Over Items\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Merge\": {\n \"main\": [\n [\n {\n \"node\": \"Create File record2\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Switch\": {\n \"main\": [\n [\n {\n \"node\": \"Merge\",\n \"type\": \"main\",\n \"index\": 0\n }\n ],\n [\n {\n \"node\": \"Extract Document PDF\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Download\": {\n \"main\": [\n [\n {\n \"node\": \"Switch\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Aggregate\": {\n \"main\": [\n [\n {\n \"node\": \"Get All files\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get All Files\": {\n \"main\": [\n [\n {\n \"node\": \"Aggregate\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get All files\": {\n \"main\": [\n [\n {\n \"node\": \"Loop Over Items\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Loop Over Items\": {\n \"main\": [\n null,\n [\n {\n \"node\": \"If\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Embeddings OpenAI\": {\n \"ai_embedding\": [\n [\n {\n \"node\": \"Insert into Supabase Vectorstore\",\n \"type\": \"ai_embedding\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Embeddings OpenAI2\": {\n \"ai_embedding\": [\n [\n {\n \"node\": \"Supabase Vector Store\",\n \"type\": \"ai_embedding\",\n \"index\": 0\n }\n ]\n ]\n },\n \"OpenAI Chat Model1\": {\n \"ai_languageModel\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_languageModel\",\n \"index\": 0\n }\n ]\n ]\n },\n \"OpenAI Chat Model2\": {\n \"ai_languageModel\": [\n [\n {\n \"node\": \"Vector Store Tool1\",\n \"type\": \"ai_languageModel\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Vector Store Tool1\": {\n \"ai_tool\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_tool\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Create File record2\": {\n \"main\": [\n [\n {\n \"node\": \"Insert into Supabase Vectorstore\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Default Data Loader\": {\n \"ai_document\": [\n [\n {\n \"node\": \"Insert into Supabase Vectorstore\",\n \"type\": \"ai_document\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Extract Document PDF\": {\n \"main\": [\n [\n {\n \"node\": \"Merge\",\n \"type\": \"main\",\n \"index\": 1\n }\n ]\n ]\n },\n \"Supabase Vector Store\": {\n \"ai_vectorStore\": [\n [\n {\n \"node\": \"Vector Store Tool1\",\n \"type\": \"ai_vectorStore\",\n \"index\": 0\n }\n ]\n ]\n },\n \"When chat message received\": {\n \"main\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Insert into Supabase Vectorstore\": {\n \"main\": [\n [\n {\n \"node\": \"Loop Over Items\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Recursive Character Text Splitter\": {\n \"ai_textSplitter\": [\n [\n {\n \"node\": \"Default Data Loader\",\n \"type\": \"ai_textSplitter\",\n \"index\": 0\n }\n ]\n ]\n },\n \"When clicking ‘Test workflow’\": {\n \"main\": [\n [\n {\n \"node\": \"Get All Files\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n }\n }\n}\n```",
"role": "user"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.",
"role": "assistant"
}
] | 2
| 0
| 3
| true
|
combined_workflows.json
|
{
"input": "This workflow aims to extract, process, and store files from a Supabase storage, enabling an AI agent to chat with the files. It involves fetching files, downloading them, extracting content, splitting text, generating embeddings, and storing them in a vector database.",
"instruction": "Generate the n8n workflow JSON based on the user's request.",
"is_truncated": false,
"is_workflow": true,
"model_specific": {
"chat_template": true,
"format_version": "1.0",
"model": "mistral"
},
"model_used": "models/gemini-2.0-flash-lite",
"original_size": 16589,
"processed_size": 16589,
"processed_timestamp": "2025-04-09T03:08:36.532962",
"timestamp": "2025-04-09T02:34:24.802880",
"token_count": 4095,
"tokens": 1553,
"workflow_chunk_info": {
"is_truncated": false,
"original_size": 16589,
"processed_size": 16589,
"workflow_hash": "2f1e365c1aefa53d4f27f919ae641f7c"
},
"workflow_hash": "2f1e365c1aefa53d4f27f919ae641f7c"
}
|
"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": {
"
|
[
{
"content": "You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate descriptions of workflow functionality.",
"role": "system"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.\n\nWorkflow JSON:\n```json\n{\n \"meta\": {\n \"instanceId\": \"6a2a7715680b8313f7cb4676321c5baa46680adfb913072f089f2766f42e43bd\"\n },\n \"nodes\": [\n {\n \"id\": \"f577f6bd-b1a4-48ec-9329-7bccc3fc1463\",\n \"name\": \"Get All files\",\n \"type\": \"n8n-nodes-base.httpRequest\",\n \"position\": [\n 400,\n -100\n ],\n \"parameters\": {\n \"url\": \"=https://yqtvdcvjboenlblgcivl.supabase.co/storage/v1/object/list/private\",\n \"method\": \"POST\",\n \"options\": {},\n \"jsonBody\": \"={\\n \\\"prefix\\\": \\\"\\\",\\n \\\"limit\\\": 100,\\n \\\"offset\\\": 0,\\n \\\"sortBy\\\": {\\n \\\"column\\\": \\\"name\\\",\\n \\\"order\\\": \\\"asc\\\"\\n }\\n}\",\n \"sendBody\": true,\n \"specifyBody\": \"json\",\n \"authentication\": \"predefinedCredentialType\",\n \"nodeCredentialType\": \"supabaseApi\"\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 4.2\n },\n {\n \"id\": \"10693bc8-560d-4cf6-8bd0-2fe3f4d863d1\",\n \"name\": \"Default Data Loader\",\n \"type\": \"@n8n/n8n-nodes-langchain.documentDefaultDataLoader\",\n \"position\": [\n 1780,\n 100\n ],\n \"parameters\": {\n \"options\": {\n \"metadata\": {\n \"metadataValues\": [\n {\n \"name\": \"=file_id\",\n \"value\": \"={{ $json.id }}\"\n }\n ]\n }\n },\n \"jsonData\": \"={{ $('Merge').item.json.data ?? $('Merge').item.json.text }}\",\n \"jsonMode\": \"expressionData\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"49428060-e707-4269-8344-77b301f56f7c\",\n \"name\": \"Recursive Character Text Splitter\",\n \"type\": \"@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter\",\n \"position\": [\n 1780,\n 280\n ],\n \"parameters\": {\n \"options\": {},\n \"chunkSize\": 500,\n \"chunkOverlap\": 200\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"08742063-e235-4874-a128-b352786b19ce\",\n \"name\": \"Extract Document PDF\",\n \"type\": \"n8n-nodes-base.extractFromFile\",\n \"position\": [\n 1240,\n 0\n ],\n \"parameters\": {\n \"options\": {},\n \"operation\": \"pdf\"\n },\n \"typeVersion\": 1,\n \"alwaysOutputData\": false\n },\n {\n \"id\": \"21f19360-d7ce-4106-ae5a-aa0f15b7c4aa\",\n \"name\": \"Embeddings OpenAI\",\n \"type\": \"@n8n/n8n-nodes-langchain.embeddingsOpenAi\",\n \"position\": [\n 1600,\n 80\n ],\n \"parameters\": {\n \"model\": \"text-embedding-3-small\",\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"fLfRtaXbR0EVD0pl\",\n \"name\": \"OpenAi account\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"4147409f-8686-418f-b979-04f8c8e7fe42\",\n \"name\": \"Create File record2\",\n \"type\": \"n8n-nodes-base.supabase\",\n \"position\": [\n 1540,\n -100\n ],\n \"parameters\": {\n \"tableId\": \"files\",\n \"fieldsUi\": {\n \"fieldValues\": [\n {\n \"fieldId\": \"name\",\n \"fieldValue\": \"={{ $('Loop Over Items').item.json.name }}\"\n },\n {\n \"fieldId\": \"storage_id\",\n \"fieldValue\": \"={{ $('Loop Over Items').item.json.id }}\"\n }\n ]\n }\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"016f1afe-172b-4609-b451-8d67609214d3\",\n \"name\": \"If\",\n \"type\": \"n8n-nodes-base.if\",\n \"position\": [\n 720,\n -100\n ],\n \"parameters\": {\n \"options\": {},\n \"conditions\": {\n \"options\": {\n \"version\": 2,\n \"leftValue\": \"\",\n \"caseSensitive\": true,\n \"typeValidation\": \"strict\"\n },\n \"combinator\": \"and\",\n \"conditions\": [\n {\n \"id\": \"9b14e306-a04d-40f7-bc5b-b8eda8d8f7f2\",\n \"operator\": {\n \"type\": \"boolean\",\n \"operation\": \"true\",\n \"singleValue\": true\n },\n \"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}}\",\n \"rightValue\": \"\"\n },\n {\n \"id\": \"c3c0af88-9aea-4539-8948-1b69e601c27c\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"notEquals\"\n },\n \"leftValue\": \"={{ $json.name }}\",\n \"rightValue\": \".emptyFolderPlaceholder\"\n }\n ]\n }\n },\n \"typeVersion\": 2.2\n },\n {\n \"id\": \"75e8a7db-8c4a-4ad8-b902-062cbc93e1eb\",\n \"name\": \"Get All Files\",\n \"type\": \"n8n-nodes-base.supabase\",\n \"position\": [\n 20,\n -100\n ],\n \"parameters\": {\n \"tableId\": \"files\",\n \"operation\": \"getAll\"\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1,\n \"alwaysOutputData\": true\n },\n {\n \"id\": \"b22a3bab-f615-4d8a-8832-ce25b1a385fe\",\n \"name\": \"Download\",\n \"type\": \"n8n-nodes-base.httpRequest\",\n \"position\": [\n 900,\n -100\n ],\n \"parameters\": {\n \"url\": \"=https://yqtvdcvjboenlblgcivl.supabase.co/storage/v1/object/private/{{ $json.name }}\",\n \"options\": {},\n \"authentication\": \"predefinedCredentialType\",\n \"nodeCredentialType\": \"supabaseApi\"\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 4.2\n },\n {\n \"id\": \"50d1fede-4bd0-4cd4-b74a-7d689fe211cc\",\n \"name\": \"Loop Over Items\",\n \"type\": \"n8n-nodes-base.splitInBatches\",\n \"position\": [\n 560,\n -100\n ],\n \"parameters\": {\n \"options\": {},\n \"batchSize\": \"=1\"\n },\n \"typeVersion\": 3\n },\n {\n \"id\": \"f9c23b5e-0b40-4886-b54f-59fb46132d3f\",\n \"name\": \"When clicking ‘Test workflow’\",\n \"type\": \"n8n-nodes-base.manualTrigger\",\n \"position\": [\n -160,\n -100\n ],\n \"parameters\": {},\n \"typeVersion\": 1\n },\n {\n \"id\": \"0a0ec290-2c3d-40ba-8d03-6abf75202e73\",\n \"name\": \"Aggregate\",\n \"type\": \"n8n-nodes-base.aggregate\",\n \"position\": [\n 220,\n -100\n ],\n \"parameters\": {\n \"options\": {},\n \"aggregate\": \"aggregateAllItemData\"\n },\n \"typeVersion\": 1,\n \"alwaysOutputData\": true\n },\n {\n \"id\": \"32b3e2e1-2d25-4dd1-93e8-3f693beb7b6f\",\n \"name\": \"When chat message received\",\n \"type\": \"@n8n/n8n-nodes-langchain.chatTrigger\",\n \"position\": [\n 800,\n -1020\n ],\n \"webhookId\": \"3c40d311-7996-4ed4-b2fa-c73bea5f4cf5\",\n \"parameters\": {\n \"options\": {}\n },\n \"typeVersion\": 1.1\n },\n {\n \"id\": \"79073b5c-a4ad-45a6-bbfa-e900a05bfde3\",\n \"name\": \"OpenAI Chat Model1\",\n \"type\": \"@n8n/n8n-nodes-langchain.lmChatOpenAi\",\n \"position\": [\n 940,\n -820\n ],\n \"parameters\": {\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"zJhr5piyEwVnWtaI\",\n \"name\": \"OpenAi club\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"f8663483-76d5-4fc8-ad07-7eec815ff7a6\",\n \"name\": \"Embeddings OpenAI2\",\n \"type\": \"@n8n/n8n-nodes-langchain.embeddingsOpenAi\",\n \"position\": [\n 1020,\n -540\n ],\n \"parameters\": {\n \"model\": \"text-embedding-3-small\",\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"SphXAX7rlwRLkiox\",\n \"name\": \"Test club key\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"a1458799-d379-46de-93e6-a5ba0c665163\",\n \"name\": \"OpenAI Chat Model2\",\n \"type\": \"@n8n/n8n-nodes-langchain.lmChatOpenAi\",\n \"position\": [\n 1300,\n -680\n ],\n \"parameters\": {\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"SphXAX7rlwRLkiox\",\n \"name\": \"Test club key\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"d6eeda2f-c984-406d-a625-726840308413\",\n \"name\": \"Vector Store Tool1\",\n \"type\": \"@n8n/n8n-nodes-langchain.toolVectorStore\",\n \"position\": [\n 1100,\n -820\n ],\n \"parameters\": {\n \"name\": \"knowledge_base\",\n \"topK\": 8,\n \"description\": \"Retrieve data about user request\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"e1d9a348-7d44-4ad1-adbd-2c9a31e06876\",\n \"name\": \"Switch\",\n \"type\": \"n8n-nodes-base.switch\",\n \"position\": [\n 1060,\n -100\n ],\n \"parameters\": {\n \"rules\": {\n \"values\": [\n {\n \"outputKey\": \"txt\",\n \"conditions\": {\n \"options\": {\n \"version\": 1,\n \"leftValue\": \"\",\n \"caseSensitive\": true,\n \"typeValidation\": \"strict\"\n },\n \"combinator\": \"and\",\n \"conditions\": [\n {\n \"operator\": {\n \"type\": \"boolean\",\n \"operation\": \"true\",\n \"singleValue\": true\n },\n \"leftValue\": \"={{$binary.data?.fileExtension == undefined }}\",\n \"rightValue\": \"txt\"\n }\n ]\n },\n \"renameOutput\": true\n },\n {\n \"outputKey\": \"pdf\",\n \"conditions\": {\n \"options\": {\n \"version\": 1,\n \"leftValue\": \"\",\n \"caseSensitive\": true,\n \"typeValidation\": \"strict\"\n },\n \"combinator\": \"and\",\n \"conditions\": [\n {\n \"id\": \"bf04cbec-dd86-4607-988f-4c96b6fd4b58\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"equals\"\n },\n \"leftValue\": \"={{$binary.data.fileExtension }}\",\n \"rightValue\": \"pdf\"\n }\n ]\n },\n \"renameOutput\": true\n }\n ]\n },\n \"options\": {}\n },\n \"typeVersion\": 3.1\n },\n {\n \"id\": \"d38afb92-87ae-4e2a-a712-ec24b1efd105\",\n \"name\": \"Insert into Supabase Vectorstore\",\n \"type\": \"@n8n/n8n-nodes-langchain.vectorStoreSupabase\",\n \"position\": [\n 1700,\n -100\n ],\n \"parameters\": {\n \"mode\": \"insert\",\n \"options\": {\n \"queryName\": \"match_documents\"\n },\n \"tableName\": {\n \"__rl\": true,\n \"mode\": \"list\",\n \"value\": \"documents\",\n \"cachedResultName\": \"documents\"\n }\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"1a903b2e-cab0-4798-b820-ec08d6a71ddd\",\n \"name\": \"Merge\",\n \"type\": \"n8n-nodes-base.merge\",\n \"position\": [\n 1380,\n -100\n ],\n \"parameters\": {},\n \"typeVersion\": 3\n },\n {\n \"id\": \"3afd552e-4995-493e-9cd5-ef496dfe359f\",\n \"name\": \"AI Agent\",\n \"type\": \"@n8n/n8n-nodes-langchain.agent\",\n \"position\": [\n 1020,\n -1020\n ],\n \"parameters\": {\n \"options\": {}\n },\n \"typeVersion\": 1.7\n },\n {\n \"id\": \"d9688acc-311b-42fd-afa8-2c0e493be34b\",\n \"name\": \"Supabase Vector Store\",\n \"type\": \"@n8n/n8n-nodes-langchain.vectorStoreSupabase\",\n \"position\": [\n 1020,\n -660\n ],\n \"parameters\": {\n \"options\": {\n \"metadata\": {\n \"metadataValues\": [\n {\n \"name\": \"file_id\",\n \"value\": \"300b0128-0955-4058-b0d3-a9aefe728432\"\n }\n ]\n }\n },\n \"tableName\": {\n \"__rl\": true,\n \"mode\": \"list\",\n \"value\": \"documents\",\n \"cachedResultName\": \"documents\"\n }\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"66df007c-0418-4551-950e-32e7d79840bd\",\n \"name\": \"Sticky Note\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 340,\n -220\n ],\n \"parameters\": {\n \"height\": 89.3775420487804,\n \"content\": \"### Replace Storage name, database ID and credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"b164b520-20dd-44a4-aa3b-647391786b20\",\n \"name\": \"Sticky Note1\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -20,\n -220\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"8688c219-5af4-4e54-9fd1-91851829445b\",\n \"name\": \"Sticky Note2\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 1540,\n -220\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"45c6ece4-f849-4496-8149-31385f5e36a4\",\n \"name\": \"Sticky Note3\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 840,\n -220\n ],\n \"parameters\": {\n \"height\": 89.3775420487804,\n \"content\": \"### Replace Storage name, database ID and credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"2ca07cb0-b5f4-4761-b954-faf2131872d9\",\n \"name\": \"Sticky Note4\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 1500,\n 220\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"8d682dae-6f88-42f0-a717-affffd37d882\",\n \"name\": \"Sticky Note5\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 1140,\n -520\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"796b5dca-d60e-43a9-afe8-194244643557\",\n \"name\": \"Sticky Note9\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -520,\n -940\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 330.5152611046425,\n \"height\": 239.5888196628349,\n \"content\": \"### ... or watch set up video [10 min]\\n[](https://www.youtube.com/watch?v=glWUkdZe_3w)\\n\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"eba121de-a3f7-4ba5-8396-f7d64e648322\",\n \"name\": \"Sticky Note7\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -820,\n -1460\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 636.2128494576581,\n \"height\": 497.1532689930921,\n \"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\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"df054036-d6b9-4f53-86cb-85ad96f07d0e\",\n \"name\": \"Sticky Note6\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -820,\n -940\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 280.2462120317618,\n \"height\": 545.9087885077763,\n \"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.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"450a1e49-4be9-451a-9d05-2860e29c3695\",\n \"name\": \"Sticky Note8\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 540,\n -1160\n ],\n \"parameters\": {\n \"color\": 5,\n \"width\": 951.7421645394404,\n \"height\": 809.7437181509877,\n \"content\": \"## Scenario 2 - AI agent\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"c3814c5d-8881-4598-897e-268019bee1bc\",\n \"name\": \"Sticky Note10\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -260,\n -280\n ],\n \"parameters\": {\n \"color\": 5,\n \"width\": 2304.723519246249,\n \"height\": 739.2522526116408,\n \"content\": \"## Scenario 1 - Flow for adding new files from Supabase storage\"\n },\n \"typeVersion\": 1\n }\n ],\n \"pinData\": {},\n \"connections\": {\n \"If\": {\n \"main\": [\n [\n {\n \"node\": \"Download\",\n \"type\": \"main\",\n \"index\": 0\n }\n ],\n [\n {\n \"node\": \"Loop Over Items\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Merge\": {\n \"main\": [\n [\n {\n \"node\": \"Create File record2\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Switch\": {\n \"main\": [\n [\n {\n \"node\": \"Merge\",\n \"type\": \"main\",\n \"index\": 0\n }\n ],\n [\n {\n \"node\": \"Extract Document PDF\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Download\": {\n \"main\": [\n [\n {\n \"node\": \"Switch\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Aggregate\": {\n \"main\": [\n [\n {\n \"node\": \"Get All files\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get All Files\": {\n \"main\": [\n [\n {\n \"node\": \"Aggregate\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get All files\": {\n \"main\": [\n [\n {\n \"node\": \"Loop Over Items\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Loop Over Items\": {\n \"main\": [\n null,\n [\n {\n \"node\": \"If\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Embeddings OpenAI\": {\n \"ai_embedding\": [\n [\n {\n \"node\": \"Insert into Supabase Vectorstore\",\n \"type\": \"ai_embedding\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Embeddings OpenAI2\": {\n \"ai_embedding\": [\n [\n {\n \"node\": \"Supabase Vector Store\",\n \"type\": \"ai_embedding\",\n \"index\": 0\n }\n ]\n ]\n },\n \"OpenAI Chat Model1\": {\n \"ai_languageModel\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_languageModel\",\n \"index\": 0\n }\n ]\n ]\n },\n \"OpenAI Chat Model2\": {\n \"ai_languageModel\": [\n [\n {\n \"node\": \"Vector Store Tool1\",\n \"type\": \"ai_languageModel\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Vector Store Tool1\": {\n \"ai_tool\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_tool\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Create File record2\": {\n \"main\": [\n [\n {\n \"node\": \"Insert into Supabase Vectorstore\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Default Data Loader\": {\n \"ai_document\": [\n [\n {\n \"node\": \"Insert into Supabase Vectorstore\",\n \"type\": \"ai_document\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Extract Document PDF\": {\n \"main\": [\n [\n {\n \"node\": \"Merge\",\n \"type\": \"main\",\n \"index\": 1\n }\n ]\n ]\n },\n \"Supabase Vector Store\": {\n \"ai_vectorStore\": [\n [\n {\n \"node\": \"Vector Store Tool1\",\n \"type\": \"ai_vectorStore\",\n \"index\": 0\n }\n ]\n ]\n },\n \"When chat message received\": {\n \"main\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Insert into Supabase Vectorstore\": {\n \"main\": [\n [\n {\n \"node\": \"Loop Over Items\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Recursive Character Text Splitter\": {\n \"ai_textSplitter\": [\n [\n {\n \"node\": \"Default Data Loader\",\n \"type\": \"ai_textSplitter\",\n \"index\": 0\n }\n ]\n ]\n },\n \"When clicking ‘Test workflow’\": {\n \"main\": [\n [\n {\n \"node\": \"Get All Files\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n }\n }\n}\n```",
"role": "user"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.",
"role": "assistant"
}
] | 2
| 1
| 3
| true
|
combined_workflows.json
|
{
"input": "This workflow aims to extract, process, and store files from a Supabase storage, enabling an AI agent to chat with the files. It involves fetching files, downloading them, extracting content, splitting text, generating embeddings, and storing them in a vector database.",
"instruction": "Generate the n8n workflow JSON based on the user's request.",
"is_truncated": false,
"is_workflow": true,
"model_specific": {
"chat_template": true,
"format_version": "1.0",
"model": "mistral"
},
"model_used": "models/gemini-2.0-flash-lite",
"original_size": 16589,
"processed_size": 16589,
"processed_timestamp": "2025-04-09T03:08:36.550962",
"timestamp": "2025-04-09T02:34:24.802880",
"token_count": 4097,
"tokens": 1553,
"workflow_chunk_info": {
"is_truncated": false,
"original_size": 16589,
"processed_size": 16589,
"workflow_hash": "2f1e365c1aefa53d4f27f919ae641f7c"
},
"workflow_hash": "2f1e365c1aefa53d4f27f919ae641f7c"
}
|
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 ‘Test workflow’": {
"main": [
[
{
"node": "Get All Files",
"type": "main",
"index": 0
}
]
]
}
}
}
``` [/INST]Here's the analysis of the workflow functionality:
Generate the n8n workflow JSON based on the user's request.
|
[
{
"content": "You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate descriptions of workflow functionality.",
"role": "system"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.\n\nWorkflow JSON:\n```json\n{\n \"meta\": {\n \"instanceId\": \"6a2a7715680b8313f7cb4676321c5baa46680adfb913072f089f2766f42e43bd\"\n },\n \"nodes\": [\n {\n \"id\": \"f577f6bd-b1a4-48ec-9329-7bccc3fc1463\",\n \"name\": \"Get All files\",\n \"type\": \"n8n-nodes-base.httpRequest\",\n \"position\": [\n 400,\n -100\n ],\n \"parameters\": {\n \"url\": \"=https://yqtvdcvjboenlblgcivl.supabase.co/storage/v1/object/list/private\",\n \"method\": \"POST\",\n \"options\": {},\n \"jsonBody\": \"={\\n \\\"prefix\\\": \\\"\\\",\\n \\\"limit\\\": 100,\\n \\\"offset\\\": 0,\\n \\\"sortBy\\\": {\\n \\\"column\\\": \\\"name\\\",\\n \\\"order\\\": \\\"asc\\\"\\n }\\n}\",\n \"sendBody\": true,\n \"specifyBody\": \"json\",\n \"authentication\": \"predefinedCredentialType\",\n \"nodeCredentialType\": \"supabaseApi\"\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 4.2\n },\n {\n \"id\": \"10693bc8-560d-4cf6-8bd0-2fe3f4d863d1\",\n \"name\": \"Default Data Loader\",\n \"type\": \"@n8n/n8n-nodes-langchain.documentDefaultDataLoader\",\n \"position\": [\n 1780,\n 100\n ],\n \"parameters\": {\n \"options\": {\n \"metadata\": {\n \"metadataValues\": [\n {\n \"name\": \"=file_id\",\n \"value\": \"={{ $json.id }}\"\n }\n ]\n }\n },\n \"jsonData\": \"={{ $('Merge').item.json.data ?? $('Merge').item.json.text }}\",\n \"jsonMode\": \"expressionData\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"49428060-e707-4269-8344-77b301f56f7c\",\n \"name\": \"Recursive Character Text Splitter\",\n \"type\": \"@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter\",\n \"position\": [\n 1780,\n 280\n ],\n \"parameters\": {\n \"options\": {},\n \"chunkSize\": 500,\n \"chunkOverlap\": 200\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"08742063-e235-4874-a128-b352786b19ce\",\n \"name\": \"Extract Document PDF\",\n \"type\": \"n8n-nodes-base.extractFromFile\",\n \"position\": [\n 1240,\n 0\n ],\n \"parameters\": {\n \"options\": {},\n \"operation\": \"pdf\"\n },\n \"typeVersion\": 1,\n \"alwaysOutputData\": false\n },\n {\n \"id\": \"21f19360-d7ce-4106-ae5a-aa0f15b7c4aa\",\n \"name\": \"Embeddings OpenAI\",\n \"type\": \"@n8n/n8n-nodes-langchain.embeddingsOpenAi\",\n \"position\": [\n 1600,\n 80\n ],\n \"parameters\": {\n \"model\": \"text-embedding-3-small\",\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"fLfRtaXbR0EVD0pl\",\n \"name\": \"OpenAi account\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"4147409f-8686-418f-b979-04f8c8e7fe42\",\n \"name\": \"Create File record2\",\n \"type\": \"n8n-nodes-base.supabase\",\n \"position\": [\n 1540,\n -100\n ],\n \"parameters\": {\n \"tableId\": \"files\",\n \"fieldsUi\": {\n \"fieldValues\": [\n {\n \"fieldId\": \"name\",\n \"fieldValue\": \"={{ $('Loop Over Items').item.json.name }}\"\n },\n {\n \"fieldId\": \"storage_id\",\n \"fieldValue\": \"={{ $('Loop Over Items').item.json.id }}\"\n }\n ]\n }\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"016f1afe-172b-4609-b451-8d67609214d3\",\n \"name\": \"If\",\n \"type\": \"n8n-nodes-base.if\",\n \"position\": [\n 720,\n -100\n ],\n \"parameters\": {\n \"options\": {},\n \"conditions\": {\n \"options\": {\n \"version\": 2,\n \"leftValue\": \"\",\n \"caseSensitive\": true,\n \"typeValidation\": \"strict\"\n },\n \"combinator\": \"and\",\n \"conditions\": [\n {\n \"id\": \"9b14e306-a04d-40f7-bc5b-b8eda8d8f7f2\",\n \"operator\": {\n \"type\": \"boolean\",\n \"operation\": \"true\",\n \"singleValue\": true\n },\n \"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}}\",\n \"rightValue\": \"\"\n },\n {\n \"id\": \"c3c0af88-9aea-4539-8948-1b69e601c27c\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"notEquals\"\n },\n \"leftValue\": \"={{ $json.name }}\",\n \"rightValue\": \".emptyFolderPlaceholder\"\n }\n ]\n }\n },\n \"typeVersion\": 2.2\n },\n {\n \"id\": \"75e8a7db-8c4a-4ad8-b902-062cbc93e1eb\",\n \"name\": \"Get All Files\",\n \"type\": \"n8n-nodes-base.supabase\",\n \"position\": [\n 20,\n -100\n ],\n \"parameters\": {\n \"tableId\": \"files\",\n \"operation\": \"getAll\"\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1,\n \"alwaysOutputData\": true\n },\n {\n \"id\": \"b22a3bab-f615-4d8a-8832-ce25b1a385fe\",\n \"name\": \"Download\",\n \"type\": \"n8n-nodes-base.httpRequest\",\n \"position\": [\n 900,\n -100\n ],\n \"parameters\": {\n \"url\": \"=https://yqtvdcvjboenlblgcivl.supabase.co/storage/v1/object/private/{{ $json.name }}\",\n \"options\": {},\n \"authentication\": \"predefinedCredentialType\",\n \"nodeCredentialType\": \"supabaseApi\"\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 4.2\n },\n {\n \"id\": \"50d1fede-4bd0-4cd4-b74a-7d689fe211cc\",\n \"name\": \"Loop Over Items\",\n \"type\": \"n8n-nodes-base.splitInBatches\",\n \"position\": [\n 560,\n -100\n ],\n \"parameters\": {\n \"options\": {},\n \"batchSize\": \"=1\"\n },\n \"typeVersion\": 3\n },\n {\n \"id\": \"f9c23b5e-0b40-4886-b54f-59fb46132d3f\",\n \"name\": \"When clicking ‘Test workflow’\",\n \"type\": \"n8n-nodes-base.manualTrigger\",\n \"position\": [\n -160,\n -100\n ],\n \"parameters\": {},\n \"typeVersion\": 1\n },\n {\n \"id\": \"0a0ec290-2c3d-40ba-8d03-6abf75202e73\",\n \"name\": \"Aggregate\",\n \"type\": \"n8n-nodes-base.aggregate\",\n \"position\": [\n 220,\n -100\n ],\n \"parameters\": {\n \"options\": {},\n \"aggregate\": \"aggregateAllItemData\"\n },\n \"typeVersion\": 1,\n \"alwaysOutputData\": true\n },\n {\n \"id\": \"32b3e2e1-2d25-4dd1-93e8-3f693beb7b6f\",\n \"name\": \"When chat message received\",\n \"type\": \"@n8n/n8n-nodes-langchain.chatTrigger\",\n \"position\": [\n 800,\n -1020\n ],\n \"webhookId\": \"3c40d311-7996-4ed4-b2fa-c73bea5f4cf5\",\n \"parameters\": {\n \"options\": {}\n },\n \"typeVersion\": 1.1\n },\n {\n \"id\": \"79073b5c-a4ad-45a6-bbfa-e900a05bfde3\",\n \"name\": \"OpenAI Chat Model1\",\n \"type\": \"@n8n/n8n-nodes-langchain.lmChatOpenAi\",\n \"position\": [\n 940,\n -820\n ],\n \"parameters\": {\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"zJhr5piyEwVnWtaI\",\n \"name\": \"OpenAi club\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"f8663483-76d5-4fc8-ad07-7eec815ff7a6\",\n \"name\": \"Embeddings OpenAI2\",\n \"type\": \"@n8n/n8n-nodes-langchain.embeddingsOpenAi\",\n \"position\": [\n 1020,\n -540\n ],\n \"parameters\": {\n \"model\": \"text-embedding-3-small\",\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"SphXAX7rlwRLkiox\",\n \"name\": \"Test club key\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"a1458799-d379-46de-93e6-a5ba0c665163\",\n \"name\": \"OpenAI Chat Model2\",\n \"type\": \"@n8n/n8n-nodes-langchain.lmChatOpenAi\",\n \"position\": [\n 1300,\n -680\n ],\n \"parameters\": {\n \"options\": {}\n },\n \"credentials\": {\n \"openAiApi\": {\n \"id\": \"SphXAX7rlwRLkiox\",\n \"name\": \"Test club key\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"d6eeda2f-c984-406d-a625-726840308413\",\n \"name\": \"Vector Store Tool1\",\n \"type\": \"@n8n/n8n-nodes-langchain.toolVectorStore\",\n \"position\": [\n 1100,\n -820\n ],\n \"parameters\": {\n \"name\": \"knowledge_base\",\n \"topK\": 8,\n \"description\": \"Retrieve data about user request\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"e1d9a348-7d44-4ad1-adbd-2c9a31e06876\",\n \"name\": \"Switch\",\n \"type\": \"n8n-nodes-base.switch\",\n \"position\": [\n 1060,\n -100\n ],\n \"parameters\": {\n \"rules\": {\n \"values\": [\n {\n \"outputKey\": \"txt\",\n \"conditions\": {\n \"options\": {\n \"version\": 1,\n \"leftValue\": \"\",\n \"caseSensitive\": true,\n \"typeValidation\": \"strict\"\n },\n \"combinator\": \"and\",\n \"conditions\": [\n {\n \"operator\": {\n \"type\": \"boolean\",\n \"operation\": \"true\",\n \"singleValue\": true\n },\n \"leftValue\": \"={{$binary.data?.fileExtension == undefined }}\",\n \"rightValue\": \"txt\"\n }\n ]\n },\n \"renameOutput\": true\n },\n {\n \"outputKey\": \"pdf\",\n \"conditions\": {\n \"options\": {\n \"version\": 1,\n \"leftValue\": \"\",\n \"caseSensitive\": true,\n \"typeValidation\": \"strict\"\n },\n \"combinator\": \"and\",\n \"conditions\": [\n {\n \"id\": \"bf04cbec-dd86-4607-988f-4c96b6fd4b58\",\n \"operator\": {\n \"type\": \"string\",\n \"operation\": \"equals\"\n },\n \"leftValue\": \"={{$binary.data.fileExtension }}\",\n \"rightValue\": \"pdf\"\n }\n ]\n },\n \"renameOutput\": true\n }\n ]\n },\n \"options\": {}\n },\n \"typeVersion\": 3.1\n },\n {\n \"id\": \"d38afb92-87ae-4e2a-a712-ec24b1efd105\",\n \"name\": \"Insert into Supabase Vectorstore\",\n \"type\": \"@n8n/n8n-nodes-langchain.vectorStoreSupabase\",\n \"position\": [\n 1700,\n -100\n ],\n \"parameters\": {\n \"mode\": \"insert\",\n \"options\": {\n \"queryName\": \"match_documents\"\n },\n \"tableName\": {\n \"__rl\": true,\n \"mode\": \"list\",\n \"value\": \"documents\",\n \"cachedResultName\": \"documents\"\n }\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"1a903b2e-cab0-4798-b820-ec08d6a71ddd\",\n \"name\": \"Merge\",\n \"type\": \"n8n-nodes-base.merge\",\n \"position\": [\n 1380,\n -100\n ],\n \"parameters\": {},\n \"typeVersion\": 3\n },\n {\n \"id\": \"3afd552e-4995-493e-9cd5-ef496dfe359f\",\n \"name\": \"AI Agent\",\n \"type\": \"@n8n/n8n-nodes-langchain.agent\",\n \"position\": [\n 1020,\n -1020\n ],\n \"parameters\": {\n \"options\": {}\n },\n \"typeVersion\": 1.7\n },\n {\n \"id\": \"d9688acc-311b-42fd-afa8-2c0e493be34b\",\n \"name\": \"Supabase Vector Store\",\n \"type\": \"@n8n/n8n-nodes-langchain.vectorStoreSupabase\",\n \"position\": [\n 1020,\n -660\n ],\n \"parameters\": {\n \"options\": {\n \"metadata\": {\n \"metadataValues\": [\n {\n \"name\": \"file_id\",\n \"value\": \"300b0128-0955-4058-b0d3-a9aefe728432\"\n }\n ]\n }\n },\n \"tableName\": {\n \"__rl\": true,\n \"mode\": \"list\",\n \"value\": \"documents\",\n \"cachedResultName\": \"documents\"\n }\n },\n \"credentials\": {\n \"supabaseApi\": {\n \"id\": \"t8AQJzvZvrOMDLec\",\n \"name\": \"Supabase account My Airtable Gen\"\n }\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"66df007c-0418-4551-950e-32e7d79840bd\",\n \"name\": \"Sticky Note\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 340,\n -220\n ],\n \"parameters\": {\n \"height\": 89.3775420487804,\n \"content\": \"### Replace Storage name, database ID and credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"b164b520-20dd-44a4-aa3b-647391786b20\",\n \"name\": \"Sticky Note1\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -20,\n -220\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"8688c219-5af4-4e54-9fd1-91851829445b\",\n \"name\": \"Sticky Note2\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 1540,\n -220\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"45c6ece4-f849-4496-8149-31385f5e36a4\",\n \"name\": \"Sticky Note3\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 840,\n -220\n ],\n \"parameters\": {\n \"height\": 89.3775420487804,\n \"content\": \"### Replace Storage name, database ID and credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"2ca07cb0-b5f4-4761-b954-faf2131872d9\",\n \"name\": \"Sticky Note4\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 1500,\n 220\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"8d682dae-6f88-42f0-a717-affffd37d882\",\n \"name\": \"Sticky Note5\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 1140,\n -520\n ],\n \"parameters\": {\n \"height\": 80,\n \"content\": \"### Replace credentials.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"796b5dca-d60e-43a9-afe8-194244643557\",\n \"name\": \"Sticky Note9\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -520,\n -940\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 330.5152611046425,\n \"height\": 239.5888196628349,\n \"content\": \"### ... or watch set up video [10 min]\\n[](https://www.youtube.com/watch?v=glWUkdZe_3w)\\n\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"eba121de-a3f7-4ba5-8396-f7d64e648322\",\n \"name\": \"Sticky Note7\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -820,\n -1460\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 636.2128494576581,\n \"height\": 497.1532689930921,\n \"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\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"df054036-d6b9-4f53-86cb-85ad96f07d0e\",\n \"name\": \"Sticky Note6\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -820,\n -940\n ],\n \"parameters\": {\n \"color\": 7,\n \"width\": 280.2462120317618,\n \"height\": 545.9087885077763,\n \"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.\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"450a1e49-4be9-451a-9d05-2860e29c3695\",\n \"name\": \"Sticky Note8\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n 540,\n -1160\n ],\n \"parameters\": {\n \"color\": 5,\n \"width\": 951.7421645394404,\n \"height\": 809.7437181509877,\n \"content\": \"## Scenario 2 - AI agent\"\n },\n \"typeVersion\": 1\n },\n {\n \"id\": \"c3814c5d-8881-4598-897e-268019bee1bc\",\n \"name\": \"Sticky Note10\",\n \"type\": \"n8n-nodes-base.stickyNote\",\n \"position\": [\n -260,\n -280\n ],\n \"parameters\": {\n \"color\": 5,\n \"width\": 2304.723519246249,\n \"height\": 739.2522526116408,\n \"content\": \"## Scenario 1 - Flow for adding new files from Supabase storage\"\n },\n \"typeVersion\": 1\n }\n ],\n \"pinData\": {},\n \"connections\": {\n \"If\": {\n \"main\": [\n [\n {\n \"node\": \"Download\",\n \"type\": \"main\",\n \"index\": 0\n }\n ],\n [\n {\n \"node\": \"Loop Over Items\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Merge\": {\n \"main\": [\n [\n {\n \"node\": \"Create File record2\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Switch\": {\n \"main\": [\n [\n {\n \"node\": \"Merge\",\n \"type\": \"main\",\n \"index\": 0\n }\n ],\n [\n {\n \"node\": \"Extract Document PDF\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Download\": {\n \"main\": [\n [\n {\n \"node\": \"Switch\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Aggregate\": {\n \"main\": [\n [\n {\n \"node\": \"Get All files\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get All Files\": {\n \"main\": [\n [\n {\n \"node\": \"Aggregate\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get All files\": {\n \"main\": [\n [\n {\n \"node\": \"Loop Over Items\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Loop Over Items\": {\n \"main\": [\n null,\n [\n {\n \"node\": \"If\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Embeddings OpenAI\": {\n \"ai_embedding\": [\n [\n {\n \"node\": \"Insert into Supabase Vectorstore\",\n \"type\": \"ai_embedding\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Embeddings OpenAI2\": {\n \"ai_embedding\": [\n [\n {\n \"node\": \"Supabase Vector Store\",\n \"type\": \"ai_embedding\",\n \"index\": 0\n }\n ]\n ]\n },\n \"OpenAI Chat Model1\": {\n \"ai_languageModel\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_languageModel\",\n \"index\": 0\n }\n ]\n ]\n },\n \"OpenAI Chat Model2\": {\n \"ai_languageModel\": [\n [\n {\n \"node\": \"Vector Store Tool1\",\n \"type\": \"ai_languageModel\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Vector Store Tool1\": {\n \"ai_tool\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"ai_tool\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Create File record2\": {\n \"main\": [\n [\n {\n \"node\": \"Insert into Supabase Vectorstore\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Default Data Loader\": {\n \"ai_document\": [\n [\n {\n \"node\": \"Insert into Supabase Vectorstore\",\n \"type\": \"ai_document\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Extract Document PDF\": {\n \"main\": [\n [\n {\n \"node\": \"Merge\",\n \"type\": \"main\",\n \"index\": 1\n }\n ]\n ]\n },\n \"Supabase Vector Store\": {\n \"ai_vectorStore\": [\n [\n {\n \"node\": \"Vector Store Tool1\",\n \"type\": \"ai_vectorStore\",\n \"index\": 0\n }\n ]\n ]\n },\n \"When chat message received\": {\n \"main\": [\n [\n {\n \"node\": \"AI Agent\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Insert into Supabase Vectorstore\": {\n \"main\": [\n [\n {\n \"node\": \"Loop Over Items\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Recursive Character Text Splitter\": {\n \"ai_textSplitter\": [\n [\n {\n \"node\": \"Default Data Loader\",\n \"type\": \"ai_textSplitter\",\n \"index\": 0\n }\n ]\n ]\n },\n \"When clicking ‘Test workflow’\": {\n \"main\": [\n [\n {\n \"node\": \"Get All Files\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n }\n }\n}\n```",
"role": "user"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.",
"role": "assistant"
}
] | 2
| 2
| 3
| true
|
combined_workflows.json
|
{
"input": "This workflow aims to extract, process, and store files from a Supabase storage, enabling an AI agent to chat with the files. It involves fetching files, downloading them, extracting content, splitting text, generating embeddings, and storing them in a vector database.",
"instruction": "Generate the n8n workflow JSON based on the user's request.",
"is_truncated": false,
"is_workflow": true,
"model_specific": {
"chat_template": true,
"format_version": "1.0",
"model": "mistral"
},
"model_used": "models/gemini-2.0-flash-lite",
"original_size": 16589,
"processed_size": 16589,
"processed_timestamp": "2025-04-09T03:08:36.559963",
"timestamp": "2025-04-09T02:34:24.802880",
"token_count": 1170,
"tokens": 1553,
"workflow_chunk_info": {
"is_truncated": false,
"original_size": 16589,
"processed_size": 16589,
"workflow_hash": "2f1e365c1aefa53d4f27f919ae641f7c"
},
"workflow_hash": "2f1e365c1aefa53d4f27f919ae641f7c"
}
|
<s>[INST] You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate descriptions of workflow functionality.
Generate the n8n workflow JSON based on the user's request.
Input Context:
The workflow backs up n8n workflow data to Google Drive.
Analyze this workflow:
```json
{
"nodes": [
{
"name": "On clicking 'execute'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
320,
170
],
"parameters": {},
"typeVersion": 1
},
{
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
960,
320
],
"parameters": {
"mode": "mergeByIndex"
},
"typeVersion": 1
},
{
"name": "Move Binary Data",
"type": "n8n-nodes-base.moveBinaryData",
"position": [
1260,
320
],
"parameters": {
"mode": "jsonToBinary",
"options": {
"useRawData": false
}
},
"typeVersion": 1
},
{
"name": "Map",
"type": "n8n-nodes-base.function",
"position": [
710,
320
],
"parameters": {
"functionCode": "return items[0].json.data.map(item => {\n return {json: item}\n});"
},
"typeVersion": 1
},
{
"name": "Get Workflow",
"type": "n8n-nodes-base.httpRequest",
"notes": "Don't forget to add your credentials for your n8n instance in this Node. Use Basic Auth for this. ",
"position": [
830,
460
],
"parameters": {
"url": "=http://localhost:5678/rest/workflows/{{$node[\"Map\"].data[\"id\"]}}",
"options": {},
"authentication": "basicAuth"
},
"credentials": {
"httpBasicAuth": "n8n Creds"
},
"notesInFlow": false,
"typeVersion": 1
},
{
"name": "Get Workflow List",
"type": "n8n-nodes-base.httpRequest",
"notes": "Don't forget to add your credentials for your n8n instance in this Node. Use Basic Auth for this. ",
"position": [
520,
320
],
"parameters": {
"url": "http://localhost:5678/rest/workflows",
"options": {},
"authentication": "basicAuth"
},
"credentials": {
"httpBasicAuth": "n8n Creds"
},
"typeVersion": 1
},
{
"name": "FunctionItem",
"type": "n8n-nodes-base.functionItem",
"position": [
1110,
320
],
"parameters": {
"functionCode": "item = item.data;\nreturn item;"
},
"typeVersion": 1
},
{
"name": "Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
1450,
320
],
"parameters": {
"name": "={{$node[\"Merge\"].data[\"name\"]}}.json",
"parents": [
"Delete this text and put id for folder you want to upload into in this field. The folder ID can be found by opening the folder in your browser and copying the portion after https://drive.google.com/drive/u/0/folders/"
],
"binaryData": true,
"resolveData": true
},
"credentials": {
"googleApi": "test"
},
"typeVersion": 1
},
{
"name": "Run Daily at 2:30am",
"type": "n8n-nodes-base.cron",
"position": [
330,
320
],
"parameters": {
"triggerTimes": {
"item": [
{
"hour": 2,
"minute": 30
}
]
}
},
"typeVersion": 1
}
],
"connections": {
"Map": {
"main": [
[
{
"node": "Get Workflow",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "FunctionItem",
"type": "main",
"index": 0
}
]
]
},
"FunctionItem": {
"main": [
[
{
"node": "Move Binary Data",
"type": "main",
"index": 0
}
]
]
},
"Get Workflow": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Move Binary Data": {
"main": [
[
{
"node": "Google Drive",
"type": "main",
"index": 0
}
]
]
},
"Get Workflow List": {
"main": [
[
{
"node": "Map",
"type": "main",
"index": 0
}
]
]
},
"Run Daily at 2:30am": {
"main": [
[
{
"node": "Get Workflow List",
"type": "main",
"index": 0
}
]
]
},
"On clicking 'execute'": {
"main": [
[
{
"node": "Get Workflow List",
"type": "main",
"index": 0
}
]
]
}
}
}
``` [/INST]Here's the analysis of the workflow functionality:
Generate the n8n workflow JSON based on the user's request.</s>
|
[
{
"content": "You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate descriptions of workflow functionality.",
"role": "system"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.\n\nWorkflow JSON:\n```json\n{\n \"nodes\": [\n {\n \"name\": \"On clicking 'execute'\",\n \"type\": \"n8n-nodes-base.manualTrigger\",\n \"position\": [\n 320,\n 170\n ],\n \"parameters\": {},\n \"typeVersion\": 1\n },\n {\n \"name\": \"Merge\",\n \"type\": \"n8n-nodes-base.merge\",\n \"position\": [\n 960,\n 320\n ],\n \"parameters\": {\n \"mode\": \"mergeByIndex\"\n },\n \"typeVersion\": 1\n },\n {\n \"name\": \"Move Binary Data\",\n \"type\": \"n8n-nodes-base.moveBinaryData\",\n \"position\": [\n 1260,\n 320\n ],\n \"parameters\": {\n \"mode\": \"jsonToBinary\",\n \"options\": {\n \"useRawData\": false\n }\n },\n \"typeVersion\": 1\n },\n {\n \"name\": \"Map\",\n \"type\": \"n8n-nodes-base.function\",\n \"position\": [\n 710,\n 320\n ],\n \"parameters\": {\n \"functionCode\": \"return items[0].json.data.map(item => {\\n return {json: item}\\n});\"\n },\n \"typeVersion\": 1\n },\n {\n \"name\": \"Get Workflow\",\n \"type\": \"n8n-nodes-base.httpRequest\",\n \"notes\": \"Don't forget to add your credentials for your n8n instance in this Node. Use Basic Auth for this. \",\n \"position\": [\n 830,\n 460\n ],\n \"parameters\": {\n \"url\": \"=http://localhost:5678/rest/workflows/{{$node[\\\"Map\\\"].data[\\\"id\\\"]}}\",\n \"options\": {},\n \"authentication\": \"basicAuth\"\n },\n \"credentials\": {\n \"httpBasicAuth\": \"n8n Creds\"\n },\n \"notesInFlow\": false,\n \"typeVersion\": 1\n },\n {\n \"name\": \"Get Workflow List\",\n \"type\": \"n8n-nodes-base.httpRequest\",\n \"notes\": \"Don't forget to add your credentials for your n8n instance in this Node. Use Basic Auth for this. \",\n \"position\": [\n 520,\n 320\n ],\n \"parameters\": {\n \"url\": \"http://localhost:5678/rest/workflows\",\n \"options\": {},\n \"authentication\": \"basicAuth\"\n },\n \"credentials\": {\n \"httpBasicAuth\": \"n8n Creds\"\n },\n \"typeVersion\": 1\n },\n {\n \"name\": \"FunctionItem\",\n \"type\": \"n8n-nodes-base.functionItem\",\n \"position\": [\n 1110,\n 320\n ],\n \"parameters\": {\n \"functionCode\": \"item = item.data;\\nreturn item;\"\n },\n \"typeVersion\": 1\n },\n {\n \"name\": \"Google Drive\",\n \"type\": \"n8n-nodes-base.googleDrive\",\n \"position\": [\n 1450,\n 320\n ],\n \"parameters\": {\n \"name\": \"={{$node[\\\"Merge\\\"].data[\\\"name\\\"]}}.json\",\n \"parents\": [\n \"Delete this text and put id for folder you want to upload into in this field. The folder ID can be found by opening the folder in your browser and copying the portion after https://drive.google.com/drive/u/0/folders/\"\n ],\n \"binaryData\": true,\n \"resolveData\": true\n },\n \"credentials\": {\n \"googleApi\": \"test\"\n },\n \"typeVersion\": 1\n },\n {\n \"name\": \"Run Daily at 2:30am\",\n \"type\": \"n8n-nodes-base.cron\",\n \"position\": [\n 330,\n 320\n ],\n \"parameters\": {\n \"triggerTimes\": {\n \"item\": [\n {\n \"hour\": 2,\n \"minute\": 30\n }\n ]\n }\n },\n \"typeVersion\": 1\n }\n ],\n \"connections\": {\n \"Map\": {\n \"main\": [\n [\n {\n \"node\": \"Get Workflow\",\n \"type\": \"main\",\n \"index\": 0\n },\n {\n \"node\": \"Merge\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Merge\": {\n \"main\": [\n [\n {\n \"node\": \"FunctionItem\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"FunctionItem\": {\n \"main\": [\n [\n {\n \"node\": \"Move Binary Data\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get Workflow\": {\n \"main\": [\n [\n {\n \"node\": \"Merge\",\n \"type\": \"main\",\n \"index\": 1\n }\n ]\n ]\n },\n \"Move Binary Data\": {\n \"main\": [\n [\n {\n \"node\": \"Google Drive\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Get Workflow List\": {\n \"main\": [\n [\n {\n \"node\": \"Map\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Run Daily at 2:30am\": {\n \"main\": [\n [\n {\n \"node\": \"Get Workflow List\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"On clicking 'execute'\": {\n \"main\": [\n [\n {\n \"node\": \"Get Workflow List\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n }\n }\n}\n```",
"role": "user"
},
{
"content": "Generate the n8n workflow JSON based on the user's request.",
"role": "assistant"
}
] | 3
| 0
| 1
| false
|
combined_workflows.json
|
{
"input": "The workflow backs up n8n workflow data to Google Drive.",
"instruction": "Generate the n8n workflow JSON based on the user's request.",
"is_truncated": false,
"is_workflow": true,
"model_specific": {
"chat_template": true,
"format_version": "1.0",
"model": "mistral"
},
"model_used": "models/gemini-2.0-flash-lite",
"original_size": 3053,
"processed_size": 3053,
"processed_timestamp": "2025-04-09T03:08:36.616969",
"timestamp": "2025-04-09T02:34:25.222378",
"token_count": 1725,
"tokens": 325,
"workflow_chunk_info": {
"is_truncated": false,
"original_size": 3053,
"processed_size": 3053,
"workflow_hash": "22622da484f01b789b407668963dd845"
},
"workflow_hash": "22622da484f01b789b407668963dd845"
}
|
"<s>[INST] You are an expert in analyzing and understanding n8n workflows. Provide clear and accurat(...TRUNCATED)
| [{"content":"You are an expert in analyzing and understanding n8n workflows. Provide clear and accur(...TRUNCATED)
| 4
| 0
| 1
| false
|
combined_workflows.json
| {"input":"The workflow's goal is to validate if a given photo meets the criteria for a UK passport p(...TRUNCATED)
|
"[INST] You are an expert in analyzing and understanding n8n workflows. Provide clear and accurate d(...TRUNCATED)
| [{"content":"You are an expert in analyzing and understanding n8n workflows. Provide clear and accur(...TRUNCATED)
| 5
| 0
| 2
| true
|
combined_workflows.json
| {"input":"This workflow monitors website uptime, logs status changes, sends alerts via email and Sla(...TRUNCATED)
|
"\n },\n \"sendHeaders\": true,\n \"headerParameters\": {\n \"paramete(...TRUNCATED)
| [{"content":"You are an expert in analyzing and understanding n8n workflows. Provide clear and accur(...TRUNCATED)
| 5
| 1
| 2
| true
|
combined_workflows.json
| {"input":"This workflow monitors website uptime, logs status changes, sends alerts via email and Sla(...TRUNCATED)
|
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- -