{
  "name": "INM_clase_2_flujo_2_raiway",
  "nodes": [
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "\"Eres el HR Buddy, asistente virtual de RR. HH. de ChocolaTech.\nREGLAS:\n\nResponde siempre en espa\u00f1ol.\nResponde SOLO dudas relacionadas con RR. HH.\nIDENTIFICACI\u00d3N DEL EMPLEADO:\nSi el usuario no dice qui\u00e9n es, preg\u00fantale su nombre completo en la primera respuesta.\nUsa la herramienta MySQL para buscar en la tabla funcionarios usando SIEMPRE el NOMBRE COMPLETO informado por el usuario en la conversaci\u00f3n.\nSi se encuentra: usa los saldos de vacaciones y banco de horas.\nSi no se encuentra: no inventes datos personales. Responde solo con base en las pol\u00edticas generales de RR. HH. del Vector Store.\nUsa la base de conocimientos para dudas generales.\""
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        576,
        0
      ],
      "id": "61e9a43e-85c7-4b84-9b6c-b733136e8c77",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatCohere",
      "typeVersion": 1,
      "position": [
        416,
        224
      ],
      "id": "71149e49-5e1f-4169-ba8d-e94eb1822629",
      "name": "Cohere Chat Model",
      "credentials": {
        "cohereApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.message.from.id }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.4,
      "position": [
        544,
        224
      ],
      "id": "bfbd01c0-6856-4549-91a1-67a2b9afafc7",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "Buscar informacion sobre RH, asuntos con vacaciones, horarios, etc.",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.3,
      "position": [
        672,
        224
      ],
      "id": "0f44932f-ca58-4270-b69d-9ce134534364",
      "name": "Simple Vector Store"
    },
    {
      "parameters": {
        "modelName": "embed-multilingual-v3.0"
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsCohere",
      "typeVersion": 1,
      "position": [
        752,
        432
      ],
      "id": "b0f46d18-62d6-4e21-a2fe-ccfa850558ba",
      "name": "Embeddings Cohere",
      "credentials": {
        "cohereApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "select",
        "table": {
          "__rl": true,
          "value": "empleados",
          "mode": "list",
          "cachedResultName": "empleados"
        },
        "where": {
          "values": [
            {
              "column": "nombre",
              "condition": "LIKE",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('values0_Value', `Usa siempre el formato %nombre% para busqueda parcial. por ejemplo : %Eric Monn\u00e9%`, 'string') }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.mySqlTool",
      "typeVersion": 2.5,
      "position": [
        960,
        224
      ],
      "id": "9cea5e79-10a0-48c3-a190-df413c37c5c1",
      "name": "Select rows from a table in MySQL",
      "credentials": {
        "mySql": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.3,
      "position": [
        192,
        0
      ],
      "id": "ad17a949-f56d-4b84-8268-8c69a92077d8",
      "name": "Telegram Trigger",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1168,
        0
      ],
      "id": "e70b9308-bdb7-40fc-abe0-733073fc5f51",
      "name": "Send a text message",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Cohere Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Simple Vector Store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Cohere": {
      "ai_embedding": [
        [
          {
            "node": "Simple Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Select rows from a table in MySQL": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "7ac6ebb1-d2a6-4fb2-9f5e-58f7dd362a9b",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "f08VqEKE3qNJ8FZa",
  "tags": []
}