{
  "name": "chat rag webUI",
  "nodes": [
    {
      "parameters": {
        "content": "## Agente RAG\nUn agente RAG (Retrieval Augmented Generation) Generaci\u00f3n aumentada por recuperaci\u00f3n, combina la capacidad de generaci\u00f3n de los LLM's con la capacidad de recuperaci\u00f3n de informaci\u00f3n relevante de fuentes especializadas.\n\nMinimiza las alucinaciones.\n\nConexi\u00f3n a base de dato vectorial con informaci\u00f3n que sempre est\u00e1 actualizada.",
        "height": 220
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -380,
        0
      ],
      "id": "7b94caf3-b0ab-4b13-80ec-6b80143cdc69",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.body.chatInput }}",
        "options": {
          "systemMessage": "Eres un asistente personal. Tu funcion es identificar que es lo que quiere buscar el usuario referente a Genexus, y documentacion de la empresa en Pinecone Vector Store. Responde de forma concreta, s\u00f3lo referente a la informaci\u00f3n que consultas en pinecone. En tu respuesta, Siempre coloca como referencia la fuente de datos del documento."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        260,
        0
      ],
      "id": "d51d056d-cec8-427a-940e-1f5fb977eaa7",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        180,
        180
      ],
      "id": "5a7a12e8-ff12-47ee-a1e5-b70f67722585",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.body.chat_id }}",
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "typeVersion": 1.3,
      "position": [
        320,
        180
      ],
      "id": "b543718d-3986-49d4-a1aa-b1f2242a91f7",
      "name": "Postgres Chat Memory",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolName": "rag",
        "toolDescription": "={{ $json.chatInput }}",
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "topK": 10,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.1,
      "position": [
        440,
        180
      ],
      "id": "47c485f0-7795-47a4-a653-a57f8656edb8",
      "name": "Supabase Vector Store",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        420,
        340
      ],
      "id": "43bbed3e-badb-4639-8dca-5afedc6b38ca",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "f2a5f950-ae9f-4d8b-b16e-96f358e74a2d",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        60,
        0
      ],
      "id": "036320f4-eba7-454b-a4ec-88dc6e1cd073",
      "name": "Webhook"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        600,
        0
      ],
      "id": "f9d85fd2-4773-4b3b-b58e-9c977b952e27",
      "name": "Respond to Webhook1"
    }
  ],
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Respond to Webhook1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "39918f3c-1d8c-4491-8458-599f87fb50c1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "Z2ovMZ93y7O7Ms1X",
  "tags": []
}