{
  "name": "RAG Agent Part-2 ( Retrieval -> Augmented -> Generation )",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        -240,
        -16
      ],
      "id": "0d476574-3a73-413d-9cf6-ff329c94516b",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        -32,
        -16
      ],
      "id": "1b85045e-1d5a-4d87-a679-470c347e8067",
      "name": "AI Agent"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.4,
      "position": [
        -64,
        224
      ],
      "id": "a3f1f486-2e6e-40b4-b53e-ed9f3ab1b75a",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "description": "Data includes a resume, project-related information, and frequently asked interview questions."
      },
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "typeVersion": 1.1,
      "position": [
        128,
        192
      ],
      "id": "8e6bd89b-8f55-4cdd-9550-cc163a9c4f79",
      "name": "Answer questions with a vector store"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "gpt-4o-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        352,
        400
      ],
      "id": "e121a7cd-da3e-4b3a-932c-89e7983002e3",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "pineconeIndex": {
          "__rl": true,
          "value": "resume-projects-docs",
          "mode": "list",
          "cachedResultName": "resume-projects-docs"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1.3,
      "position": [
        -16,
        400
      ],
      "id": "b06a8b86-4b04-4b0e-bc65-d5e894047e7e",
      "name": "Pinecone Vector Store",
      "credentials": {
        "pineconeApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        -16,
        544
      ],
      "id": "2ba08714-5004-4a71-94b5-8f018c2f7dd2",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        -240,
        224
      ],
      "id": "5e4f309e-d110-4830-86cd-826583ed38aa",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "Learning (RAG Flow): \n\nUser Query: The process begins when a user submits a query.\n\nQuery Embedding: The query is sent to an Embedding API, which converts it into an embedding.\n\nSemantic Search: A semantic search is performed by comparing the query embedding with the embeddings stored in the vector store (e.g., ChromaDb, Faiss, Pinecone).\n\nRetrieve Ranked Results: The system retrieves ranked results based on similarity, with the number of results determined by the \"top K\" setting.\n\nContext for LLM: These ranked document chunks become the context provided to the Large Language Model (LLM).\n\nGenerate Answer: The LLM processes the context and query to generate a final answer for the user.\n",
        "height": 480,
        "width": 480,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        0
      ],
      "typeVersion": 1,
      "id": "3343c27a-778e-4b8d-bb64-e6fa857e3925",
      "name": "Sticky Note"
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "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
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "ai_vectorStore": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "staticData": null,
  "triggerCount": 0,
  "meta": {
    "templateCredsSetupCompleted": true
  }
}