{
  "name": "Survey insights with Qdrant, Python and Information Extractor",
  "nodes": [
    {
      "id": "0404384b-10b6-4666-84a4-8870db30c607",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1220,
        280
      ]
    },
    {
      "id": "a6741f04-5a5b-47a9-ac08-eb562f9f6052",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1340,
        280
      ]
    },
    {
      "id": "7663c3dd-f713-4034-bef6-0c000285f54f",
      "name": "Convert to Question Answer Pairs",
      "type": "n8n-nodes-base.set",
      "position": [
        720,
        160
      ]
    },
    {
      "id": "84873f0c-81ce-442f-a33c-d7c6c2efa11b",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1340,
        420
      ]
    },
    {
      "id": "da9a8ee8-5e3f-49db-8d1f-26a61ca82344",
      "name": "Get Survey Results",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        540,
        160
      ]
    },
    {
      "id": "4bad90b2-eefe-49c8-8caa-41cd4cb5e60f",
      "name": "Get Survey Headers",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        740,
        940
      ]
    },
    {
      "id": "47c64994-9d1f-42ca-a849-3eeab5335b66",
      "name": "Extract Questions",
      "type": "n8n-nodes-base.set",
      "position": [
        940,
        940
      ]
    },
    {
      "id": "c237d523-b290-41ca-b323-4cc7c7f6ff37",
      "name": "Questions to List",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        940,
        1120
      ]
    },
    {
      "id": "7f44a770-4c5d-4404-ae95-d9dee8348380",
      "name": "Find All Answers",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1460,
        1120
      ]
    },
    {
      "id": "2b6dc317-f8f3-4201-a9e1-d35ee578e79e",
      "name": "Get Payload of Points",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2380,
        800
      ]
    },
    {
      "id": "d4a37d97-975a-4243-a7ea-81b3e30558a5",
      "name": "Clusters To List",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2180,
        800
      ]
    },
    {
      "id": "c78f1bf6-8390-48ee-88f4-7d1a893a8ade",
      "name": "Set Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        200,
        1060
      ]
    },
    {
      "id": "fbb1f3c3-06ad-44b5-b020-6fc3c8eda7c4",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2560,
        980
      ]
    },
    {
      "id": "83d3b413-a661-4c4c-9b8d-6ee395a15348",
      "name": "Prep Output For Export",
      "type": "n8n-nodes-base.set",
      "position": [
        3160,
        1300
      ]
    },
    {
      "id": "14784dff-a8ea-4b6b-8379-b0c9051a8f98",
      "name": "Export To Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3360,
        1300
      ]
    },
    {
      "id": "779b9411-db3e-44f3-ad2a-c9d40a70580d",
      "name": "Export To Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2360,
        1300
      ]
    },
    {
      "id": "a31ab677-f57c-4b78-a290-d4a913ed4f8e",
      "name": "For Each Question...",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1280,
        940
      ]
    },
    {
      "id": "dcfaf927-6ecd-4ebe-aee0-5fb3367b2725",
      "name": "Trigger Insights",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        1980,
        160
      ]
    },
    {
      "id": "2579adf0-9c00-4b87-b53e-740044577ab0",
      "name": "Prep Values For Trigger",
      "type": "n8n-nodes-base.set",
      "position": [
        1800,
        160
      ]
    },
    {
      "id": "9b29e850-b9d0-4358-af62-92c20ab3b088",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        20,
        900
      ]
    },
    {
      "id": "70a0dcec-9f74-4af2-bd64-0ab762a77e51",
      "name": "Create Insights Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        420,
        900
      ]
    },
    {
      "id": "f31400fb-dd7a-4c62-90ec-e9d78bbaa5e8",
      "name": "Prep Values For Export",
      "type": "n8n-nodes-base.set",
      "position": [
        2180,
        1300
      ]
    },
    {
      "id": "506c20df-5109-422c-8c9e-0eb50fbd3ff9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        459.27570452141345,
        -42.168106366729035
      ],
      "parameters": {
        "width": 617.2130261221611,
        "height": 420.7389587470384,
        "content": "## Step 1. Import Survey Responses\n[Read more about Google Sheets](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets)\n\nOur approach requires to import all participant resp"
      }
    },
    {
      "id": "bddcafa8-6f54-4829-93c9-37bbb9e7edf3",
      "name": "QA Pairs to List",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        900,
        160
      ]
    },
    {
      "id": "8d6e6bf6-c94c-43cb-a29e-5d10207cb8bd",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        -102.05898437632061
      ],
      "parameters": {
        "width": 563.8350682199533,
        "height": 678.1641960508446,
        "content": "## Step 2. Vectorize Each Response Into Qdrant\n[Read more about using Qdrant](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreqdrant)\n\nSpecial attentio"
      }
    },
    {
      "id": "613d4a32-a87a-423e-a1d1-ee23db0de6d1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        -30.440883940004255
      ],
      "parameters": {
        "width": 519.6419932444072,
        "height": 429.11782776909047,
        "content": "## Step 3. Trigger Insights SubWorkflow\n[Learn more about Workflow Triggers](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executeworkflow)\n\nA subworkflow is used to trigger the a"
      }
    },
    {
      "id": "1e858e4a-b91b-4411-8e2a-6eb76647b796",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -57.47778952966382,
        710.393394209128
      ],
      "parameters": {
        "width": 668.3083616841852,
        "height": 528.2386658883073,
        "content": "## Step 4. Create Insights Sheet\n[Learn more about Workflow Triggers](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executeworkflowtrigger)\n\nTo capture the generated insights, we'"
      }
    },
    {
      "id": "9170c566-07d3-49dc-aafb-2dbe79940d2c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        683.5153164275844
      ],
      "parameters": {
        "width": 536.9288458983389,
        "height": 622.1362463986454,
        "content": "## Step 5. Get List Of Questions From Survey\n[Read more about using Google Sheets](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets)\n\nNext we'll fetch the survey for meta"
      }
    },
    {
      "id": "8488df77-055d-41cc-94f1-92ac5d54ef10",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        673.291535602609
      ],
      "parameters": {
        "width": 823.147012265536,
        "height": 868.2579789328703,
        "content": "## Step 6. Find Groups of Similar Answers For Each Question\n[Learn more about using the Code Node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code/)\n\nGiving all the responses t"
      }
    },
    {
      "id": "f4748b6d-5bd8-48cf-942f-3a0dc681078d",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2060,
        1180
      ],
      "parameters": {
        "width": 536.9288458983389,
        "height": 359.90385684071794,
        "content": "## Step 7b. Skip If No Clusters Found\nWhere no clusters were found, it means the answers were unique enough to not show any pattern. eg. \"What's you name?\""
      }
    },
    {
      "id": "d55d6a47-da8c-46ae-bd10-0eb671dcd121",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2060,
        611.6915003841909
      ],
      "parameters": {
        "width": 871.451300407926,
        "height": 541.1135860445843,
        "content": "## Step 7a. Summarise the Top Groups of Similar Answers\n[Read more about using the Information Extractor Node](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.inf"
      }
    },
    {
      "id": "e5d5f88f-5832-43fc-a5b9-f747d08e7e77",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2620,
        1180
      ],
      "parameters": {
        "width": 924.2798021207429,
        "height": 363.07347551845976,
        "content": "## Step 8. Write To Insights Sheet\nFinally, our completed insights to appended to\nthe Insights Sheet we created earlier in the workflow."
      }
    },
    {
      "id": "49ac1504-7b43-4fa1-b4ce-15c7a53c9018",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        400
      ],
      "parameters": {
        "width": 323.2987132716669,
        "height": 80,
        "content": "### Run this once! \nIf for any reason you need to run more than once, be sure to clear the existing data first."
      }
    },
    {
      "id": "450f89c5-ef0f-4bf8-8db9-6347247c7f4d",
      "name": "Has Clusters?",
      "type": "n8n-nodes-base.if",
      "position": [
        1820,
        1120
      ]
    },
    {
      "id": "1652a108-8fb8-4229-a76d-abf9fbcff626",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        -400
      ],
      "parameters": {
        "width": 400.381109509268,
        "height": 679.5610243514676,
        "content": "## Try It Out!\n\n### This workflow generates highly-detailed insights from survey responses. Works best when dealing with a large number of participants.\n\n* Import survey responses and vectorise in Qdr"
      }
    },
    {
      "id": "6eef981e-b2ce-433c-b71f-78be64812a56",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1260,
        1340
      ],
      "parameters": {
        "width": 323.2987132716669,
        "height": 110.05160146874424,
        "content": "### First Time Running?\nThere is a slight delay on first run because the code node has to download the required packages."
      }
    },
    {
      "id": "fa0c14be-03f4-4ed2-bd60-e93817382ded",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        240,
        100
      ]
    },
    {
      "id": "30323019-59ba-4a19-a46e-196d469f097d",
      "name": "Get Sheet Details",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        200,
        900
      ]
    },
    {
      "id": "6ced8012-1dd3-4da3-8c27-e4f4dfc959f6",
      "name": "Only Clusters With 3+ points",
      "type": "n8n-nodes-base.filter",
      "position": [
        2180,
        960
      ]
    },
    {
      "id": "8ae81a55-75e2-40a3-bef6-0935ff08128f",
      "name": "Apply K-means Clustering Algorithm",
      "type": "n8n-nodes-base.code",
      "position": [
        1640,
        1120
      ]
    },
    {
      "id": "cbb42384-d46b-471f-a7d8-27e3de042492",
      "name": "Qdrant Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        1220,
        100
      ]
    },
    {
      "id": "17584901-15d6-421f-ad69-3ba872276055",
      "name": "Survey Insights Agent",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        2580,
        800
      ]
    }
  ],
  "connections": {
    "Has Clusters?": {
      "main": [
        [
          {
            "node": "Clusters To List",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prep Values For Export",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Variables": {
      "main": [
        [
          {
            "node": "Create Insights Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clusters To List": {
      "main": [
        [
          {
            "node": "Only Clusters With 3+ points",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Export To Sheets": {
      "main": [
        [
          {
            "node": "For Each Question...",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find All Answers": {
      "main": [
        [
          {
            "node": "Apply K-means Clustering Algorithm",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "QA Pairs to List": {
      "main": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Export To Sheets1": {
      "main": [
        [
          {
            "node": "For Each Question...",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Questions": {
      "main": [
        [
          {
            "node": "Questions to List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Sheet Details": {
      "main": [
        [
          {
            "node": "Set Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Survey Insights Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Questions to List": {
      "main": [
        [
          {
            "node": "For Each Question...",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Survey Headers": {
      "main": [
        [
          {
            "node": "Extract Questions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Survey Results": {
      "main": [
        [
          {
            "node": "Convert to Question Answer Pairs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store": {
      "main": [
        [
          {
            "node": "Prep Values For Trigger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "For Each Question...": {
      "main": [
        null,
        [
          {
            "node": "Find All Answers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Insights Sheet": {
      "main": [
        [
          {
            "node": "Get Survey Headers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Payload of Points": {
      "main": [
        [
          {
            "node": "Survey Insights Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Survey Insights Agent": {
      "main": [
        [
          {
            "node": "Prep Output For Export",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prep Output For Export": {
      "main": [
        [
          {
            "node": "Export To Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prep Values For Export": {
      "main": [
        [
          {
            "node": "Export To Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prep Values For Trigger": {
      "main": [
        [
          {
            "node": "Trigger Insights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Get Sheet Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only Clusters With 3+ points": {
      "main": [
        [
          {
            "node": "Get Payload of Points",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to Question Answer Pairs": {
      "main": [
        [
          {
            "node": "QA Pairs to List",
            "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 Survey Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apply K-means Clustering Algorithm": {
      "main": [
        [
          {
            "node": "Has Clusters?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}