{
  "name": "Consulta",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "54ec9a8e-7675-45b5-ba15-e4d497edbac1",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -368,
        16
      ],
      "id": "e4b9e6a0-e968-431a-86e8-6bcd9fc66dea",
      "name": "Webhook"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.body.chatInput }}",
        "options": {
          "systemMessage": "You are a helpful assistant with access to a semantic knowledge base. \n\nFor every user question, first search the knowledge base using the available vector database tool. \n\nUse the retrieved documents as the primary source of truth. \n\nOnly answer from your own knowledge if the tool returns no relevant information. \n\nWhen answering, base your response on the retrieved documents."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        -64,
        16
      ],
      "id": "e945cda7-8be6-47c4-bda5-efb26ee6de05",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": "qwen2.5:latest",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        -64,
        208
      ],
      "id": "a49d6f5c-27fe-4635-89df-0caac4cf73e1",
      "name": "Ollama Chat Model",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.body.user_id }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.4,
      "position": [
        64,
        288
      ],
      "id": "6ab9499f-d52b-497d-8efd-f631dca5a638",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "MANDATORY TOOL.\n\nUse this tool FIRST for every user question.\n\nThis tool contains the complete knowledge base and documentation.\n\nBefore answering any question, search this tool.\n\nDo not answer from your own knowledge until you have searched this tool.\n\nIf information is found, base the answer only on the retrieved documents.",
        "qdrantCollection": {
          "__rl": true,
          "value": "test",
          "mode": "list",
          "cachedResultName": "test"
        },
        "topK": 10,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "typeVersion": 1.3,
      "position": [
        240,
        272
      ],
      "id": "5b6c7eab-f8aa-4159-aced-163daf80d620",
      "name": "Qdrant Vector Store",
      "credentials": {
        "qdrantApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "typeVersion": 1,
      "position": [
        224,
        448
      ],
      "id": "c2736ff9-35a0-41ec-a387-e3048cd6e182",
      "name": "Embeddings Ollama",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        384,
        16
      ],
      "id": "804db889-ef77-4b4f-affe-d9a760fde1be",
      "name": "Respond to Webhook"
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Ollama": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "aa8b8710-c306-49dc-bc47-9b2af6405e26",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodeGroups": [],
  "id": "Mg7HOJvWqtcdBkPU",
  "tags": []
}