{
  "name": "V3_RAG_Chatbot_Copy",
  "nodes": [
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.id }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -1460,
        -200
      ],
      "id": "eb0e7008-bfe1-43da-9cd7-b1ede67fa518",
      "name": "Download file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "insert",
        "pineconeIndex": {
          "__rl": true,
          "value": "n8nrag",
          "mode": "list",
          "cachedResultName": "n8nrag"
        },
        "embeddingBatchSize": 2,
        "options": {
          "pineconeNamespace": "Apple"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1.3,
      "position": [
        -1260,
        -200
      ],
      "id": "58343ce1-96fe-4a05-bb27-582a6e3a8b1e",
      "name": "Pinecone Vector Store",
      "credentials": {
        "pineconeApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        -1320,
        20
      ],
      "id": "52c9797e-de0d-49de-877a-43b04f56c3ed",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "dataType": "binary",
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "Apple_Report",
                "value": "={{ $json.name }}"
              }
            ]
          }
        }
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        -1060,
        0
      ],
      "id": "25602cd7-882f-4b11-9bd7-caf2644d8b0e",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "content": "# Knowledge Base\n",
        "height": 540,
        "width": 860
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1700,
        -360
      ],
      "id": "22aa6bfd-d7cd-4e55-b987-c8aa7219ca4d",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "# RAG Chatbot\n",
        "height": 940,
        "width": 920
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -820,
        -360
      ],
      "id": "ac19a812-8766-470c-98c3-f74b7dfa8783",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "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 relevant Q1 reports.\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 whether the information is sourced from Q1 or Q2.\n\nDeliver quick, reliable insights into Apple\u2019s quarterly financials without adding unnecessary details."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        -560,
        -220
      ],
      "id": "cb1e6adf-bff8-4889-a2db-352eca4dac4a",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -740,
        20
      ],
      "id": "178d4df9-ab6b-4f9b-8c1f-1522b0cf57d1",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "contextWindowLength": 50
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -540,
        20
      ],
      "id": "47f4fb52-5504-408a-a741-3f40c06d3696",
      "name": "Simple Memory"
    },
    {
      "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": [
        -380,
        40
      ],
      "id": "32f5ef5f-84cc-4a0d-8cb8-bb3eb85f4454",
      "name": "Answer questions with a vector store"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -760,
        -220
      ],
      "id": "3cd669e6-76e3-4e9d-be6b-6208476f2bad",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "pineconeIndex": {
          "__rl": true,
          "value": "n8nrag",
          "mode": "list",
          "cachedResultName": "n8nrag"
        },
        "options": {
          "pineconeNamespace": "Apple"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1.3,
      "position": [
        -560,
        200
      ],
      "id": "999ff4e2-0785-4540-8eb1-a897f1422e4c",
      "name": "Pinecone Vector Store1",
      "credentials": {
        "pineconeApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "value": "13aIW31qxgfPeoKJqyHAUi6nS3V5fJEZp",
          "mode": "list",
          "cachedResultName": "Apple",
          "cachedResultUrl": "https://drive.google.com/drive/folders/13aIW31qxgfPeoKJqyHAUi6nS3V5fJEZp"
        },
        "event": "fileCreated",
        "options": {}
      },
      "type": "n8n-nodes-base.googleDriveTrigger",
      "typeVersion": 1,
      "position": [
        -1640,
        -200
      ],
      "id": "32b21692-fbd1-4fad-bee4-0fb45788501a",
      "name": "Google Drive Trigger",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        -620,
        320
      ],
      "id": "2eb4c82b-f681-4052-a5de-845c60d21066",
      "name": "Embeddings OpenAI1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -180,
        220
      ],
      "id": "a66b8365-dcfa-4b69-9dec-ff98140c2e2f",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Download file": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Answer questions with a vector store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store1": {
      "ai_vectorStore": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "main": [
        []
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "saveDataErrorExecution": "all",
    "saveDataSuccessExecution": "all",
    "saveExecutionProgress": true,
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner"
  },
  "versionId": "50bbe0bb-cfd0-4851-9697-070586782e97",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "3GuxBOOeptaUJWSg",
  "tags": []
}