{
  "updatedAt": "2026-07-18T12:06:12.201Z",
  "createdAt": "2026-07-06T18:36:34.367Z",
  "id": "Wc9PIqfsQdkxvp5S",
  "name": "Apple RAG Chatbot V2",
  "description": null,
  "active": true,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.id }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -1056,
        176
      ],
      "id": "4583656c-f788-4e95-bab1-42ed4eb47827",
      "name": "Download file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "dataType": "binary",
        "loader": "pdfLoader",
        "textSplittingMode": "custom",
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "Apple_Report",
                "value": "={{ $json.name }}"
              }
            ]
          }
        }
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        -384,
        416
      ],
      "id": "a55d60c5-d6b4-4569-85dc-e07ee9e5374f",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "content": "# Knowledge Base\n",
        "height": 636,
        "width": 1372,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1472,
        96
      ],
      "id": "d04a382a-7a4c-406d-a97f-ed34a3b1823e",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "# RAG Chatbot\n",
        "height": 748,
        "width": 968,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -48,
        64
      ],
      "id": "d4e74cfd-4018-4f97-935f-1084f1e97b69",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('When chat message received').item.json.chatInput }}",
        "options": {
          "systemMessage": "=You are an AI assistant specialized in analyzing Apple\u2019s quarterly financial reports. Your main goal is to answer questions accurately and precisely using the vector database, which contains quarterly financial reports (Q1, Q2, Q3, and Q4).\n\nProvide only information that comes directly from these reports or verified data. If the requested information is missing or unclear, explicitly state that there is insufficient data.\n\nKeep responses concise and to the point. Include specific numbers and facts whenever possible, and clearly indicate which quarter (Q1, Q2, Q3, or Q4) and fiscal year the information is sourced from.\n\nDeliver quick, reliable insights into Apple\u2019s quarterly financials without adding unnecessary details."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        384,
        144
      ],
      "id": "3ffa7b3a-6636-478a-9c2e-2e80a6a006f7",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "description": "Returns documents related to Apple Q1 report, including financials, outlook, margins, and all key details from the earnings reports.",
        "topK": "=10"
      },
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "typeVersion": 1.1,
      "position": [
        608,
        368
      ],
      "id": "8d507096-2a7f-46da-85ec-5d2a7e7b4268",
      "name": "Answer questions with a vector store"
    },
    {
      "parameters": {
        "public": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        144
      ],
      "id": "389ebf1c-4ed3-45da-abce-a93c215c9aee",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "value": "1kiyeVdh-lP45tH8uV-_8hpPVQc1DR_NK",
          "mode": "list",
          "cachedResultName": "Apple",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1kiyeVdh-lP45tH8uV-_8hpPVQc1DR_NK"
        },
        "event": "fileCreated",
        "options": {}
      },
      "type": "n8n-nodes-base.googleDriveTrigger",
      "typeVersion": 1,
      "position": [
        -1424,
        176
      ],
      "id": "53b00d9f-0a86-4643-aaa2-f16f0dc89fc3",
      "name": "Google Drive Trigger",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -1424,
        352
      ],
      "id": "0c9995e3-4cdc-47d2-8569-a33807e057f7",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "resource": "fileFolder",
        "filter": {
          "folderId": {
            "__rl": true,
            "value": "1kiyeVdh-lP45tH8uV-_8hpPVQc1DR_NK",
            "mode": "list",
            "cachedResultName": "Apple",
            "cachedResultUrl": "https://drive.google.com/drive/folders/1kiyeVdh-lP45tH8uV-_8hpPVQc1DR_NK"
          }
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -1232,
        352
      ],
      "id": "ed28ebb6-569e-4e53-9d2f-b24724f78522",
      "name": "Search files and folders",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.File_ID }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -848,
        352
      ],
      "id": "19eb87ac-130f-45c7-a75c-7e85a8e6e9ca",
      "name": "Download file1",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        -704,
        176
      ],
      "id": "f0fb0a74-3f85-44fd-9d28-e12bea739713",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        -432,
        576
      ],
      "id": "e8e7d2c1-8a65-4659-aad2-54bd01f470c8",
      "name": "Recursive Character Text Splitter"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "dda116d7-f64b-48b8-9f22-fb35eb43c245",
              "name": "File_Name",
              "value": "={{ $json.name }}",
              "type": "string"
            },
            {
              "id": "3562a21f-d55f-4191-8f7a-cebb23c1da3b",
              "name": "File_ID",
              "value": "={{ $json.id }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -1024,
        352
      ],
      "id": "f6ec22cb-795b-422b-9800-4f21633f80ea",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c183a9f9-0bbd-40e4-ac35-b5111e3ec1ae",
              "name": "File_Name",
              "value": "={{$json[\"chatInput\"].match(/Q[1-4]/i) ? ($json[\"chatInput\"].match(/Q[1-4]/i)[0].toUpperCase() + \".pdf\").trim() : \"\"}}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        176,
        144
      ],
      "id": "3b4789b3-bb21-4ae7-a5a7-2ae9f4d43aa5",
      "name": "Edit Fields1"
    },
    {
      "parameters": {
        "mode": "insert",
        "qdrantCollection": {
          "__rl": true,
          "value": "n8n-rag",
          "mode": "list",
          "cachedResultName": "n8n-rag"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "typeVersion": 1.3,
      "position": [
        -464,
        192
      ],
      "id": "45d4be8b-8eb7-419b-b5d8-988cc834e3cf",
      "name": "Qdrant Vector Store",
      "credentials": {
        "qdrantApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "typeVersion": 1,
      "position": [
        -576,
        416
      ],
      "id": "ce2f7149-2c12-44e0-9367-8facd488b36c",
      "name": "Embeddings Ollama",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "qdrantCollection": {
          "__rl": true,
          "value": "n8n-rag",
          "mode": "list",
          "cachedResultName": "n8n-rag"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "typeVersion": 1.3,
      "position": [
        368,
        544
      ],
      "id": "384a1fd8-fb63-4f8e-8fea-d4c005efb6e0",
      "name": "Qdrant Vector Store1",
      "credentials": {
        "qdrantApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "typeVersion": 1.4,
      "position": [
        416,
        352
      ],
      "id": "fe69af40-1c33-4634-97c8-e2a1afe5f11f",
      "name": "Postgres Chat Memory",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "qwen2.5:3b-4k",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmOllama",
      "typeVersion": 1,
      "position": [
        672,
        576
      ],
      "id": "299553c9-a12b-4417-98c0-dd3a42fd8f48",
      "name": "Ollama Model",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "llama3.2:3b-4k",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        272,
        352
      ],
      "id": "1477ecc6-db01-4203-80e3-3eb41de7c2cd",
      "name": "Ollama Chat Model",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "typeVersion": 1,
      "position": [
        512,
        688
      ],
      "id": "d4ab4af3-e4c7-4560-81e9-38da1188211a",
      "name": "Embeddings Ollama1",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.timeSaved",
      "typeVersion": 1,
      "position": [
        736,
        144
      ],
      "id": "eacea496-b3ad-44ac-ab61-9ab58c5d16ea",
      "name": "Time Saved"
    }
  ],
  "connections": {
    "Download file": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Answer questions with a vector store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search files and folders": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          },
          {
            "node": "Qdrant Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Download file1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Ollama": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store1": {
      "ai_vectorStore": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Model": {
      "ai_languageModel": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Ollama1": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Time Saved",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": true,
    "timeSavedMode": "fixed",
    "timezone": "Africa/Cairo",
    "saveDataErrorExecution": "all",
    "saveDataSuccessExecution": "none",
    "saveExecutionProgress": true,
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner"
  },
  "staticData": {
    "node:Google Drive Trigger": {
      "lastTimeChecked": "2026-07-13T19:40:02Z"
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodeGroups": [],
  "versionId": "ede1cc2a-d0e1-414d-959b-08d34585cc33",
  "activeVersionId": "ede1cc2a-d0e1-414d-959b-08d34585cc33",
  "versionCounter": 76,
  "triggerCount": 2,
  "sourceWorkflowId": null,
  "tags": [
    {
      "updatedAt": "2026-07-05T20:54:10.312Z",
      "createdAt": "2026-07-05T20:54:10.312Z",
      "id": "YPOBiRLmef0fLiKM",
      "name": "RAG"
    },
    {
      "updatedAt": "2026-07-16T16:03:28.540Z",
      "createdAt": "2026-07-16T16:03:28.540Z",
      "id": "90acb56ef2f84a89",
      "name": "Event-Driven"
    },
    {
      "updatedAt": "2026-07-16T16:03:28.786Z",
      "createdAt": "2026-07-16T16:03:28.786Z",
      "id": "6e30f4ffb71d4b65",
      "name": "Data Pipeline"
    },
    {
      "updatedAt": "2026-07-16T16:03:29.020Z",
      "createdAt": "2026-07-16T16:03:29.020Z",
      "id": "9a8d1d753df54ed1",
      "name": "Production Automation"
    },
    {
      "updatedAt": "2026-07-16T16:03:28.284Z",
      "createdAt": "2026-07-16T16:03:28.284Z",
      "id": "e1c954be4bee474d",
      "name": "Data Transformation"
    },
    {
      "updatedAt": "2026-07-16T16:03:29.217Z",
      "createdAt": "2026-07-16T16:03:29.217Z",
      "id": "08f43634238e406b",
      "name": "Agentic AI"
    },
    {
      "updatedAt": "2026-07-16T16:03:28.033Z",
      "createdAt": "2026-07-16T16:03:28.033Z",
      "id": "07e54c18d20c43bb",
      "name": "Vector Storage"
    }
  ],
  "shared": [
    {
      "updatedAt": "2026-07-06T18:36:34.367Z",
      "createdAt": "2026-07-06T18:36:34.367Z",
      "role": "workflow:owner",
      "workflowId": "Wc9PIqfsQdkxvp5S",
      "projectId": "7Kuw5RaGwePDWMtJ",
      "project": {
        "updatedAt": "2026-06-09T16:37:14.049Z",
        "createdAt": "2026-06-09T16:15:53.210Z",
        "id": "7Kuw5RaGwePDWMtJ",
        "name": "Sohila Abbas <sohila.k.data@gmail.com>",
        "type": "personal",
        "icon": null,
        "description": null,
        "customTelemetryTags": [],
        "creatorId": "ef255f89-7c87-4d14-8714-7469755d5486"
      }
    }
  ],
  "versionMetadata": {
    "name": "Version ede1cc2a",
    "description": ""
  }
}