{
  "name": "Real-time email RAG assistant with Gmail, OpenAI GPT, and PGVector",
  "nodes": [
    {
      "id": "a896498a-dc44-4d77-8268-7f7001510974",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        740,
        340
      ]
    },
    {
      "id": "7fa7e6b4-ea5e-4716-be0e-58b96458ec0d",
      "name": "Get Mail Data",
      "type": "n8n-nodes-base.gmail",
      "position": [
        960,
        340
      ]
    },
    {
      "id": "bce4a290-a71c-4277-9381-3cf86867341e",
      "name": "Recursive Character Text Splitter2",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1460,
        700
      ]
    },
    {
      "id": "71ae9619-51ae-4c9a-8697-031725d037af",
      "name": "Embeddings OpenAI3",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1080,
        620
      ]
    },
    {
      "id": "9e7bd487-f657-4522-9f29-e937f604fff0",
      "name": "Enhanced Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1380,
        540
      ]
    },
    {
      "id": "251eaeab-ec58-48ad-b51c-556c739ba777",
      "name": "Postgres PGVector Store3",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "position": [
        1220,
        340
      ]
    },
    {
      "id": "c0930431-754d-4f87-bf44-6415a816aa7d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        120
      ],
      "parameters": {
        "width": 1200,
        "height": 740,
        "content": "## Watch Trigger (Email) - New Email\n## Get new Email -> Extract the text -> Add to Vector Store"
      }
    },
    {
      "id": "c6abb6a2-bc2a-4b2c-98c8-4de628c2776d",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -60,
        540
      ]
    },
    {
      "id": "fa5ca8d4-5997-4e77-8ab3-f0efe560042d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        120
      ],
      "parameters": {
        "width": 902,
        "height": 928,
        "content": "## RAG AI Agent\n\nThis powerful n8n workflow creates an intelligent email search and query system using RAG (Retrieval-Augmented Generation) technology. The system automatically ingests Gmail emails in"
      }
    },
    {
      "id": "99153412-5aa8-4ab0-918e-172802fc8590",
      "name": "New RAG Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        60,
        320
      ]
    },
    {
      "id": "00e80343-3f3c-4fed-93d9-213435012df7",
      "name": "Postgres PGVector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "position": [
        240,
        640
      ]
    },
    {
      "id": "2c39ec49-ac2b-42bc-b176-7f15a712c6b7",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        200,
        800
      ]
    },
    {
      "id": "e569097d-79b8-4648-86d5-67298c2a25d6",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -220,
        320
      ]
    }
  ],
  "connections": {
    "Get Mail Data": {
      "main": [
        [
          {
            "node": "Postgres PGVector Store3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Get Mail Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New RAG Agent": {
      "main": [
        []
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "New RAG Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI3": {
      "ai_embedding": [
        [
          {
            "node": "Postgres PGVector Store3",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Postgres PGVector Store": {
      "ai_tool": [
        [
          {
            "node": "New RAG Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "New RAG Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enhanced Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Postgres PGVector Store3",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter2": {
      "ai_textSplitter": [
        [
          {
            "node": "Enhanced Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  }
}