Vectorizando catalogo de productos de un E-commerce

Aplicando Vector Embeddings para potencias la búsqueda de productos por WhatsApp
GeraDeluxer

GeraDeluxer

Jun 28, 2025

Crea un archivo JSON, copias el contenido, después importar a n8n.

plaintext
1{ 2 "name": "eleganteflor", 3 "nodes": [ 4 { 5 "parameters": { 6 "promptType": "define", 7 "text": "={{ $json.message }}", 8 "options": { 9 "systemMessage": "# Rol\nActúa como un experto en atención al cliente de la Florería llamada EleganteFlor. Tu tarea es responder preguntas puntuales acerca de productos existentes.\n\n# instrucciones\nResponde amable y educadamente las preguntas del usuario.\n1. Empieza con un saludo y preguntando para que ocasión es el arreglo floral\n2. Después pregunta que tipo de flores prefiere la persona\n3. Haz 1-3 preguntas adicionales para entender las necesidades del cliente\n4. De la lista obtenida, recomienda 1-2 arreglos florales acompañado del nombre, precio y URL\n\n# tools\nUsa la herramienta flower_products únicamente para buscar existencia de productos.\nDeberás pasar únicamente el nombre del producto, ejemplo: \"ramo con 24 rosas\"\nCuando el usuario pregunte algo como \"ramos de 24 rosas\", transforma la frase de manera correcta como \"ramo con 24 rosas\"\n\nSi no hay disponibilidad, vuelve a usar la herramienta flower_products y ofrece alternativas\n\n# formato de respuesta\nResponde únicamente con el nombre, descripción, precio y la URL del producto.\nIMPORTANTE: No inventes o supongas informacion de productos, precios o url." 10 } 11 }, 12 "type": "@n8n/n8n-nodes-langchain.agent", 13 "typeVersion": 2, 14 "position": [ 15 -60, 16 -220 17 ], 18 "id": "254360f7-a5c5-4aeb-b040-daeadb34b447", 19 "name": "AI Agent" 20 }, 21 { 22 "parameters": { 23 "model": { 24 "__rl": true, 25 "value": "gpt-4o-mini", 26 "mode": "list", 27 "cachedResultName": "gpt-4o-mini" 28 }, 29 "options": {} 30 }, 31 "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", 32 "typeVersion": 1.2, 33 "position": [ 34 -120, 35 80 36 ], 37 "id": "b4ab4b01-9d5a-4a2a-960d-9ecc582d77c8", 38 "name": "OpenAI Chat Model", 39 "credentials": { 40 "openAiApi": { 41 "id": "yBVmUbUR8sO3ooOG", 42 "name": "OpenAi account" 43 } 44 } 45 }, 46 { 47 "parameters": { 48 "mode": "retrieve-as-tool", 49 "toolName": "flower_products", 50 "toolDescription": "Buscar disponibilidad de productos", 51 "mongoCollection": { 52 "__rl": true, 53 "value": "embedded_flowers_mxbai_1024", 54 "mode": "list", 55 "cachedResultName": "embedded_flowers_mxbai_1024" 56 }, 57 "vectorIndexName": "embedded_flowers_index_mxbai_1024", 58 "topK": 5, 59 "options": {} 60 }, 61 "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas", 62 "typeVersion": 1.1, 63 "position": [ 64 200, 65 60 66 ], 67 "id": "7b066489-414f-4665-94e6-7c64c9be7d4d", 68 "name": "MongoDB Atlas Vector Store", 69 "credentials": { 70 "mongoDb": { 71 "id": "fo01i5qwWuENcSVN", 72 "name": "EleganteFlor" 73 } 74 } 75 }, 76 { 77 "parameters": { 78 "modelName": "mixedbread-ai/mxbai-embed-large-v1", 79 "options": {} 80 }, 81 "type": "@n8n/n8n-nodes-langchain.embeddingsHuggingFaceInference", 82 "typeVersion": 1, 83 "position": [ 84 200, 85 200 86 ], 87 "id": "30a8ec80-452a-42a1-aafd-6b293aa0c6ef", 88 "name": "Embeddings HuggingFace Inference", 89 "credentials": { 90 "huggingFaceApi": { 91 "id": "h5Hnm5rS5OKpS5xE", 92 "name": "HuggingFaceApi account" 93 } 94 } 95 }, 96 { 97 "parameters": {}, 98 "type": "n8n-nodes-base.manualTrigger", 99 "typeVersion": 1, 100 "position": [ 101 -600, 102 -920 103 ], 104 "id": "323691ac-67ea-412f-bcfd-38b058711194", 105 "name": "When clicking ‘Execute workflow’", 106 "disabled": true 107 }, 108 { 109 "parameters": { 110 "operation": "download", 111 "fileId": { 112 "__rl": true, 113 "value": "1z_WUiiBwQfScdTUMNdhrOFvrWdckJmwUobsj4TkTAOs", 114 "mode": "list", 115 "cachedResultName": "Eleganteflor-productos-test", 116 "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1z_WUiiBwQfScdTUMNdhrOFvrWdckJmwUobsj4TkTAOs/edit?usp=drivesdk" 117 }, 118 "options": {} 119 }, 120 "type": "n8n-nodes-base.googleDrive", 121 "typeVersion": 3, 122 "position": [ 123 -380, 124 -920 125 ], 126 "id": "aecf515d-294f-41bb-b5f4-efe8dd7ff5f0", 127 "name": "Google Drive", 128 "credentials": { 129 "googleDriveOAuth2Api": { 130 "id": "WOra95J78MYPMgR5", 131 "name": "Google Drive account" 132 } 133 } 134 }, 135 { 136 "parameters": { 137 "operation": "xls", 138 "options": {} 139 }, 140 "type": "n8n-nodes-base.extractFromFile", 141 "typeVersion": 1, 142 "position": [ 143 -160, 144 -920 145 ], 146 "id": "bb0920c0-85b9-4d23-94c5-a9317a815f52", 147 "name": "Extract from File" 148 }, 149 { 150 "parameters": { 151 "modelName": "mixedbread-ai/mxbai-embed-large-v1", 152 "options": {} 153 }, 154 "type": "@n8n/n8n-nodes-langchain.embeddingsHuggingFaceInference", 155 "typeVersion": 1, 156 "position": [ 157 100, 158 -700 159 ], 160 "id": "c9b41438-028d-4885-9535-c9d0899bb10d", 161 "name": "Embeddings HuggingFace Inference1", 162 "credentials": { 163 "huggingFaceApi": { 164 "id": "UMuQ9FcD9S3Vares", 165 "name": "HuggingFaceApi account 2" 166 } 167 } 168 }, 169 { 170 "parameters": { 171 "mode": "insert", 172 "mongoCollection": { 173 "__rl": true, 174 "value": "embedded_flowers_mxbai_1024_1", 175 "mode": "name" 176 }, 177 "metadata_field": "=text", 178 "vectorIndexName": "embedded_flowers_index_mxbai_1024", 179 "embeddingBatchSize": 1, 180 "options": {} 181 }, 182 "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas", 183 "typeVersion": 1.1, 184 "position": [ 185 200, 186 -920 187 ], 188 "id": "90044635-90b6-460f-9611-19fa528e50fe", 189 "name": "MongoDB Atlas Vector Store1", 190 "credentials": { 191 "mongoDb": { 192 "id": "fo01i5qwWuENcSVN", 193 "name": "EleganteFlor" 194 } 195 } 196 }, 197 { 198 "parameters": { 199 "jsonMode": "expressionData", 200 "jsonData": "={{ $json.name }}", 201 "options": { 202 "metadata": { 203 "metadataValues": [ 204 { 205 "name": "name", 206 "value": "={{ $json.name }}" 207 }, 208 { 209 "name": "price", 210 "value": "={{ $json.price }}" 211 }, 212 { 213 "name": "url", 214 "value": "={{ $json.url }}" 215 } 216 ] 217 } 218 } 219 }, 220 "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader", 221 "typeVersion": 1, 222 "position": [ 223 260, 224 -700 225 ], 226 "id": "bd8d6490-61e9-4b64-9d46-a3582183e558", 227 "name": "Default Data Loader" 228 }, 229 { 230 "parameters": { 231 "options": {} 232 }, 233 "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter", 234 "typeVersion": 1, 235 "position": [ 236 360, 237 -540 238 ], 239 "id": "aa0c97c1-11ba-4d58-9cd9-2e0ff56f4626", 240 "name": "Recursive Character Text Splitter" 241 }, 242 { 243 "parameters": { 244 "assignments": { 245 "assignments": [ 246 { 247 "id": "86157d93-9576-4ae9-9a87-cc1fdf668d11", 248 "name": "phone_number", 249 "value": "={{ $json.messages[0].from }}", 250 "type": "string" 251 }, 252 { 253 "id": "270b1033-6588-4942-90eb-53b333962ef5", 254 "name": "message", 255 "value": "={{ $json.messages[0].text.body }}", 256 "type": "string" 257 } 258 ] 259 }, 260 "options": {} 261 }, 262 "type": "n8n-nodes-base.set", 263 "typeVersion": 3.4, 264 "position": [ 265 -360, 266 -220 267 ], 268 "id": "d6716189-368a-4019-a48a-08e3c21adabe", 269 "name": "format numer1" 270 }, 271 { 272 "parameters": { 273 "updates": [ 274 "messages" 275 ], 276 "options": {} 277 }, 278 "type": "n8n-nodes-base.whatsAppTrigger", 279 "typeVersion": 1, 280 "position": [ 281 -640, 282 -220 283 ], 284 "id": "39cfccc9-dce8-4f41-9619-563964dca810", 285 "name": "WhatsApp Trigger", 286 "webhookId": "f14f262f-9af4-41a4-9b09-ec3ee4dfa60e", 287 "credentials": { 288 "whatsAppTriggerApi": { 289 "id": "xJ8K3vDIVVs96LOx", 290 "name": "Chatbot" 291 } 292 } 293 }, 294 { 295 "parameters": { 296 "operation": "send", 297 "phoneNumberId": "689223604263235", 298 "recipientPhoneNumber": "={{ $('format numer1').item.json.phone_number }}", 299 "textBody": "={{ $json.output }}", 300 "additionalFields": {} 301 }, 302 "type": "n8n-nodes-base.whatsApp", 303 "typeVersion": 1, 304 "position": [ 305 420, 306 -220 307 ], 308 "id": "a69bee0f-b7ef-46c2-ac45-d614c1c15ed2", 309 "name": "Response message4", 310 "webhookId": "b88669e0-5944-48ae-8efc-a06d391bf08d", 311 "credentials": { 312 "whatsAppApi": { 313 "id": "a5Dnre4xpCWybCyE", 314 "name": "ChatBoot" 315 } 316 } 317 }, 318 { 319 "parameters": { 320 "content": "# Extraer productos", 321 "height": 740, 322 "width": 720, 323 "color": 6 324 }, 325 "type": "n8n-nodes-base.stickyNote", 326 "position": [ 327 -720, 328 -1100 329 ], 330 "typeVersion": 1, 331 "id": "2a26eddf-a4c0-4696-ada1-34528b84b1d6", 332 "name": "Sticky Note" 333 }, 334 { 335 "parameters": { 336 "content": "# Chatbot", 337 "height": 720, 338 "width": 1360 339 }, 340 "type": "n8n-nodes-base.stickyNote", 341 "position": [ 342 -720, 343 -320 344 ], 345 "typeVersion": 1, 346 "id": "82df1a6c-0950-4d31-9733-e6cb3b66f7d5", 347 "name": "Sticky Note1" 348 }, 349 { 350 "parameters": { 351 "content": "# Vector store", 352 "height": 740, 353 "width": 600, 354 "color": 5 355 }, 356 "type": "n8n-nodes-base.stickyNote", 357 "position": [ 358 40, 359 -1100 360 ], 361 "typeVersion": 1, 362 "id": "686d90d6-0caf-4caf-925d-8f6a2e7f3d8c", 363 "name": "Sticky Note3" 364 }, 365 { 366 "parameters": { 367 "sessionIdType": "customKey", 368 "sessionKey": "={{ $('format numer1').item.json.phone_number }}" 369 }, 370 "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow", 371 "typeVersion": 1.3, 372 "position": [ 373 60, 374 80 375 ], 376 "id": "02ff0917-9fd3-40b1-adec-9c085d2f0c97", 377 "name": "Simple Memory" 378 } 379 ], 380 "pinData": {}, 381 "connections": { 382 "AI Agent": { 383 "main": [ 384 [ 385 { 386 "node": "Response message4", 387 "type": "main", 388 "index": 0 389 } 390 ] 391 ] 392 }, 393 "OpenAI Chat Model": { 394 "ai_languageModel": [ 395 [ 396 { 397 "node": "AI Agent", 398 "type": "ai_languageModel", 399 "index": 0 400 } 401 ] 402 ] 403 }, 404 "MongoDB Atlas Vector Store": { 405 "ai_tool": [ 406 [ 407 { 408 "node": "AI Agent", 409 "type": "ai_tool", 410 "index": 0 411 } 412 ] 413 ] 414 }, 415 "Embeddings HuggingFace Inference": { 416 "ai_embedding": [ 417 [ 418 { 419 "node": "MongoDB Atlas Vector Store", 420 "type": "ai_embedding", 421 "index": 0 422 } 423 ] 424 ] 425 }, 426 "When clicking ‘Execute workflow’": { 427 "main": [ 428 [ 429 { 430 "node": "Google Drive", 431 "type": "main", 432 "index": 0 433 } 434 ] 435 ] 436 }, 437 "Google Drive": { 438 "main": [ 439 [ 440 { 441 "node": "Extract from File", 442 "type": "main", 443 "index": 0 444 } 445 ] 446 ] 447 }, 448 "Embeddings HuggingFace Inference1": { 449 "ai_embedding": [ 450 [ 451 { 452 "node": "MongoDB Atlas Vector Store1", 453 "type": "ai_embedding", 454 "index": 0 455 } 456 ] 457 ] 458 }, 459 "Extract from File": { 460 "main": [ 461 [ 462 { 463 "node": "MongoDB Atlas Vector Store1", 464 "type": "main", 465 "index": 0 466 } 467 ] 468 ] 469 }, 470 "MongoDB Atlas Vector Store1": { 471 "ai_tool": [ 472 [] 473 ] 474 }, 475 "Default Data Loader": { 476 "ai_document": [ 477 [ 478 { 479 "node": "MongoDB Atlas Vector Store1", 480 "type": "ai_document", 481 "index": 0 482 } 483 ] 484 ] 485 }, 486 "Recursive Character Text Splitter": { 487 "ai_textSplitter": [ 488 [ 489 { 490 "node": "Default Data Loader", 491 "type": "ai_textSplitter", 492 "index": 0 493 } 494 ] 495 ] 496 }, 497 "format numer1": { 498 "main": [ 499 [ 500 { 501 "node": "AI Agent", 502 "type": "main", 503 "index": 0 504 } 505 ] 506 ] 507 }, 508 "WhatsApp Trigger": { 509 "main": [ 510 [ 511 { 512 "node": "format numer1", 513 "type": "main", 514 "index": 0 515 } 516 ] 517 ] 518 }, 519 "Simple Memory": { 520 "ai_memory": [ 521 [ 522 { 523 "node": "AI Agent", 524 "type": "ai_memory", 525 "index": 0 526 } 527 ] 528 ] 529 } 530 }, 531 "active": false, 532 "settings": { 533 "executionOrder": "v1" 534 }, 535 "versionId": "5daeb455-44c9-4939-9257-0822b5992834", 536 "meta": { 537 "templateCredsSetupCompleted": true, 538 "instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a" 539 }, 540 "id": "wvJtfr4UVfI1zvb7", 541 "tags": [] 542}