-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Expand file tree
/
Copy pathRAG Chatbot for Company Documents using Google Drive and Gemini.json
More file actions
525 lines (525 loc) · 10.2 KB
/
Copy pathRAG Chatbot for Company Documents using Google Drive and Gemini.json
File metadata and controls
525 lines (525 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
{
"id": "7cXvgkl9170QXzT2",
"meta": {
"instanceId": "69133932b9ba8e1ef14816d0b63297bb44feb97c19f759b5d153ff6b0c59e18d",
"templateCredsSetupCompleted": true
},
"name": "RAG Workflow For Company Documents stored in Google Drive",
"tags": [],
"nodes": [
{
"id": "753455a3-ddc8-4a74-b043-70a0af38ff9e",
"name": "Pinecone Vector Store",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
680,
0
],
"parameters": {
"mode": "insert",
"options": {},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "company-files",
"cachedResultName": "company-files"
}
},
"credentials": {
"pineconeApi": {
"id": "bQTNry52ypGLqt47",
"name": "PineconeApi account"
}
},
"typeVersion": 1
},
{
"id": "a7c8fa7f-cad2-4497-a295-30aa2e98cacc",
"name": "Embeddings Google Gemini",
"type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
"position": [
640,
280
],
"parameters": {
"modelName": "models/text-embedding-004"
},
"credentials": {
"googlePalmApi": {
"id": "jLOqyTR4yTT1nYKi",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "215f0519-4359-4e4b-a90c-7e54b1cc52b5",
"name": "Default Data Loader",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
840,
220
],
"parameters": {
"options": {},
"dataType": "binary",
"binaryMode": "specificField"
},
"typeVersion": 1
},
{
"id": "863d3d1d-1621-406e-8320-688f64b07b09",
"name": "Recursive Character Text Splitter",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
820,
420
],
"parameters": {
"options": {},
"chunkOverlap": 100
},
"typeVersion": 1
},
{
"id": "5af1efb1-ea69-466e-bb3b-2b7e6b1ceef7",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
420,
840
],
"parameters": {
"options": {
"systemMessage": "You are a helpful HR assistant designed to answer employee questions based on company policies.\n\nRetrieve relevant information from the provided internal documents and provide a concise, accurate, and informative answer to the employee's question.\n\nUse the tool called \"company_documents_tool\" to retrieve any information from the company's documents.\n\nIf the answer cannot be found in the provided documents, respond with \"I cannot find the answer in the available resources.\""
}
},
"typeVersion": 1.7
},
{
"id": "825632ac-1edf-4e63-948d-b1a498b2b962",
"name": "Vector Store Tool",
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
"position": [
820,
1060
],
"parameters": {
"name": "company_documents_tool",
"description": "Retrieve information from any company documents"
},
"typeVersion": 1
},
{
"id": "72d2f685-bcc3-4e62-a5e3-72c0fe65f8e8",
"name": "Pinecone Vector Store (Retrieval)",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
720,
1240
],
"parameters": {
"options": {},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "company-files",
"cachedResultName": "company-files"
}
},
"credentials": {
"pineconeApi": {
"id": "bQTNry52ypGLqt47",
"name": "PineconeApi account"
}
},
"typeVersion": 1
},
{
"id": "eeff81cb-6aec-4e7f-afe0-432d87085fb2",
"name": "Embeddings Google Gemini (retrieval)",
"type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
"position": [
700,
1400
],
"parameters": {
"modelName": "models/text-embedding-004"
},
"credentials": {
"googlePalmApi": {
"id": "jLOqyTR4yTT1nYKi",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "8bb6ebb1-1deb-498b-8da4-b809a736e097",
"name": "Download File From Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
460,
0
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {
"fileName": "={{ $json.name }}"
},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "uixLsi5TmrfwXPeB",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "bd83bacf-dff1-4b7c-af5c-b249fb16c113",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
420,
660
],
"parameters": {
"content": "## Chat with company documents"
},
"typeVersion": 1
},
{
"id": "7b90daab-0fb2-4c8a-93e6-b138bb04f282",
"name": "Google Drive File Updated",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
140,
140
],
"parameters": {
"event": "fileUpdated",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1evDIoHePhjw_LgVFZXSZyK1sZm2GHp9W",
"cachedResultUrl": "https://drive.google.com/drive/folders/1evDIoHePhjw_LgVFZXSZyK1sZm2GHp9W",
"cachedResultName": "INNOVI PRO"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "uixLsi5TmrfwXPeB",
"name": "Google Drive account"
}
},
"typeVersion": 1
},
{
"id": "3a6c6cef-7a19-42ef-8092-eaf57dae4cdd",
"name": "Google Drive File Created",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
140,
-120
],
"parameters": {
"event": "fileCreated",
"options": {
"fileType": "all"
},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1evDIoHePhjw_LgVFZXSZyK1sZm2GHp9W",
"cachedResultUrl": "https://drive.google.com/drive/folders/1evDIoHePhjw_LgVFZXSZyK1sZm2GHp9W",
"cachedResultName": "INNOVI PRO"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "uixLsi5TmrfwXPeB",
"name": "Google Drive account"
}
},
"typeVersion": 1
},
{
"id": "1e38f1c8-7bd0-4eeb-addc-62339582d350",
"name": "Window Buffer Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
500,
1140
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "4b0ab858-99b1-4337-8c5c-a223519e3662",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
80,
840
],
"webhookId": "5f1c0c82-0ff9-40c7-9e2e-b1a96ffe24cd",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "bfb684d1-e5c1-41da-8305-b2606a2eade6",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
440,
-240
],
"parameters": {
"width": 320,
"content": "## Add docuemnts to vector store when updating or creating new documents in Google Drive"
},
"typeVersion": 1
},
{
"id": "8f627ec6-4b3f-43ad-a4a3-e2b199a7fe58",
"name": "Google Gemini Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
320,
1140
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.0-flash-exp"
},
"credentials": {
"googlePalmApi": {
"id": "jLOqyTR4yTT1nYKi",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "f2133a06-0088-46de-9f74-a3f9fe478f98",
"name": "Google Gemini Chat Model (retrieval)",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
1080,
1240
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.0-flash-exp"
},
"credentials": {
"googlePalmApi": {
"id": "jLOqyTR4yTT1nYKi",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "578deb96-8393-4850-9757-fa97b2bc9992",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-540,
220
],
"parameters": {
"width": 420,
"height": 720,
"content": "## Set up steps\n\n1. Google Cloud Project and Vertex AI API:\n* Create a Google Cloud project.\n* Enable the Vertex AI API for your project.\n2. Google AI API Key:\n* Obtain a Google AI API key from Google AI Studio.\n3. Pinecone Account:\n* Create a free account on the Pinecone website.\nObtain your API key from your Pinecone dashboard.\n* Create an index named company-files in your Pinecone project.\n4. Google Drive:\n* Create a dedicated folder in your Google Drive where company documents will be stored.\n5. Credentials in n8n: Configure credentials in your n8n environment for:\n* Google Drive OAuth2\n* Google Gemini(PaLM) Api (using your Google AI API key)\n* Pinecone API (using your Pinecone API key)\n5. Import the Workflow:\n* Import this workflow into your n8n instance.\n6. Configure the Workflow:\n* Update both Google Drive Trigger nodes to watch the specific folder you created in your Google Drive.\n* Configure the Pinecone Vector Store nodes to use your company-files index."
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "33b252fb-5d87-4a29-a0a7-97308140699c",
"connections": {
"AI Agent": {
"main": [
[]
]
},
"Vector Store Tool": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Pinecone Vector Store",
"type": "ai_document",
"index": 0
}
]
]
},
"Window Buffer Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Pinecone Vector Store": {
"main": [
[]
]
},
"Embeddings Google Gemini": {
"ai_embedding": [
[
{
"node": "Pinecone Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Google Drive File Created": {
"main": [
[
{
"node": "Download File From Google Drive",
"type": "main",
"index": 0
}
]
]
},
"Google Drive File Updated": {
"main": [
[
{
"node": "Download File From Google Drive",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Download File From Google Drive": {
"main": [
[
{
"node": "Pinecone Vector Store",
"type": "main",
"index": 0
}
]
]
},
"Pinecone Vector Store (Retrieval)": {
"ai_vectorStore": [
[
{
"node": "Vector Store Tool",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"Recursive Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"Embeddings Google Gemini (retrieval)": {
"ai_embedding": [
[
{
"node": "Pinecone Vector Store (Retrieval)",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Google Gemini Chat Model (retrieval)": {
"ai_languageModel": [
[
{
"node": "Vector Store Tool",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}