Système RAG V2 - Mise à jour de la documentation
Ceci est unDocument Extraction, AI RAGworkflow d'automatisation du domainecontenant 22 nœuds.Utilise principalement des nœuds comme If, Set, Limit, Switch, Supabase. Maintenir un système RAG à jour dans la base de vecteurs Supabase via les changements de fichiers Google Drive
- •URL et Clé API Supabase
- •Informations d'identification Google Drive API
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
- •Clé API OpenAI
Nœuds utilisés (22)
Catégorie
{
"id": "YVAwvooLBNvqFhyp",
"meta": {
"instanceId": "90587241b61f532dbe71be441310f86b24bd62a247fd87ce3f4b074464fa220d",
"templateCredsSetupCompleted": true
},
"name": "RAG System V2 - Update Doc",
"tags": [
{
"id": "X3XA7mO6MQZQ8uNT",
"name": "RAG",
"createdAt": "2024-12-23T14:38:50.002Z",
"updatedAt": "2024-12-23T14:38:50.002Z"
},
{
"id": "bQac7pgkCzmq5Nt5",
"name": "template",
"createdAt": "2025-01-14T11:43:47.391Z",
"updatedAt": "2025-01-14T11:43:47.391Z"
},
{
"id": "pms2jtgY49JCgVDW",
"name": "chatbot",
"createdAt": "2024-12-19T04:39:23.549Z",
"updatedAt": "2024-12-19T04:39:23.549Z"
}
],
"nodes": [
{
"id": "f57918de-1d00-432b-b352-b6013118664a",
"name": "Définir l'ID du fichier",
"type": "n8n-nodes-base.set",
"position": [
220,
2200
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "10646eae-ae46-4327-a4dc-9987c2d76173",
"name": "file_id",
"type": "string",
"value": "={{ $('File Updated').item.json.id }}"
},
{
"id": "f4536df5-d0b1-4392-bf17-b8137fb31a44",
"name": "file_type",
"type": "string",
"value": "={{ $('File Updated').item.json.mimeType }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "2899dfbc-2fba-4f35-9805-384dc30eebab",
"name": "Supprimer les anciennes lignes de document",
"type": "n8n-nodes-base.supabase",
"position": [
600,
2200
],
"parameters": {
"tableId": "documents",
"operation": "delete",
"filterType": "string",
"filterString": "=metadata->>file_id=like.*{{ $('Set File ID').item.json.file_id }}*"
},
"credentials": {
"supabaseApi": {
"id": "J5U7ge3sFHh1WYka",
"name": "Supabase API"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "aae30af6-491e-48f7-89cb-b6dd2ed5ed9e",
"name": "Télécharger le fichier",
"type": "n8n-nodes-base.googleDrive",
"position": [
1540,
2360
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Set File ID').item.json.file_id }}"
},
"options": {
"googleFileConversion": {
"conversion": {
"docsToFormat": "text/plain"
}
}
},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "yGiuxvKzLUzVYa2d",
"name": "Google Drive account"
}
},
"executeOnce": true,
"typeVersion": 3
},
{
"id": "efdfe418-a0bc-4db1-87e2-5558f00a48ec",
"name": "Si",
"type": "n8n-nodes-base.if",
"onError": "continueRegularOutput",
"position": [
380,
2200
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "928b5cae-77cd-48a2-81ef-2f76dc441b0a",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('File Updated').item.json.mimeType }}",
"rightValue": "application/vnd.google-apps.document"
},
{
"id": "6368b5ad-32b0-491d-a27d-5cc3ad5c2a11",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ ((Date.now() - Date.parse($('File Updated').item.json.createdTime)) / 1000) }}",
"rightValue": 60
}
]
}
},
"typeVersion": 2.2
},
{
"id": "19edee69-a34b-48c7-8f2e-c2547fb226ff",
"name": "Agréger",
"type": "n8n-nodes-base.aggregate",
"position": [
2300,
2300
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "93ddcfd1-9320-4808-b636-ae28664f41a8",
"name": "Résumer",
"type": "n8n-nodes-base.summarize",
"position": [
2500,
2300
],
"parameters": {
"options": {},
"fieldsToSummarize": {
"values": [
{
"field": "data",
"aggregation": "concatenate"
}
]
}
},
"typeVersion": 1
},
{
"id": "f864d1f7-39a2-4d36-9dc5-d75fcc08ba7d",
"name": "Extraire le texte PDF1",
"type": "n8n-nodes-base.extractFromFile",
"position": [
2100,
1960
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "32d1f985-b143-451e-a6d1-bf3da9f568a1",
"name": "Extraire d'Excel1",
"type": "n8n-nodes-base.extractFromFile",
"position": [
2100,
2300
],
"parameters": {
"options": {},
"operation": "xlsx"
},
"typeVersion": 1
},
{
"id": "2ea2790c-f4ab-4c59-b4b6-0a22e8047f48",
"name": "Convertir en Google Doc2",
"type": "n8n-nodes-base.httpRequest",
"position": [
2100,
2500
],
"parameters": {
"url": "=https://www.googleapis.com/drive/v3/files/{{ $('Set File ID').item.json.file_id }}/copy",
"method": "POST",
"options": {},
"sendBody": true,
"authentication": "predefinedCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "name",
"value": "={{ $('Set File ID').item.json.name }}"
},
{
"name": "mimeType",
"value": "application/vnd.google-apps.document"
}
]
},
"nodeCredentialType": "googleDriveOAuth2Api"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "yGiuxvKzLUzVYa2d",
"name": "Google Drive account"
}
},
"typeVersion": 4.1
},
{
"id": "69166736-3369-4a33-8543-fae475344593",
"name": "Supprimer le fichier1",
"type": "n8n-nodes-base.googleDrive",
"position": [
2300,
2500
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Set File ID').item.json.file_id }}"
},
"options": {},
"operation": "deleteFile"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "yGiuxvKzLUzVYa2d",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "e2574cdd-5d41-4be1-bca5-370d2a8e2ee2",
"name": "Séparateur de texte récursif1",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
3080,
2420
],
"parameters": {
"options": {},
"chunkSize": 2000,
"chunkOverlap": 200
},
"typeVersion": 1
},
{
"id": "7dfe4ffd-0fda-4f7d-a005-4e4e9a62048e",
"name": "Embeddings OpenAI2",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
2820,
2280
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "9SPpIIxBvgYPZlo8",
"name": "OpenAi account"
}
},
"typeVersion": 1.1
},
{
"id": "394d1238-bf7c-4882-b3ac-6db474140854",
"name": "Note adhésive3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-120,
1820
],
"parameters": {
"color": 5,
"width": 3507,
"height": 1028,
"content": "# Watch Trigger (Drive) - Files Updated\n## Workflow ini jalan jika ada File yang diupdate/diedit/dimodifikasi.\n# Cara Kerja\n## Cek file yang barusan diupdate -> cek tipe/format file nya lalu konvert jika perlu -> exkstrak teksnya -> upload ke vectord database\n"
},
"typeVersion": 1
},
{
"id": "270a7c5d-b9e1-48c1-aa0d-76677c15ab34",
"name": "Chargeur de données par défaut amélioré2",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
3000,
2200
],
"parameters": {
"options": {
"metadata": {
"metadataValues": [
{
"name": "=file_id",
"value": "={{ $('Set File ID').item.json.file_id }}"
},
{
"name": "=version",
"value": "={{ $('Set Version').item.json.message.content.version }}"
},
{
"name": "=creator",
"value": "={{ $('File Updated').item.json.owners[0].displayName }}"
},
{
"name": "=created_at",
"value": "={{ $('File Updated').item.json.createdTime }}"
},
{
"name": "=last_modified",
"value": "={{ $('File Updated').item.json.modifiedTime }}"
},
{
"name": "=folder_path",
"value": "DOCUMENTS"
},
{
"name": "=file_name",
"value": "={{ $('File Updated').item.json.name }}"
},
{
"name": "=file_extension",
"value": "={{ $('File Updated').item.json.mimeType }}"
}
]
}
},
"jsonData": "={{ $json.data || $json.text || $json.concatenated_data }}",
"jsonMode": "expressionData"
},
"typeVersion": 1
},
{
"id": "a82a1191-9271-473a-b4b5-a57217c013b7",
"name": "Boucler sur les éléments1",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1380,
2200
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "423cdd3c-a1a8-406f-abb3-5c6f0d04d669",
"name": "Fichier mis à jour",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
40,
2200
],
"parameters": {
"event": "fileUpdated",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1M9h9OnDSWa0kV7_Yj7fdSFHhM57pMPX8",
"cachedResultUrl": "https://drive.google.com/drive/folders/1M9h9OnDSWa0kV7_Yj7fdSFHhM57pMPX8",
"cachedResultName": "DOCUMENTS"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "yGiuxvKzLUzVYa2d",
"name": "Google Drive account"
}
},
"typeVersion": 1
},
{
"id": "2fd0b826-577d-44d7-a3a9-2024bc4ec4cd",
"name": "Insérer dans Supabase Vectorstore",
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"position": [
2780,
1960
],
"parameters": {
"mode": "insert",
"options": {
"queryName": "match_documents"
},
"tableName": {
"__rl": true,
"mode": "id",
"value": "documents"
}
},
"credentials": {
"supabaseApi": {
"id": "J5U7ge3sFHh1WYka",
"name": "Supabase API"
}
},
"typeVersion": 1
},
{
"id": "49523689-c6f0-444f-a8b3-ea6a1b4eda39",
"name": "Commutateur",
"type": "n8n-nodes-base.switch",
"position": [
1800,
2180
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "PDF",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Set File ID').item.json.file_type }}",
"rightValue": "application/pdf"
}
]
},
"renameOutput": true
},
{
"outputKey": "Text File",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "fc193b06-363b-4699-a97d-e5a850138b0e",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Set File ID').item.json.file_type }}",
"rightValue": "application/vnd.google-apps.document"
}
]
},
"renameOutput": true
},
{
"outputKey": "Excel",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2ae7faa7-a936-4621-a680-60c512163034",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Set File ID').item.json.file_type }}",
"rightValue": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}
]
},
"renameOutput": true
},
{
"outputKey": "Windows Doc(1)",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7ddfa924-1c26-4ee3-9890-5c9d2b96717a",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Set File ID').item.json.file_type }}",
"rightValue": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
]
},
"renameOutput": true
},
{
"outputKey": "Windows Doc(2)",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f53caf8b-7a8f-4d1e-98f4-deaf0e0171f0",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Set File ID').item.json.file_type }}",
"rightValue": "application/msword"
}
]
},
"renameOutput": true
},
{
"outputKey": "Windows Doc(3)",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "cd9ca627-d00d-4c30-903a-41f603c8e36f",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Set File ID').item.json.file_type }}",
"rightValue": "application/vnd.ms-word"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": 2
}
},
"typeVersion": 3
},
{
"id": "c4ea8b5a-695e-438a-8764-96247168dc5b",
"name": "Extraire du fichier texte1",
"type": "n8n-nodes-base.extractFromFile",
"position": [
2100,
2120
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "8632f57f-e05e-4cd6-a84e-4111c106702c",
"name": "Limite",
"type": "n8n-nodes-base.limit",
"position": [
760,
2200
],
"parameters": {},
"typeVersion": 1
},
{
"id": "0e1b5c79-46a7-49d6-a4ad-934a9f2441a8",
"name": "Définir la version",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
980,
2200
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "Your goal is to take the incoming version number and add 1 to it. \n\n[Examples]\nInput: v1\nOutput: v2\n\nInput: v2\nOutput: v3\n\nInput: v4\nOutput: v5 \n\nThe output field should always be called \"version\""
},
{
"content": "=incoming version number: {{ $json.metadata.version }}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "9SPpIIxBvgYPZlo8",
"name": "OpenAi account"
}
},
"typeVersion": 1.7
},
{
"id": "55b08438-df0c-4a13-98d0-bcb632d3d8be",
"name": "Note adhésive",
"type": "n8n-nodes-base.stickyNote",
"position": [
-120,
2900
],
"parameters": {
"width": 560,
"content": "## CREDITS\n### This Workflow Is Originally by Nate Herk.\n[Check his community here](https://www.skool.com/ai-automation-society-plus/about)"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "fba7627e-45c8-4121-8f6a-123ca7d6c8d0",
"connections": {
"efdfe418-a0bc-4db1-87e2-5558f00a48ec": {
"main": [
[],
[
{
"node": "2899dfbc-2fba-4f35-9805-384dc30eebab",
"type": "main",
"index": 0
}
]
]
},
"8632f57f-e05e-4cd6-a84e-4111c106702c": {
"main": [
[
{
"node": "0e1b5c79-46a7-49d6-a4ad-934a9f2441a8",
"type": "main",
"index": 0
}
]
]
},
"49523689-c6f0-444f-a8b3-ea6a1b4eda39": {
"main": [
[
{
"node": "f864d1f7-39a2-4d36-9dc5-d75fcc08ba7d",
"type": "main",
"index": 0
}
],
[
{
"node": "c4ea8b5a-695e-438a-8764-96247168dc5b",
"type": "main",
"index": 0
}
],
[
{
"node": "32d1f985-b143-451e-a6d1-bf3da9f568a1",
"type": "main",
"index": 0
}
],
[
{
"node": "2ea2790c-f4ab-4c59-b4b6-0a22e8047f48",
"type": "main",
"index": 0
}
],
[
{
"node": "2ea2790c-f4ab-4c59-b4b6-0a22e8047f48",
"type": "main",
"index": 0
}
],
[
{
"node": "2ea2790c-f4ab-4c59-b4b6-0a22e8047f48",
"type": "main",
"index": 0
}
]
]
},
"19edee69-a34b-48c7-8f2e-c2547fb226ff": {
"main": [
[
{
"node": "93ddcfd1-9320-4808-b636-ae28664f41a8",
"type": "main",
"index": 0
}
]
]
},
"93ddcfd1-9320-4808-b636-ae28664f41a8": {
"main": [
[
{
"node": "2fd0b826-577d-44d7-a3a9-2024bc4ec4cd",
"type": "main",
"index": 0
}
]
]
},
"f57918de-1d00-432b-b352-b6013118664a": {
"main": [
[
{
"node": "efdfe418-a0bc-4db1-87e2-5558f00a48ec",
"type": "main",
"index": 0
}
]
]
},
"0e1b5c79-46a7-49d6-a4ad-934a9f2441a8": {
"main": [
[
{
"node": "a82a1191-9271-473a-b4b5-a57217c013b7",
"type": "main",
"index": 0
}
]
]
},
"423cdd3c-a1a8-406f-abb3-5c6f0d04d669": {
"main": [
[
{
"node": "f57918de-1d00-432b-b352-b6013118664a",
"type": "main",
"index": 0
}
]
]
},
"aae30af6-491e-48f7-89cb-b6dd2ed5ed9e": {
"main": [
[
{
"node": "a82a1191-9271-473a-b4b5-a57217c013b7",
"type": "main",
"index": 0
}
]
]
},
"a82a1191-9271-473a-b4b5-a57217c013b7": {
"main": [
[
{
"node": "49523689-c6f0-444f-a8b3-ea6a1b4eda39",
"type": "main",
"index": 0
}
],
[
{
"node": "aae30af6-491e-48f7-89cb-b6dd2ed5ed9e",
"type": "main",
"index": 0
}
]
]
},
"f864d1f7-39a2-4d36-9dc5-d75fcc08ba7d": {
"main": [
[
{
"node": "2fd0b826-577d-44d7-a3a9-2024bc4ec4cd",
"type": "main",
"index": 0
}
]
]
},
"7dfe4ffd-0fda-4f7d-a005-4e4e9a62048e": {
"ai_embedding": [
[
{
"node": "2fd0b826-577d-44d7-a3a9-2024bc4ec4cd",
"type": "ai_embedding",
"index": 0
}
]
]
},
"2899dfbc-2fba-4f35-9805-384dc30eebab": {
"main": [
[
{
"node": "8632f57f-e05e-4cd6-a84e-4111c106702c",
"type": "main",
"index": 0
}
]
]
},
"32d1f985-b143-451e-a6d1-bf3da9f568a1": {
"main": [
[
{
"node": "19edee69-a34b-48c7-8f2e-c2547fb226ff",
"type": "main",
"index": 0
}
]
]
},
"2ea2790c-f4ab-4c59-b4b6-0a22e8047f48": {
"main": [
[
{
"node": "69166736-3369-4a33-8543-fae475344593",
"type": "main",
"index": 0
}
]
]
},
"c4ea8b5a-695e-438a-8764-96247168dc5b": {
"main": [
[
{
"node": "2fd0b826-577d-44d7-a3a9-2024bc4ec4cd",
"type": "main",
"index": 0
}
]
]
},
"270a7c5d-b9e1-48c1-aa0d-76677c15ab34": {
"ai_document": [
[
{
"node": "2fd0b826-577d-44d7-a3a9-2024bc4ec4cd",
"type": "ai_document",
"index": 0
}
]
]
},
"e2574cdd-5d41-4be1-bca5-370d2a8e2ee2": {
"ai_textSplitter": [
[
{
"node": "270a7c5d-b9e1-48c1-aa0d-76677c15ab34",
"type": "ai_textSplitter",
"index": 0
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Avancé - Extraction de documents, RAG IA
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
edisantosa
@edsanPartager ce workflow