{
  "workflow": {
    "id": 3459,
    "name": "Adaptive RAG strategy with query classification & retrieval (Gemini & Qdrant)",
    "views": 3388,
    "recentViews": 0,
    "totalViews": 3388,
    "createdAt": "2025-04-07T15:43:47.541Z",
    "description": "This n8n workflow implements a version of the Adaptive Retrieval-Augmented Generation (RAG) framework. It recognizes that the best way to retrieve information often depends on the type of question asked. Instead of a one-size-fits-all approach, this workflow adapts its strategy based on the user's query intent.\n\n## 🌟 How it Works\n\n1. **Receive Query:** Takes a user query as input (along with context like a chat session ID and Vector Store collection ID if used as sub-workflow).\n2. **Classify Query:** First, the workflow classifies the query into a predefined category. This template uses four examples:\n    * **Factual:** For specific facts.\n    * **Analytical:** For deeper explanations or comparisons.\n    * **Opinion:** For subjective viewpoints.\n    * **Contextual:** For questions relying on specific background.\n3. **Select & Adapt Strategy:** Based on the classification, it selects a corresponding strategy to prepare for information retrieval. The example strategies aim to:\n    * *Factual:* Refine the query for precision.\n    * *Analytical:* Break the query into sub-questions for broad coverage.\n    * *Opinion:* Identify different viewpoints to look for.\n    * *Contextual:* Incorporate implied or user-specific context.\n4. **Retrieve Info:** Uses the output of the selected strategy to search the specified knowledge base (Qdrant vector store - change as needed) for relevant documents.\n5. **Generate Response:** Constructs a response using the retrieved documents, guided by a prompt tailored to the original query type.\n\nBy adapting the retrieval strategy, this workflow aims to provide more relevant results tailored to the user's intent.\n\n## ⚙️ Usage & Flexibility\n\n* **Sub-Workflow:** Designed to be called from other n8n workflows, passing `user_query`, `chat_memory_key`, and `vector_store_id` as inputs.\n* **Chat Testing:** Can also be triggered directly via the n8n Chat interface for easy testing and interaction.\n* **Customizable Framework:** The query categories (Factual, Analytical, etc.) and the associated retrieval strategies are examples. You can modify or replace them entirely to fit your specific domain or requirements.\n\n## 🛠️ Requirements\n\n* **Credentials:** You will need API credentials configured in your n8n instance for:\n    * Google Gemini (AI Models)\n    * Qdrant (Vector Store)",
    "workflow": {
      "id": "cpuFyJYHKmjHTncz",
      "meta": {
        "instanceId": "2cb7a61f866faf57392b91b31f47e08a2b3640258f0abd08dd71f087f3243a5a",
        "templateCredsSetupCompleted": true
      },
      "name": "Adaptive RAG",
      "tags": [],
      "nodes": [
        {
          "id": "856bd809-8f41-41af-8f72-a3828229c2a5",
          "name": "Query Classification",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "notes": "Classify a query into one of four categories: Factual, Analytical, Opinion, or Contextual.\n        \nReturns:\nstr: Query category",
          "position": [
            380,
            -20
          ],
          "parameters": {
            "text": "=Classify this query: {{ $('Combined Fields').item.json.user_query }}",
            "options": {
              "systemMessage": "You are an expert at classifying questions. \n\nClassify the given query into exactly one of these categories:\n- Factual: Queries seeking specific, verifiable information.\n- Analytical: Queries requiring comprehensive analysis or explanation.\n- Opinion: Queries about subjective matters or seeking diverse viewpoints.\n- Contextual: Queries that depend on user-specific context.\n\nReturn ONLY the category name, without any explanation or additional text."
            },
            "promptType": "define"
          },
          "typeVersion": 1.8
        },
        {
          "id": "cc2106fc-f1a8-45ef-b37b-ab981ac13466",
          "name": "Switch",
          "type": "n8n-nodes-base.switch",
          "position": [
            740,
            -40
          ],
          "parameters": {
            "rules": {
              "values": [
                {
                  "outputKey": "Factual",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "87f3b50c-9f32-4260-ac76-19c05b28d0b4",
                        "operator": {
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $json.output.trim() }}",
                        "rightValue": "Factual"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "Analytical",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "f8651b36-79fa-4be4-91fb-0e6d7deea18f",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $json.output.trim() }}",
                        "rightValue": "Analytical"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "Opinion",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "5dde06bc-5fe1-4dca-b6e2-6857c5e96d49",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $json.output.trim() }}",
                        "rightValue": "Opinion"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "Contextual",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "bf97926d-7a0b-4e2f-aac0-a820f73344d8",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $json.output.trim() }}",
                        "rightValue": "Contextual"
                      }
                    ]
                  },
                  "renameOutput": true
                }
              ]
            },
            "options": {
              "fallbackOutput": 0
            }
          },
          "typeVersion": 3.2
        },
        {
          "id": "63889cad-1283-4dbf-ba16-2b6cf575f24a",
          "name": "Factual Strategy - Focus on Precision",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "notes": "Retrieval strategy for factual queries focusing on precision.",
          "position": [
            1140,
            -780
          ],
          "parameters": {
            "text": "=Enhance this factual query: {{ $('Combined Fields').item.json.user_query }}",
            "options": {
              "systemMessage": "=You are an expert at enhancing search queries.\n\nYour task is to reformulate the given factual query to make it more precise and specific for information retrieval. Focus on key entities and their relationships.\n\nProvide ONLY the enhanced query without any explanation."
            },
            "promptType": "define"
          },
          "typeVersion": 1.7
        },
        {
          "id": "020d2201-9590-400d-b496-48c65801271c",
          "name": "Analytical Strategy - Comprehensive Coverage",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "notes": "Retrieval strategy for analytical queries focusing on comprehensive coverage.",
          "position": [
            1140,
            -240
          ],
          "parameters": {
            "text": "=Generate sub-questions for this analytical query: {{ $('Combined Fields').item.json.user_query }}",
            "options": {
              "systemMessage": "=You are an expert at breaking down complex questions.\n\nGenerate sub-questions that explore different aspects of the main analytical query.\nThese sub-questions should cover the breadth of the topic and help retrieve comprehensive information.\n\nReturn a list of exactly 3 sub-questions, one per line."
            },
            "promptType": "define"
          },
          "typeVersion": 1.7
        },
        {
          "id": "c35d1b95-68c8-4237-932d-4744f620760d",
          "name": "Opinion Strategy - Diverse Perspectives",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "notes": "Retrieval strategy for opinion queries focusing on diverse perspectives.",
          "position": [
            1140,
            300
          ],
          "parameters": {
            "text": "=Identify different perspectives on: {{ $('Combined Fields').item.json.user_query }}",
            "options": {
              "systemMessage": "=You are an expert at identifying different perspectives on a topic.\n\nFor the given query about opinions or viewpoints, identify different perspectives that people might have on this topic.\n\nReturn a list of exactly 3 different viewpoint angles, one per line."
            },
            "promptType": "define"
          },
          "typeVersion": 1.7
        },
        {
          "id": "363a3fc3-112f-40df-891e-0a5aa3669245",
          "name": "Contextual Strategy - User Context Integration",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "notes": "Retrieval strategy for contextual queries integrating user context.",
          "position": [
            1140,
            840
          ],
          "parameters": {
            "text": "=Infer the implied context in this query: {{ $('Combined Fields').item.json.user_query }}",
            "options": {
              "systemMessage": "=You are an expert at understanding implied context in questions.\n\nFor the given query, infer what contextual information might be relevant or implied but not explicitly stated. Focus on what background would help answering this query.\n\nReturn a brief description of the implied context."
            },
            "promptType": "define"
          },
          "typeVersion": 1.7
        },
        {
          "id": "45887701-5ea5-48b4-9b2b-40a80238ab0c",
          "name": "Chat",
          "type": "@n8n/n8n-nodes-langchain.chatTrigger",
          "position": [
            -280,
            120
          ],
          "webhookId": "56f626b5-339e-48af-857f-1d4198fc8a4d",
          "parameters": {
            "options": {}
          },
          "typeVersion": 1.1
        },
        {
          "id": "7f7df364-4829-4e29-be3d-d13a63f65b8f",
          "name": "Factual Prompt and Output",
          "type": "n8n-nodes-base.set",
          "position": [
            1540,
            -780
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "a4a28ac2-4a56-46f6-8b86-f5d1a34b2ced",
                  "name": "output",
                  "type": "string",
                  "value": "={{ $json.output }}"
                },
                {
                  "id": "7aa6ce13-afbf-4871-b81c-6e9c722a53dc",
                  "name": "prompt",
                  "type": "string",
                  "value": "You are a helpful assistant providing factual information. Answer the question based on the provided context. Focus on accuracy and precision. If the context doesn't contain the information needed, acknowledge the limitations."
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "590d8667-69eb-4db2-b5be-714c602b319a",
          "name": "Contextual Prompt and Output",
          "type": "n8n-nodes-base.set",
          "position": [
            1540,
            840
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "a4a28ac2-4a56-46f6-8b86-f5d1a34b2ced",
                  "name": "output",
                  "type": "string",
                  "value": "={{ $json.output }}"
                },
                {
                  "id": "7aa6ce13-afbf-4871-b81c-6e9c722a53dc",
                  "name": "prompt",
                  "type": "string",
                  "value": "You are a helpful assistant providing contextually relevant information. Answer the question considering both the query and its context. Make connections between the query context and the information in the provided documents. If the context doesn't fully address the specific situation, acknowledge the limitations."
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "fa3228ee-62d8-4c02-9dca-8a1ebc6afc74",
          "name": "Opinion Prompt and Output",
          "type": "n8n-nodes-base.set",
          "position": [
            1540,
            300
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "a4a28ac2-4a56-46f6-8b86-f5d1a34b2ced",
                  "name": "output",
                  "type": "string",
                  "value": "={{ $json.output }}"
                },
                {
                  "id": "7aa6ce13-afbf-4871-b81c-6e9c722a53dc",
                  "name": "prompt",
                  "type": "string",
                  "value": "You are a helpful assistant discussing topics with multiple viewpoints. Based on the provided context, present different perspectives on the topic. Ensure fair representation of diverse opinions without showing bias. Acknowledge where the context presents limited viewpoints."
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "c769a76a-fb26-46a1-a00d-825b689d5f7a",
          "name": "Analytical Prompt and Output",
          "type": "n8n-nodes-base.set",
          "position": [
            1540,
            -240
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "a4a28ac2-4a56-46f6-8b86-f5d1a34b2ced",
                  "name": "output",
                  "type": "string",
                  "value": "={{ $json.output }}"
                },
                {
                  "id": "7aa6ce13-afbf-4871-b81c-6e9c722a53dc",
                  "name": "prompt",
                  "type": "string",
                  "value": "You are a helpful assistant providing analytical insights. Based on the provided context, offer a comprehensive analysis of the topic. Cover different aspects and perspectives in your explanation. If the context has gaps, acknowledge them while providing the best analysis possible."
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "fcd29f6b-17e8-442c-93f9-b93fbad7cd10",
          "name": "Gemini Classification",
          "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
          "position": [
            360,
            180
          ],
          "parameters": {
            "options": {},
            "modelName": "models/gemini-2.0-flash-lite"
          },
          "credentials": {
            "googlePalmApi": {
              "id": "credential-id",
              "name": "googlePalmApi Credential"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "c0828ee3-f184-41f5-9a25-0f1059b03711",
          "name": "Gemini Factual",
          "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
          "position": [
            1120,
            -560
          ],
          "parameters": {
            "options": {},
            "modelName": "models/gemini-2.0-flash"
          },
          "credentials": {
            "googlePalmApi": {
              "id": "credential-id",
              "name": "googlePalmApi Credential"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "98f9981d-ea8e-45cb-b91d-3c8d1fe33e25",
          "name": "Gemini Analytical",
          "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
          "position": [
            1120,
            -20
          ],
          "parameters": {
            "options": {},
            "modelName": "models/gemini-2.0-flash"
          },
          "credentials": {
            "googlePalmApi": {
              "id": "credential-id",
              "name": "googlePalmApi Credential"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "c85f270d-3224-4e60-9acf-91f173dfe377",
          "name": "Chat Buffer Memory Analytical",
          "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
          "position": [
            1280,
            -20
          ],
          "parameters": {
            "sessionKey": "={{ $('Combined Fields').item.json.chat_memory_key }}",
            "sessionIdType": "customKey",
            "contextWindowLength": 10
          },
          "typeVersion": 1.3
        },
        {
          "id": "c39ba907-7388-4152-965a-e28e626bc9b2",
          "name": "Chat Buffer Memory Factual",
          "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
          "position": [
            1280,
            -560
          ],
          "parameters": {
            "sessionKey": "={{ $('Combined Fields').item.json.chat_memory_key }}",
            "sessionIdType": "customKey",
            "contextWindowLength": 10
          },
          "typeVersion": 1.3
        },
        {
          "id": "52dcd9f0-e6b3-4d33-bc6f-621ef880178e",
          "name": "Gemini Opinion",
          "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
          "position": [
            1120,
            520
          ],
          "parameters": {
            "options": {},
            "modelName": "models/gemini-2.0-flash"
          },
          "credentials": {
            "googlePalmApi": {
              "id": "credential-id",
              "name": "googlePalmApi Credential"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "147a709a-4b46-4835-82cf-7d6b633acd4c",
          "name": "Chat Buffer Memory Opinion",
          "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
          "position": [
            1280,
            520
          ],
          "parameters": {
            "sessionKey": "={{ $('Combined Fields').item.json.chat_memory_key }}",
            "sessionIdType": "customKey",
            "contextWindowLength": 10
          },
          "typeVersion": 1.3
        },
        {
          "id": "3cb6bf32-5937-49b9-acf7-d7d01dc2ddd1",
          "name": "Gemini Contextual",
          "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
          "position": [
            1120,
            1060
          ],
          "parameters": {
            "options": {},
            "modelName": "models/gemini-2.0-flash"
          },
          "credentials": {
            "googlePalmApi": {
              "id": "credential-id",
              "name": "googlePalmApi Credential"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "5916c4f1-4369-4d66-8553-2fff006b7e69",
          "name": "Chat Buffer Memory Contextual",
          "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
          "position": [
            1280,
            1060
          ],
          "parameters": {
            "sessionKey": "={{ $('Combined Fields').item.json.chat_memory_key }}",
            "sessionIdType": "customKey",
            "contextWindowLength": 10
          },
          "typeVersion": 1.3
        },
        {
          "id": "d33377c2-6b98-4e4d-968f-f3085354ae50",
          "name": "Embeddings",
          "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
          "position": [
            2060,
            200
          ],
          "parameters": {
            "modelName": "models/text-embedding-004"
          },
          "credentials": {
            "googlePalmApi": {
              "id": "credential-id",
              "name": "googlePalmApi Credential"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "32d9a0c0-0889-4cb2-a088-8ee9cfecacd3",
          "name": "Sticky Note",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1040,
            -900
          ],
          "parameters": {
            "color": 7,
            "width": 700,
            "height": 520,
            "content": "## Factual Strategy\n**Retrieve precise facts and figures.**"
          },
          "typeVersion": 1
        },
        {
          "id": "064a4729-717c-40c8-824a-508406610a13",
          "name": "Sticky Note1",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1040,
            -360
          ],
          "parameters": {
            "color": 7,
            "width": 700,
            "height": 520,
            "content": "## Analytical Strategy\n**Provide comprehensive coverage of a topics and exploring different aspects.**"
          },
          "typeVersion": 1
        },
        {
          "id": "9fd52a28-44bc-4dfd-bdb7-90987cc2f4fb",
          "name": "Sticky Note2",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1040,
            180
          ],
          "parameters": {
            "color": 7,
            "width": 700,
            "height": 520,
            "content": "## Opinion Strategy\n**Gather diverse viewpoints on a subjective issue.**"
          },
          "typeVersion": 1
        },
        {
          "id": "3797b21f-cc2a-4210-aa63-6d181d413c5e",
          "name": "Sticky Note3",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1040,
            720
          ],
          "parameters": {
            "color": 7,
            "width": 700,
            "height": 520,
            "content": "## Contextual Strategy\n**Incorporate user-specific context to fine-tune the retrieval.**"
          },
          "typeVersion": 1
        },
        {
          "id": "16fa1531-9fb9-4b12-961c-be12e20b2134",
          "name": "Concatenate Context",
          "type": "n8n-nodes-base.summarize",
          "position": [
            2440,
            -20
          ],
          "parameters": {
            "options": {},
            "fieldsToSummarize": {
              "values": [
                {
                  "field": "document.pageContent",
                  "separateBy": "other",
                  "aggregation": "concatenate",
                  "customSeparator": "={{ \"\\n\\n---\\n\\n\" }}"
                }
              ]
            }
          },
          "typeVersion": 1.1
        },
        {
          "id": "4d6147d1-7a3d-42ab-b23f-cdafe8ea30b0",
          "name": "Retrieve Documents from Vector Store",
          "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
          "position": [
            2080,
            -20
          ],
          "parameters": {
            "mode": "load",
            "topK": 10,
            "prompt": "={{ $json.prompt }}\n\nUser query: \n{{ $json.output }}",
            "options": {},
            "qdrantCollection": {
              "__rl": true,
              "mode": "id",
              "value": "={{ $('Combined Fields').item.json.vector_store_id }}"
            }
          },
          "credentials": {
            "qdrantApi": {
              "id": "credential-id",
              "name": "qdrantApi Credential"
            }
          },
          "typeVersion": 1.1
        },
        {
          "id": "7e68f9cb-0a0d-4215-8083-3b9ef92cd237",
          "name": "Set Prompt and Output",
          "type": "n8n-nodes-base.set",
          "position": [
            1880,
            -20
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "1d782243-0571-4845-b8fe-4c6c4b55379e",
                  "name": "output",
                  "type": "string",
                  "value": "={{ $json.output }}"
                },
                {
                  "id": "547091fb-367c-44d4-ac39-24d073da70e0",
                  "name": "prompt",
                  "type": "string",
                  "value": "={{ $json.prompt }}"
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "0c623ca1-da85-48a3-9d8b-90d97283a015",
          "name": "Gemini Answer",
          "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
          "position": [
            2720,
            200
          ],
          "parameters": {
            "options": {},
            "modelName": "models/gemini-2.0-flash"
          },
          "credentials": {
            "googlePalmApi": {
              "id": "credential-id",
              "name": "googlePalmApi Credential"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "fab91e48-1c62-46a8-b9fc-39704f225274",
          "name": "Answer",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "position": [
            2760,
            -20
          ],
          "parameters": {
            "text": "=User query: {{ $('Combined Fields').item.json.user_query }}",
            "options": {
              "systemMessage": "={{ $('Set Prompt and Output').item.json.prompt }}\n\nUse the following context (delimited by <ctx></ctx>) and the chat history to answer the user query.\n<ctx>\n{{ $json.concatenated_document_pageContent }}\n</ctx>"
            },
            "promptType": "define"
          },
          "typeVersion": 1.8
        },
        {
          "id": "d69f8d62-3064-40a8-b490-22772fbc38cd",
          "name": "Chat Buffer Memory",
          "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
          "position": [
            2900,
            200
          ],
          "parameters": {
            "sessionKey": "={{ $('Combined Fields').item.json.chat_memory_key }}",
            "sessionIdType": "customKey",
            "contextWindowLength": 10
          },
          "typeVersion": 1.3
        },
        {
          "id": "a399f8e6-fafd-4f73-a2de-894f1e3c4bec",
          "name": "Sticky Note4",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1800,
            -220
          ],
          "parameters": {
            "color": 7,
            "width": 820,
            "height": 580,
            "content": "## Perform adaptive retrieval\n**Find document considering both query and context.**"
          },
          "typeVersion": 1
        },
        {
          "id": "7f10fe70-1af8-47ad-a9b5-2850412c43f8",
          "name": "Sticky Note5",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            2640,
            -220
          ],
          "parameters": {
            "color": 7,
            "width": 740,
            "height": 580,
            "content": "## Reply to the user integrating retrieval context"
          },
          "typeVersion": 1
        },
        {
          "id": "5cd0dd02-65f4-4351-aeae-c70ecf5f1d66",
          "name": "Respond to Webhook",
          "type": "n8n-nodes-base.respondToWebhook",
          "position": [
            3120,
            -20
          ],
          "parameters": {
            "options": {}
          },
          "typeVersion": 1.1
        },
        {
          "id": "4c56ef8f-8fce-4525-bb87-15df37e91cc4",
          "name": "Sticky Note6",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            280,
            -220
          ],
          "parameters": {
            "color": 7,
            "width": 700,
            "height": 580,
            "content": "## User query classification\n**Classify the query into one of four categories: Factual, Analytical, Opinion, or Contextual.**"
          },
          "typeVersion": 1
        },
        {
          "id": "3ef73405-89de-4bed-9673-90e2c1f2e74b",
          "name": "When Executed by Another Workflow",
          "type": "n8n-nodes-base.executeWorkflowTrigger",
          "position": [
            -280,
            -140
          ],
          "parameters": {
            "workflowInputs": {
              "values": [
                {
                  "name": "user_query"
                },
                {
                  "name": "chat_memory_key"
                },
                {
                  "name": "vector_store_id"
                }
              ]
            }
          },
          "typeVersion": 1.1
        },
        {
          "id": "0785714f-c45c-4eda-9937-c97e44c9a449",
          "name": "Combined Fields",
          "type": "n8n-nodes-base.set",
          "position": [
            40,
            -20
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "90ab73a2-fe01-451a-b9df-bffe950b1599",
                  "name": "user_query",
                  "type": "string",
                  "value": "={{ $json.user_query || $json.chatInput }}"
                },
                {
                  "id": "36686ff5-09fc-40a4-8335-a5dd1576e941",
                  "name": "chat_memory_key",
                  "type": "string",
                  "value": "={{ $json.chat_memory_key || $('Chat').item.json.sessionId }}"
                },
                {
                  "id": "4230c8f3-644c-4985-b710-a4099ccee77c",
                  "name": "vector_store_id",
                  "type": "string",
                  "value": "={{ $json.vector_store_id || \"<ID HERE>\" }}"
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "57a93b72-4233-4ba2-b8c7-99d88f0ed572",
          "name": "Sticky Note7",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -300,
            400
          ],
          "parameters": {
            "width": 1280,
            "height": 1300,
            "content": "# Adaptive RAG Workflow\n\nThis n8n workflow implements a version of the Adaptive Retrieval-Augmented Generation (RAG) approach. It classifies user queries and applies different retrieval and generation strategies based on the query type (Factual, Analytical, Opinion, or Contextual) to provide more relevant and tailored answers from a knowledge base stored in a Qdrant vector store.\n\n## How it Works\n\n1.  **Input Trigger:**\n    * The workflow can be initiated via the built-in Chat interface or triggered by another n8n workflow.\n    * It expects inputs: `user_query`, `chat_memory_key` (for conversation history), and `vector_store_id` (specifying the Qdrant collection).\n    * A `Set` node (`Combined Fields`) standardizes these inputs.\n\n2.  **Query Classification:**\n    * A Google Gemini agent (`Query Classification`) analyzes the `user_query`.\n    * It classifies the query into one of four categories:\n        * **Factual:** Seeking specific, verifiable information.\n        * **Analytical:** Requiring comprehensive analysis or explanation.\n        * **Opinion:** Asking about subjective matters or seeking diverse viewpoints.\n        * **Contextual:** Depending on user-specific or implied context.\n\n3.  **Adaptive Strategy Routing:**\n    * A `Switch` node routes the workflow based on the classification result from the previous step.\n\n4.  **Strategy Implementation (Query Adaptation):**\n    * Depending on the route, a specific Google Gemini agent adapts the query or approach:\n        * **Factual Strategy:** Rewrites the query for better precision, focusing on key entities (`Factual Strategy - Focus on Precision`).\n        * **Analytical Strategy:** Breaks down the main query into multiple sub-questions to ensure comprehensive coverage (`Analytical Strategy - Comprehensive Coverage`).\n        * **Opinion Strategy:** Identifies different potential perspectives or angles related to the query (`Opinion Strategy - Diverse Perspectives`).\n        * **Contextual Strategy:** Infers implied context needed to answer the query effectively (`Contextual Strategy - User Context Integration`).\n    * Each strategy path uses its own chat memory buffer for the adaptation step.\n\n5.  **Retrieval Prompt & Output Setup:**\n    * Based on the *original* query classification, a `Set` node (`Factual/Analytical/Opinion/Contextual Prompt and Output`, combined via connections to `Set Prompt and Output`) prepares:\n        * The output from the strategy step (e.g., rewritten query, sub-questions, perspectives).\n        * A tailored system prompt for the final answer generation agent, instructing it how to behave based on the query type (e.g., focus on precision for Factual, present diverse views for Opinion).\n\n6.  **Document Retrieval (RAG):**\n    * The `Retrieve Documents from Vector Store` node uses the adapted query/output from the strategy step to search the specified Qdrant collection (`vector_store_id`).\n    * It retrieves the top relevant document chunks using Google Gemini embeddings.\n\n7.  **Context Preparation:**\n    * The content from the retrieved document chunks is concatenated (`Concatenate Context`) to form a single context block for the final answer generation.\n\n8.  **Answer Generation:**\n    * The final `Answer` agent (powered by Google Gemini) generates the response.\n    * It uses:\n        * The tailored system prompt set in step 5.\n        * The concatenated context from retrieved documents (step 7).\n        * The original `user_query`.\n        * The shared chat history (`Chat Buffer Memory` using `chat_memory_key`).\n\n9.  **Response:**\n    * The generated answer is sent back to the user via the `Respond to Webhook` node."
          },
          "typeVersion": 1
        },
        {
          "id": "bec8070f-2ce9-4930-b71e-685a2b21d3f2",
          "name": "Sticky Note8",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -60,
            -220
          ],
          "parameters": {
            "color": 7,
            "width": 320,
            "height": 580,
            "content": "## ⚠️  If using in Chat mode\n\nUpdate the `vector_store_id` variable to the corresponding Qdrant ID needed to perform the documents retrieval."
          },
          "typeVersion": 1
        }
      ],
      "active": false,
      "pinData": {},
      "settings": {
        "executionOrder": "v1"
      },
      "versionId": "7d56eea8-a262-4add-a4e8-45c2b0c7d1a9",
      "connections": {
        "Chat": {
          "main": [
            [
              {
                "node": "Combined Fields",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Answer": {
          "main": [
            [
              {
                "node": "Respond to Webhook",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Switch": {
          "main": [
            [
              {
                "node": "Factual Strategy - Focus on Precision",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Analytical Strategy - Comprehensive Coverage",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Opinion Strategy - Diverse Perspectives",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Contextual Strategy - User Context Integration",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Embeddings": {
          "ai_embedding": [
            [
              {
                "node": "Retrieve Documents from Vector Store",
                "type": "ai_embedding",
                "index": 0
              }
            ]
          ]
        },
        "Gemini Answer": {
          "ai_languageModel": [
            [
              {
                "node": "Answer",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Gemini Factual": {
          "ai_languageModel": [
            [
              {
                "node": "Factual Strategy - Focus on Precision",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Gemini Opinion": {
          "ai_languageModel": [
            [
              {
                "node": "Opinion Strategy - Diverse Perspectives",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Combined Fields": {
          "main": [
            [
              {
                "node": "Query Classification",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Gemini Analytical": {
          "ai_languageModel": [
            [
              {
                "node": "Analytical Strategy - Comprehensive Coverage",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Gemini Contextual": {
          "ai_languageModel": [
            [
              {
                "node": "Contextual Strategy - User Context Integration",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Chat Buffer Memory": {
          "ai_memory": [
            [
              {
                "node": "Answer",
                "type": "ai_memory",
                "index": 0
              }
            ]
          ]
        },
        "Concatenate Context": {
          "main": [
            [
              {
                "node": "Answer",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Query Classification": {
          "main": [
            [
              {
                "node": "Switch",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Gemini Classification": {
          "ai_languageModel": [
            [
              {
                "node": "Query Classification",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Set Prompt and Output": {
          "main": [
            [
              {
                "node": "Retrieve Documents from Vector Store",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Factual Prompt and Output": {
          "main": [
            [
              {
                "node": "Set Prompt and Output",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Opinion Prompt and Output": {
          "main": [
            [
              {
                "node": "Set Prompt and Output",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Chat Buffer Memory Factual": {
          "ai_memory": [
            [
              {
                "node": "Factual Strategy - Focus on Precision",
                "type": "ai_memory",
                "index": 0
              }
            ]
          ]
        },
        "Chat Buffer Memory Opinion": {
          "ai_memory": [
            [
              {
                "node": "Opinion Strategy - Diverse Perspectives",
                "type": "ai_memory",
                "index": 0
              }
            ]
          ]
        },
        "Analytical Prompt and Output": {
          "main": [
            [
              {
                "node": "Set Prompt and Output",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Contextual Prompt and Output": {
          "main": [
            [
              {
                "node": "Set Prompt and Output",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Chat Buffer Memory Analytical": {
          "ai_memory": [
            [
              {
                "node": "Analytical Strategy - Comprehensive Coverage",
                "type": "ai_memory",
                "index": 0
              }
            ]
          ]
        },
        "Chat Buffer Memory Contextual": {
          "ai_memory": [
            [
              {
                "node": "Contextual Strategy - User Context Integration",
                "type": "ai_memory",
                "index": 0
              }
            ]
          ]
        },
        "When Executed by Another Workflow": {
          "main": [
            [
              {
                "node": "Combined Fields",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Retrieve Documents from Vector Store": {
          "main": [
            [
              {
                "node": "Concatenate Context",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Factual Strategy - Focus on Precision": {
          "main": [
            [
              {
                "node": "Factual Prompt and Output",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Opinion Strategy - Diverse Perspectives": {
          "main": [
            [
              {
                "node": "Opinion Prompt and Output",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Analytical Strategy - Comprehensive Coverage": {
          "main": [
            [
              {
                "node": "Analytical Prompt and Output",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Contextual Strategy - User Context Integration": {
          "main": [
            [
              {
                "node": "Contextual Prompt and Output",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    },
    "lastUpdatedBy": 29,
    "workflowInfo": {
      "nodeCount": 39,
      "nodeTypes": {
        "n8n-nodes-base.set": {
          "count": 6
        },
        "n8n-nodes-base.switch": {
          "count": 1
        },
        "n8n-nodes-base.summarize": {
          "count": 1
        },
        "n8n-nodes-base.stickyNote": {
          "count": 9
        },
        "@n8n/n8n-nodes-langchain.agent": {
          "count": 6
        },
        "n8n-nodes-base.respondToWebhook": {
          "count": 1
        },
        "@n8n/n8n-nodes-langchain.chatTrigger": {
          "count": 1
        },
        "n8n-nodes-base.executeWorkflowTrigger": {
          "count": 1
        },
        "@n8n/n8n-nodes-langchain.vectorStoreQdrant": {
          "count": 1
        },
        "@n8n/n8n-nodes-langchain.lmChatGoogleGemini": {
          "count": 6
        },
        "@n8n/n8n-nodes-langchain.memoryBufferWindow": {
          "count": 5
        },
        "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini": {
          "count": 1
        }
      }
    },
    "status": "published",
    "readyToDemo": null,
    "user": {
      "name": "dmr",
      "username": "dmr",
      "bio": "",
      "verified": false,
      "links": [],
      "avatar": "https://gravatar.com/avatar/8f3c6f9bc1a0f7f73d3421323e7fbd024f8dd48e8f97bb4a16ae77865d33394a?r=pg&d=retro&size=200"
    },
    "nodes": [
      {
        "id": 38,
        "icon": "fa:pen",
        "name": "n8n-nodes-base.set",
        "codex": {
          "data": {
            "alias": [
              "Set",
              "JS",
              "JSON",
              "Filter",
              "Transform",
              "Map"
            ],
            "resources": {
              "generic": [
                {
                  "url": "https://n8n.io/blog/learn-to-automate-your-factorys-incident-reporting-a-step-by-step-guide/",
                  "icon": "🏭",
                  "label": "Learn to Automate Your Factory's Incident Reporting: A Step by Step Guide"
                },
                {
                  "url": "https://n8n.io/blog/2021-the-year-to-automate-the-new-you-with-n8n/",
                  "icon": "☀️",
                  "label": "2021: The Year to Automate the New You with n8n"
                },
                {
                  "url": "https://n8n.io/blog/automatically-pulling-and-visualizing-data-with-n8n/",
                  "icon": "📈",
                  "label": "Automatically pulling and visualizing data with n8n"
                },
                {
                  "url": "https://n8n.io/blog/database-monitoring-and-alerting-with-n8n/",
                  "icon": "📡",
                  "label": "Database Monitoring and Alerting with n8n"
                },
                {
                  "url": "https://n8n.io/blog/automatically-adding-expense-receipts-to-google-sheets-with-telegram-mindee-twilio-and-n8n/",
                  "icon": "🧾",
                  "label": "Automatically Adding Expense Receipts to Google Sheets with Telegram, Mindee, Twilio, and n8n"
                },
                {
                  "url": "https://n8n.io/blog/no-code-ecommerce-workflow-automations/",
                  "icon": "store",
                  "label": "6 e-commerce workflows to power up your Shopify s"
                },
                {
                  "url": "https://n8n.io/blog/how-to-build-a-low-code-self-hosted-url-shortener/",
                  "icon": "🔗",
                  "label": "How to build a low-code, self-hosted URL shortener in 3 steps"
                },
                {
                  "url": "https://n8n.io/blog/automate-your-data-processing-pipeline-in-9-steps-with-n8n/",
                  "icon": "⚙️",
                  "label": "Automate your data processing pipeline in 9 steps"
                },
                {
                  "url": "https://n8n.io/blog/how-to-get-started-with-crm-automation-and-no-code-workflow-ideas/",
                  "icon": "👥",
                  "label": "How to get started with CRM automation (with 3 no-code workflow ideas"
                },
                {
                  "url": "https://n8n.io/blog/5-tasks-you-can-automate-with-notion-api/",
                  "icon": "⚡️",
                  "label": "5 tasks you can automate with the new Notion API "
                },
                {
                  "url": "https://n8n.io/blog/automate-google-apps-for-productivity/",
                  "icon": "💡",
                  "label": "15 Google apps you can combine and automate to increase productivity"
                },
                {
                  "url": "https://n8n.io/blog/how-uproc-scraped-a-multi-page-website-with-a-low-code-workflow/",
                  "icon": " 🕸️",
                  "label": "How uProc scraped a multi-page website with a low-code workflow"
                },
                {
                  "url": "https://n8n.io/blog/building-an-expense-tracking-app-in-10-minutes/",
                  "icon": "📱",
                  "label": "Building an expense tracking app in 10 minutes"
                },
                {
                  "url": "https://n8n.io/blog/the-ultimate-guide-to-automate-your-video-collaboration-with-whereby-mattermost-and-n8n/",
                  "icon": "📹",
                  "label": "The ultimate guide to automate your video collaboration with Whereby, Mattermost, and n8n"
                },
                {
                  "url": "https://n8n.io/blog/5-workflow-automations-for-mattermost-that-we-love-at-n8n/",
                  "icon": "🤖",
                  "label": "5 workflow automations for Mattermost that we love at n8n"
                },
                {
                  "url": "https://n8n.io/blog/learn-to-build-powerful-api-endpoints-using-webhooks/",
                  "icon": "🧰",
                  "label": "Learn to Build Powerful API Endpoints Using Webhooks"
                },
                {
                  "url": "https://n8n.io/blog/how-a-membership-development-manager-automates-his-work-and-investments/",
                  "icon": "📈",
                  "label": "How a Membership Development Manager automates his work and investments"
                },
                {
                  "url": "https://n8n.io/blog/a-low-code-bitcoin-ticker-built-with-questdb-and-n8n-io/",
                  "icon": "📈",
                  "label": "A low-code bitcoin ticker built with QuestDB and n8n.io"
                },
                {
                  "url": "https://n8n.io/blog/how-to-set-up-a-ci-cd-pipeline-with-no-code/",
                  "icon": "🎡",
                  "label": "How to set up a no-code CI/CD pipeline with GitHub and TravisCI"
                },
                {
                  "url": "https://n8n.io/blog/benefits-of-automation-and-n8n-an-interview-with-hubspots-hugh-durkin/",
                  "icon": "🎖",
                  "label": "Benefits of automation and n8n: An interview with HubSpot's Hugh Durkin"
                },
                {
                  "url": "https://n8n.io/blog/how-goomer-automated-their-operations-with-over-200-n8n-workflows/",
                  "icon": "🛵",
                  "label": "How Goomer automated their operations with over 200 n8n workflows"
                },
                {
                  "url": "https://n8n.io/blog/aws-workflow-automation/",
                  "label": "7 no-code workflow automations for Amazon Web Services"
                }
              ],
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.set/"
                }
              ]
            },
            "categories": [
              "Core Nodes"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0",
            "subcategories": {
              "Core Nodes": [
                "Data Transformation"
              ]
            }
          }
        },
        "group": "[\"input\"]",
        "defaults": {
          "name": "Edit Fields"
        },
        "iconData": {
          "icon": "pen",
          "type": "icon"
        },
        "displayName": "Edit Fields (Set)",
        "typeVersion": 3,
        "nodeCategories": [
          {
            "id": 9,
            "name": "Core Nodes"
          }
        ]
      },
      {
        "id": 112,
        "icon": "fa:map-signs",
        "name": "n8n-nodes-base.switch",
        "codex": {
          "data": {
            "alias": [
              "Router",
              "If",
              "Path",
              "Filter",
              "Condition",
              "Logic",
              "Branch",
              "Case"
            ],
            "resources": {
              "generic": [
                {
                  "url": "https://n8n.io/blog/2021-the-year-to-automate-the-new-you-with-n8n/",
                  "icon": "☀️",
                  "label": "2021: The Year to Automate the New You with n8n"
                },
                {
                  "url": "https://n8n.io/blog/how-to-get-started-with-crm-automation-and-no-code-workflow-ideas/",
                  "icon": "👥",
                  "label": "How to get started with CRM automation (with 3 no-code workflow ideas"
                },
                {
                  "url": "https://n8n.io/blog/build-your-own-virtual-assistant-with-n8n-a-step-by-step-guide/",
                  "icon": "👦",
                  "label": "Build your own virtual assistant with n8n: A step by step guide"
                },
                {
                  "url": "https://n8n.io/blog/automation-for-maintainers-of-open-source-projects/",
                  "icon": "🏷️",
                  "label": "How to automatically manage contributions to open-source projects"
                }
              ],
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.switch/"
                }
              ]
            },
            "categories": [
              "Core Nodes"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0",
            "subcategories": {
              "Core Nodes": [
                "Flow"
              ]
            }
          }
        },
        "group": "[\"transform\"]",
        "defaults": {
          "name": "Switch",
          "color": "#506000"
        },
        "iconData": {
          "icon": "map-signs",
          "type": "icon"
        },
        "displayName": "Switch",
        "typeVersion": 3,
        "nodeCategories": [
          {
            "id": 9,
            "name": "Core Nodes"
          }
        ]
      },
      {
        "id": 535,
        "icon": "file:webhook.svg",
        "name": "n8n-nodes-base.respondToWebhook",
        "codex": {
          "data": {
            "resources": {
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.respondtowebhook/"
                }
              ]
            },
            "categories": [
              "Core Nodes",
              "Utility"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0",
            "subcategories": {
              "Core Nodes": [
                "Helpers"
              ]
            }
          }
        },
        "group": "[\"transform\"]",
        "defaults": {
          "name": "Respond to Webhook"
        },
        "iconData": {
          "type": "file",
          "fileBuffer": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCI+PHBhdGggZmlsbD0iIzM3NDc0ZiIgZD0iTTM1IDM3Yy0yLjIgMC00LTEuOC00LTRzMS44LTQgNC00IDQgMS44IDQgNC0xLjggNC00IDQiLz48cGF0aCBmaWxsPSIjMzc0NzRmIiBkPSJNMzUgNDNjLTMgMC01LjktMS40LTcuOC0zLjdsMy4xLTIuNWMxLjEgMS40IDIuOSAyLjMgNC43IDIuMyAzLjMgMCA2LTIuNyA2LTZzLTIuNy02LTYtNmMtMSAwLTIgLjMtMi45LjdsLTEuNyAxTDIzLjMgMTZsMy41LTEuOSA1LjMgOS40YzEtLjMgMi0uNSAzLS41IDUuNSAwIDEwIDQuNSAxMCAxMFM0MC41IDQzIDM1IDQzIi8+PHBhdGggZmlsbD0iIzM3NDc0ZiIgZD0iTTE0IDQzQzguNSA0MyA0IDM4LjUgNCAzM2MwLTQuNiAzLjEtOC41IDcuNS05LjdsMSAzLjlDOS45IDI3LjkgOCAzMC4zIDggMzNjMCAzLjMgMi43IDYgNiA2czYtMi43IDYtNnYtMmgxNXY0SDIzLjhjLS45IDQuNi01IDgtOS44IDgiLz48cGF0aCBmaWxsPSIjZTkxZTYzIiBkPSJNMTQgMzdjLTIuMiAwLTQtMS44LTQtNHMxLjgtNCA0LTQgNCAxLjggNCA0LTEuOCA0LTQgNCIvPjxwYXRoIGZpbGw9IiMzNzQ3NGYiIGQ9Ik0yNSAxOWMtMi4yIDAtNC0xLjgtNC00czEuOC00IDQtNCA0IDEuOCA0IDQtMS44IDQtNCA0Ii8+PHBhdGggZmlsbD0iI2U5MWU2MyIgZD0ibTE1LjcgMzQtMy40LTIgNS45LTkuN2MtMi0xLjktMy4yLTQuNS0zLjItNy4zIDAtNS41IDQuNS0xMCAxMC0xMHMxMCA0LjUgMTAgMTBjMCAuOS0uMSAxLjctLjMgMi41bC0zLjktMWMuMS0uNS4yLTEgLjItMS41IDAtMy4zLTIuNy02LTYtNnMtNiAyLjctNiA2YzAgMi4xIDEuMSA0IDIuOSA1LjFsMS43IDF6Ii8+PC9zdmc+"
        },
        "displayName": "Respond to Webhook",
        "typeVersion": 2,
        "nodeCategories": [
          {
            "id": 7,
            "name": "Utility"
          },
          {
            "id": 9,
            "name": "Core Nodes"
          }
        ]
      },
      {
        "id": 565,
        "icon": "fa:sticky-note",
        "name": "n8n-nodes-base.stickyNote",
        "codex": {
          "data": {
            "alias": [
              "Comments",
              "Notes",
              "Sticky"
            ],
            "categories": [
              "Core Nodes"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0",
            "subcategories": {
              "Core Nodes": [
                "Helpers"
              ]
            }
          }
        },
        "group": "[\"input\"]",
        "defaults": {
          "name": "Sticky Note",
          "color": "#FFD233"
        },
        "iconData": {
          "icon": "sticky-note",
          "type": "icon"
        },
        "displayName": "Sticky Note",
        "typeVersion": 1,
        "nodeCategories": [
          {
            "id": 9,
            "name": "Core Nodes"
          }
        ]
      },
      {
        "id": 837,
        "icon": "fa:sign-out-alt",
        "name": "n8n-nodes-base.executeWorkflowTrigger",
        "codex": {
          "data": {
            "resources": {
              "generic": [],
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executeworkflowtrigger/"
                }
              ]
            },
            "categories": [
              "Core Nodes"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0",
            "subcategories": {
              "Core Nodes": [
                "Helpers"
              ]
            }
          }
        },
        "group": "[\"trigger\"]",
        "defaults": {
          "name": "When Executed by Another Workflow",
          "color": "#ff6d5a"
        },
        "iconData": {
          "icon": "sign-out-alt",
          "type": "icon"
        },
        "displayName": "Execute Workflow Trigger",
        "typeVersion": 1,
        "nodeCategories": [
          {
            "id": 9,
            "name": "Core Nodes"
          }
        ]
      },
      {
        "id": 1119,
        "icon": "fa:robot",
        "name": "@n8n/n8n-nodes-langchain.agent",
        "codex": {
          "data": {
            "alias": [
              "LangChain",
              "Chat",
              "Conversational",
              "Plan and Execute",
              "ReAct",
              "Tools"
            ],
            "resources": {
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/"
                }
              ]
            },
            "categories": [
              "AI",
              "Langchain"
            ],
            "subcategories": {
              "AI": [
                "Agents",
                "Root Nodes"
              ]
            }
          }
        },
        "group": "[\"transform\"]",
        "defaults": {
          "name": "AI Agent",
          "color": "#404040"
        },
        "iconData": {
          "icon": "robot",
          "type": "icon"
        },
        "displayName": "AI Agent",
        "typeVersion": 3,
        "nodeCategories": [
          {
            "id": 25,
            "name": "AI"
          },
          {
            "id": 26,
            "name": "Langchain"
          }
        ]
      },
      {
        "id": 1163,
        "icon": "fa:database",
        "name": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
        "codex": {
          "data": {
            "resources": {
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorybufferwindow/"
                }
              ]
            },
            "categories": [
              "AI",
              "Langchain"
            ],
            "subcategories": {
              "AI": [
                "Memory"
              ],
              "Memory": [
                "For beginners"
              ]
            }
          }
        },
        "group": "[\"transform\"]",
        "defaults": {
          "name": "Simple Memory"
        },
        "iconData": {
          "icon": "database",
          "type": "icon"
        },
        "displayName": "Simple Memory",
        "typeVersion": 1,
        "nodeCategories": [
          {
            "id": 25,
            "name": "AI"
          },
          {
            "id": 26,
            "name": "Langchain"
          }
        ]
      },
      {
        "id": 1241,
        "icon": "file:summarize.svg",
        "name": "n8n-nodes-base.summarize",
        "codex": {
          "data": {
            "alias": [
              "Append",
              "Array",
              "Average",
              "Concatenate",
              "Count",
              "Group",
              "Item",
              "List",
              "Max",
              "Min",
              "Pivot",
              "Sum",
              "Summarise",
              "Summarize",
              "Transform",
              "Unique"
            ],
            "details": "",
            "resources": {
              "generic": [],
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.summarize/"
                }
              ]
            },
            "categories": [
              "Core Nodes"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0",
            "subcategories": {
              "Core Nodes": [
                "Data Transformation"
              ]
            }
          }
        },
        "group": "[\"transform\"]",
        "defaults": {
          "name": "Summarize"
        },
        "iconData": {
          "type": "file",
          "fileBuffer": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsPSIjRjkyIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMzIgOTFjLTE1LjQ2NCAwLTI4IDEyLjUzNi0yOCAyOHYzMTdjMCAxNS40NjQgMTIuNTM2IDI4IDI4IDI4aDI0OGMxNS40NjQgMCAyOC0xMi41MzYgMjgtMjhWMTE5YzAtMTUuNDY0LTEyLjUzNi0yOC0yOC0yOGgtNmE2IDYgMCAwIDEtNi02VjQ5YTYgNiAwIDAgMSA2LTZoNmM0MS45NzQgMCA3NiAzNC4wMjYgNzYgNzZ2MzE3YzAgNDEuOTc0LTM0LjAyNiA3Ni03NiA3NkgxMzJjLTQxLjk3NCAwLTc2LTM0LjAyNi03Ni03NlYxMTljMC00MS45NzQgMzQuMDI2LTc2IDc2LTc2aDZhNiA2IDAgMCAxIDYgNnYzNmE2IDYgMCAwIDEtNiA2eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI0Y5MiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMjU2IDBjLTI3LjIzMiAwLTUwLjIyNyAxOC4xNDItNTcuNTU4IDQzSDE4MmE2IDYgMCAwIDAtNiA2djcwYTYgNiAwIDAgMCA2IDZoMTQ4YTYgNiAwIDAgMCA2LTZWNDlhNiA2IDAgMCAwLTYtNmgtMTYuNDQyQzMwNi4yMjcgMTguMTQyIDI4My4yMzIgMCAyNTYgMG0wIDQwYTE5LjkgMTkuOSAwIDAgMC0xMC41NDEgM0MyMzkuNzgxIDQ2LjUyOCAyMzYgNTIuODIzIDIzNiA2MGMwIDExLjA0NiA4Ljk1NCAyMCAyMCAyMHMyMC04Ljk1NCAyMC0yMGMwLTcuMTc3LTMuNzgxLTEzLjQ3Mi05LjQ1OS0xN0ExOS45IDE5LjkgMCAwIDAgMjU2IDQwbTEwMSAxNzljMCA2LjYyNy01LjM3MyAxMi0xMiAxMkgyMzNjLTYuNjI3IDAtMTItNS4zNzMtMTItMTJ2LTI0YzAtNi42MjcgNS4zNzMtMTIgMTItMTJoMTEyYzYuNjI3IDAgMTIgNS4zNzMgMTIgMTJ6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48cGF0aCBmaWxsPSIjRjkyIiBkPSJNMTk3IDIwN2MwIDEzLjI1NS0xMC43NDUgMjQtMjQgMjRzLTI0LTEwLjc0NS0yNC0yNCAxMC43NDUtMjQgMjQtMjQgMjQgMTAuNzQ1IDI0IDI0Ii8+PHBhdGggZmlsbD0iI0Y5MiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzU3IDM5NWMwIDYuNjI3LTUuMzczIDEyLTEyIDEySDIzM2MtNi42MjcgMC0xMi01LjM3My0xMi0xMnYtMjRjMC02LjYyNyA1LjM3My0xMiAxMi0xMmgxMTJjNi42MjcgMCAxMiA1LjM3MyAxMiAxMnoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiNGOTIiIGQ9Ik0xOTcgMzgzYzAgMTMuMjU1LTEwLjc0NSAyNC0yNCAyNHMtMjQtMTAuNzQ1LTI0LTI0IDEwLjc0NS0yNCAyNC0yNCAyNCAxMC43NDUgMjQgMjQiLz48cGF0aCBmaWxsPSIjRjkyIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zNTcgMzA3YzAgNi42MjctNS4zNzMgMTItMTIgMTJIMjMzYy02LjYyNyAwLTEyLTUuMzczLTEyLTEydi0yNGMwLTYuNjI3IDUuMzczLTEyIDEyLTEyaDExMmM2LjYyNyAwIDEyIDUuMzczIDEyIDEyeiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI0Y5MiIgZD0iTTE5NyAyOTVjMCAxMy4yNTUtMTAuNzQ1IDI0LTI0IDI0cy0yNC0xMC43NDUtMjQtMjQgMTAuNzQ1LTI0IDI0LTI0IDI0IDEwLjc0NSAyNCAyNCIvPjwvc3ZnPg=="
        },
        "displayName": "Summarize",
        "typeVersion": 1,
        "nodeCategories": [
          {
            "id": 9,
            "name": "Core Nodes"
          }
        ]
      },
      {
        "id": 1247,
        "icon": "fa:comments",
        "name": "@n8n/n8n-nodes-langchain.chatTrigger",
        "codex": {
          "data": {
            "resources": {
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.chattrigger/"
                }
              ]
            },
            "categories": [
              "Core Nodes",
              "Langchain"
            ]
          }
        },
        "group": "[\"trigger\"]",
        "defaults": {
          "name": "When chat message received"
        },
        "iconData": {
          "icon": "comments",
          "type": "icon"
        },
        "displayName": "Chat Trigger",
        "typeVersion": 1,
        "nodeCategories": [
          {
            "id": 9,
            "name": "Core Nodes"
          },
          {
            "id": 26,
            "name": "Langchain"
          }
        ]
      },
      {
        "id": 1248,
        "icon": "file:qdrant.svg",
        "name": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
        "codex": {
          "data": {
            "resources": {
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreqdrant/"
                }
              ]
            },
            "categories": [
              "AI",
              "Langchain"
            ],
            "subcategories": {
              "AI": [
                "Vector Stores",
                "Tools",
                "Root Nodes"
              ],
              "Tools": [
                "Other Tools"
              ],
              "Vector Stores": [
                "Other Vector Stores"
              ]
            }
          }
        },
        "group": "[\"transform\"]",
        "defaults": {
          "name": "Qdrant Vector Store"
        },
        "iconData": {
          "type": "file",
          "fileBuffer": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBkYXRhLW5hbWU9IkNhcGEgMiIgdmlld0JveD0iMCAwIDM0Ni40MiA0MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxkZWZzPgo8c3R5bGU+LmNscy0xIHsKICAgICAgICBmaWxsOiAjOWUwZDM4OwogICAgICB9CgogICAgICAuY2xzLTIgewogICAgICAgIGZpbGw6ICNkYzI0NGM7CiAgICAgIH0KCiAgICAgIC5jbHMtMyB7CiAgICAgICAgZmlsbDogI2ZmNTE2YjsKICAgICAgfTwvc3R5bGU+CjwvZGVmcz4KPHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjE3My4yMSAwIDAgMTAwIDAgMzAwIDE3My4yMSA0MDAgMjM4LjE2IDM2Mi41IDIzOC4xNiAyODcuNSAxNzMuMjEgMzI1IDY0Ljk2IDI2Mi41IDY0Ljk2IDEzNy41IDE3My4yMSA3NSAyODEuNDYgMTM3LjUgMjgxLjQ2IDM4Ny41IDM0Ni40MiAzNTAgMzQ2LjQyIDEwMCIvPgo8cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iMTA4LjI2IDE2Mi41IDEwOC4yNiAyMzcuNSAxNzMuMjEgMjc1IDIzOC4xNiAyMzcuNSAyMzguMTYgMTYyLjUgMTczLjIxIDEyNSIvPgo8cG9seWdvbiBjbGFzcz0iY2xzLTEiIHBvaW50cz0iMjM4LjE2IDI4Ny41IDIzOC4xNiAzNjIuNSAxNzMuMjEgNDAwIDE3My4yMSAzMjUiLz4KPHBvbHlnb24gY2xhc3M9ImNscy0xIiBwb2ludHM9IjM0Ni40MiAxMDAgMzQ2LjQyIDM1MCAyODEuNDYgMzg3LjUgMjgxLjQ2IDEzNy41Ii8+Cjxwb2x5Z29uIGNsYXNzPSJjbHMtMyIgcG9pbnRzPSIzNDYuNDIgMTAwIDI4MS40NiAxMzcuNSAxNzMuMjEgNzUgNjQuOTYgMTM3LjUgMCAxMDAgMTczLjIxIDAiLz4KPHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjE3My4yMSAzMjUgMTczLjIxIDQwMCAwIDMwMCAwIDEwMCA2NC45NiAxMzcuNSA2NC45NiAyNjIuNSIvPgo8cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iMjM4LjE2IDE2Mi41IDE3My4yMSAyMDAgMTA4LjI2IDE2Mi41IDE3My4yMSAxMjUiLz4KPHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjE3My4yMSAyMDAgMTczLjIxIDI3NSAxMDguMjYgMjM3LjUgMTA4LjI2IDE2Mi41Ii8+Cjxwb2x5Z29uIGNsYXNzPSJjbHMtMSIgcG9pbnRzPSIyMzguMTYgMTYyLjUgMjM4LjE2IDIzNy41IDE3My4yMSAyNzUgMTczLjIxIDIwMCIvPgo8L3N2Zz4K"
        },
        "displayName": "Qdrant Vector Store",
        "typeVersion": 1,
        "nodeCategories": [
          {
            "id": 25,
            "name": "AI"
          },
          {
            "id": 26,
            "name": "Langchain"
          }
        ]
      },
      {
        "id": 1261,
        "icon": "file:google.svg",
        "name": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
        "codex": {
          "data": {
            "resources": {
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.embeddingsgooglegemini/"
                }
              ]
            },
            "categories": [
              "AI",
              "Langchain"
            ],
            "subcategories": {
              "AI": [
                "Embeddings"
              ]
            }
          }
        },
        "group": "[\"transform\"]",
        "defaults": {
          "name": "Embeddings Google Gemini"
        },
        "iconData": {
          "type": "file",
          "fileBuffer": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNDggNDgiPjxkZWZzPjxwYXRoIGlkPSJhIiBkPSJNNDQuNSAyMEgyNHY4LjVoMTEuOEMzNC43IDMzLjkgMzAuMSAzNyAyNCAzN2MtNy4yIDAtMTMtNS44LTEzLTEzczUuOC0xMyAxMy0xM2MzLjEgMCA1LjkgMS4xIDguMSAyLjlsNi40LTYuNEMzNC42IDQuMSAyOS42IDIgMjQgMiAxMS44IDIgMiAxMS44IDIgMjRzOS44IDIyIDIyIDIyYzExIDAgMjEtOCAyMS0yMiAwLTEuMy0uMi0yLjctLjUtNCIvPjwvZGVmcz48Y2xpcFBhdGggaWQ9ImIiPjx1c2UgeGxpbms6aHJlZj0iI2EiIG92ZXJmbG93PSJ2aXNpYmxlIi8+PC9jbGlwUGF0aD48cGF0aCBmaWxsPSIjRkJCQzA1IiBkPSJNMCAzN1YxMWwxNyAxM3oiIGNsaXAtcGF0aD0idXJsKCNiKSIvPjxwYXRoIGZpbGw9IiNFQTQzMzUiIGQ9Im0wIDExIDE3IDEzIDctNi4xTDQ4IDE0VjBIMHoiIGNsaXAtcGF0aD0idXJsKCNiKSIvPjxwYXRoIGZpbGw9IiMzNEE4NTMiIGQ9Im0wIDM3IDMwLTIzIDcuOSAxTDQ4IDB2NDhIMHoiIGNsaXAtcGF0aD0idXJsKCNiKSIvPjxwYXRoIGZpbGw9IiM0Mjg1RjQiIGQ9Ik00OCA0OCAxNyAyNGwtNC0zIDM1LTEweiIgY2xpcC1wYXRoPSJ1cmwoI2IpIi8+PC9zdmc+"
        },
        "displayName": "Embeddings Google Gemini",
        "typeVersion": 1,
        "nodeCategories": [
          {
            "id": 25,
            "name": "AI"
          },
          {
            "id": 26,
            "name": "Langchain"
          }
        ]
      },
      {
        "id": 1262,
        "icon": "file:google.svg",
        "name": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
        "codex": {
          "data": {
            "resources": {
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatgooglegemini/"
                }
              ]
            },
            "categories": [
              "AI",
              "Langchain"
            ],
            "subcategories": {
              "AI": [
                "Language Models",
                "Root Nodes"
              ],
              "Language Models": [
                "Chat Models (Recommended)"
              ]
            }
          }
        },
        "group": "[\"transform\"]",
        "defaults": {
          "name": "Google Gemini Chat Model"
        },
        "iconData": {
          "type": "file",
          "fileBuffer": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNDggNDgiPjxkZWZzPjxwYXRoIGlkPSJhIiBkPSJNNDQuNSAyMEgyNHY4LjVoMTEuOEMzNC43IDMzLjkgMzAuMSAzNyAyNCAzN2MtNy4yIDAtMTMtNS44LTEzLTEzczUuOC0xMyAxMy0xM2MzLjEgMCA1LjkgMS4xIDguMSAyLjlsNi40LTYuNEMzNC42IDQuMSAyOS42IDIgMjQgMiAxMS44IDIgMiAxMS44IDIgMjRzOS44IDIyIDIyIDIyYzExIDAgMjEtOCAyMS0yMiAwLTEuMy0uMi0yLjctLjUtNCIvPjwvZGVmcz48Y2xpcFBhdGggaWQ9ImIiPjx1c2UgeGxpbms6aHJlZj0iI2EiIG92ZXJmbG93PSJ2aXNpYmxlIi8+PC9jbGlwUGF0aD48cGF0aCBmaWxsPSIjRkJCQzA1IiBkPSJNMCAzN1YxMWwxNyAxM3oiIGNsaXAtcGF0aD0idXJsKCNiKSIvPjxwYXRoIGZpbGw9IiNFQTQzMzUiIGQ9Im0wIDExIDE3IDEzIDctNi4xTDQ4IDE0VjBIMHoiIGNsaXAtcGF0aD0idXJsKCNiKSIvPjxwYXRoIGZpbGw9IiMzNEE4NTMiIGQ9Im0wIDM3IDMwLTIzIDcuOSAxTDQ4IDB2NDhIMHoiIGNsaXAtcGF0aD0idXJsKCNiKSIvPjxwYXRoIGZpbGw9IiM0Mjg1RjQiIGQ9Ik00OCA0OCAxNyAyNGwtNC0zIDM1LTEweiIgY2xpcC1wYXRoPSJ1cmwoI2IpIi8+PC9zdmc+"
        },
        "displayName": "Google Gemini Chat Model",
        "typeVersion": 1,
        "nodeCategories": [
          {
            "id": 25,
            "name": "AI"
          },
          {
            "id": 26,
            "name": "Langchain"
          }
        ]
      }
    ],
    "categories": [
      {
        "id": 42,
        "name": "Internal Wiki"
      },
      {
        "id": 48,
        "name": "AI RAG"
      }
    ],
    "image": []
  }
}