Qdrantを使った完全なRAGシステム、自動出典引用付き
上級
これはAI, IT Ops分野の自動化ワークフローで、29個のノードを含みます。主にSet, Code, Wait, Merge, Aggregateなどのノードを使用、AI技術を活用したスマート自動化を実現。 Qdrant、Gemini、OpenAIを使った自動引用機能付きRAGシステムの構築
前提条件
- •Google Drive API認証情報
- •ターゲットAPIの認証情報が必要な場合あり
- •OpenAI API Key
- •Qdrantサーバー接続情報
- •Google Gemini API Key
使用ノード (29)
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"id": "OAvKQCYsly0DTlci",
"meta": {
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
"templateCredsSetupCompleted": true
},
"name": "Complete RAG System with Automatic Source Citations Using Qdrant",
"tags": [],
"nodes": [
{
"id": "65d3e882-ef84-4b3b-88b0-bb69bbe6886f",
"name": "「ワークフローをテスト」クリック時",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-400,
220
],
"parameters": {},
"typeVersion": 1
},
{
"id": "db531b5a-588a-4982-aa00-e565d6f5610b",
"name": "埋め込み OpenAI1",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
940,
480
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "4zwP0MSr8zkNvvV9",
"name": "OpenAi account"
}
},
"typeVersion": 1.1
},
{
"id": "5a1606d8-d851-4fb1-a18a-a45f5de3adf2",
"name": "デフォルトデータローダー1",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
1080,
480
],
"parameters": {
"options": {
"metadata": {
"metadataValues": [
{
"name": "file_id",
"value": "={{ $('Get file').item.json.id }}"
},
{
"name": "file_name",
"value": "={{ $('Get file').item.json.name }}"
}
]
}
},
"dataType": "binary",
"binaryMode": "specificField"
},
"typeVersion": 1
},
{
"id": "9923f6be-c2a5-4498-9fd2-0ed74ccdab35",
"name": "Qdrantベクトルストア",
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"position": [
1000,
240
],
"parameters": {
"mode": "insert",
"options": {},
"qdrantCollection": {
"__rl": true,
"mode": "list",
"value": "negozio-emporio-verde",
"cachedResultName": "negozio-emporio-verde"
}
},
"credentials": {
"qdrantApi": {
"id": "iyQ6MQiVaF3VMBmt",
"name": "QdrantApi account (Hetzner)"
}
},
"typeVersion": 1
},
{
"id": "db1f5e71-28ef-427e-8911-275ddea4e44f",
"name": "コレクション作成",
"type": "n8n-nodes-base.httpRequest",
"position": [
-180,
-140
],
"parameters": {
"url": "http://QDRANTURL/collections/COLLECTION",
"method": "PUT",
"options": {},
"jsonBody": "{\n \"vectors\": {\n \"size\": 1536,\n \"distance\": \"Cosine\" \n },\n \"shard_number\": 1, \n \"replication_factor\": 1, \n \"write_consistency_factor\": 1 \n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "qhny6r5ql9wwotpn",
"name": "Qdrant API (Hetzner)"
}
},
"typeVersion": 4.2
},
{
"id": "e0936863-4ece-429c-bf32-49f75b5c8bf0",
"name": "再帰的文字テキスト分割器",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
1060,
660
],
"parameters": {
"options": {},
"chunkSize": 500,
"chunkOverlap": 50
},
"typeVersion": 1
},
{
"id": "1311350d-75d3-4edc-8fa9-584a1c36da6d",
"name": "アイテムをループ処理",
"type": "n8n-nodes-base.splitInBatches",
"position": [
420,
220
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "1f9b623c-4e93-44da-8c9d-cfe9f5d5be9a",
"name": "待機",
"type": "n8n-nodes-base.wait",
"position": [
1380,
240
],
"webhookId": "89248db2-59f2-4b61-9cd5-71406144efee",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "22aacdc0-8ec5-42e2-b9a0-fb9e5a4aa23c",
"name": "チャットメッセージ受信時",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-460,
1080
],
"webhookId": "c9460030-9e23-41c4-9fcd-6c4c7fadf784",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "1e132fba-00a5-414a-8f37-f34645f668ff",
"name": "質問応答チェーン",
"type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
"position": [
120,
1280
],
"parameters": {
"options": {}
},
"typeVersion": 1.5
},
{
"id": "badee75e-bca7-49e4-9095-c098cb7adcab",
"name": "Google Gemini チャットモデル",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
0,
1500
],
"parameters": {
"options": {},
"modelName": "models/gemini-1.5-flash"
},
"credentials": {
"googlePalmApi": {
"id": "0p34rXqIqy8WuoPg",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "ad8cec62-ce1d-4e58-8e40-9a7a9f4f93c7",
"name": "ベクトルストア検索器",
"type": "@n8n/n8n-nodes-langchain.retrieverVectorStore",
"position": [
160,
1500
],
"parameters": {
"topK": 5
},
"typeVersion": 1
},
{
"id": "0c7d1804-4525-4117-a19d-f2d59195fd47",
"name": "Qdrantベクトルストア1",
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"position": [
40,
1680
],
"parameters": {
"options": {},
"qdrantCollection": {
"__rl": true,
"mode": "list",
"value": "negozio-emporio-verde",
"cachedResultName": "negozio-emporio-verde"
}
},
"credentials": {
"qdrantApi": {
"id": "iyQ6MQiVaF3VMBmt",
"name": "QdrantApi account (Hetzner)"
}
},
"typeVersion": 1.1
},
{
"id": "6cfe7e8a-e593-4e4e-a0be-3379dd85c748",
"name": "埋め込み OpenAI",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
20,
1880
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "4zwP0MSr8zkNvvV9",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "d9aa08b5-ed04-4506-9a2e-f994d4694f48",
"name": "埋め込み OpenAI4",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
100,
1140
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "4zwP0MSr8zkNvvV9",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "d0d32470-b1df-40ec-aac1-32e4c9cf2e4e",
"name": "マージ1",
"type": "n8n-nodes-base.merge",
"position": [
640,
1140
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineAll"
},
"typeVersion": 3.1
},
{
"id": "2edbca72-220e-45a6-8295-830d58611549",
"name": "集約",
"type": "n8n-nodes-base.aggregate",
"position": [
460,
940
],
"parameters": {
"options": {},
"fieldsToAggregate": {
"fieldToAggregate": [
{
"fieldToAggregate": "document.metadata.file_id"
},
{
"fieldToAggregate": "document.metadata.file_name"
}
]
}
},
"typeVersion": 1
},
{
"id": "8d116bc2-73d8-4349-8b4e-8dc0aef7cfa3",
"name": "コレクションをクリア",
"type": "n8n-nodes-base.httpRequest",
"position": [
-140,
220
],
"parameters": {
"url": "http://QDRANTURL/collections/COLLECTION/points/delete",
"method": "POST",
"options": {},
"jsonBody": "{\n \"filter\": {}\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "qhny6r5ql9wwotpn",
"name": "Qdrant API (Hetzner)"
}
},
"typeVersion": 4.2
},
{
"id": "0d4d3bab-2370-4ced-8f5d-2977d360f72b",
"name": "フォルダを取得",
"type": "n8n-nodes-base.googleDrive",
"position": [
120,
220
],
"parameters": {
"filter": {
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1RO5ByPhq2yvYLmbapTNC_kKdU5lZd4W5",
"cachedResultUrl": "https://drive.google.com/drive/folders/1RO5ByPhq2yvYLmbapTNC_kKdU5lZd4W5",
"cachedResultName": "Test Negozio"
}
},
"options": {},
"resource": "fileFolder"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "HEy5EuZkgPZVEa9w",
"name": "Google Drive account (n3w.it)"
}
},
"typeVersion": 3
},
{
"id": "e81ee92f-db50-4c62-aac7-7bc03e63cc1a",
"name": "ファイルを取得",
"type": "n8n-nodes-base.googleDrive",
"position": [
700,
240
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {
"googleFileConversion": {
"conversion": {
"docsToFormat": "text/plain"
}
}
},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "HEy5EuZkgPZVEa9w",
"name": "Google Drive account (n3w.it)"
}
},
"typeVersion": 3
},
{
"id": "c9bdc00a-ca8c-4457-8720-e6dce07e6b22",
"name": "チャット入力",
"type": "n8n-nodes-base.set",
"position": [
-200,
1080
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "282b9bed-e5fd-4edb-95d5-682bcc08e070",
"name": "chatInput",
"type": "string",
"value": "={{ $json.chatInput }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b65ca747-e738-4b7a-ae02-83840ce0a460",
"name": "出典を取得",
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"position": [
140,
940
],
"parameters": {
"mode": "load",
"topK": 5,
"prompt": "={{ $json.chatInput }}",
"options": {},
"qdrantCollection": {
"__rl": true,
"mode": "list",
"value": "negozio-emporio-verde",
"cachedResultName": "negozio-emporio-verde"
}
},
"credentials": {
"qdrantApi": {
"id": "iyQ6MQiVaF3VMBmt",
"name": "QdrantApi account (Hetzner)"
}
},
"typeVersion": 1.1
},
{
"id": "265e2613-0155-4585-8d5c-fcda26975585",
"name": "出力",
"type": "n8n-nodes-base.set",
"position": [
1060,
1140
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b296c92b-d9ee-4322-b972-d1069d01feb8",
"name": "output",
"type": "string",
"value": "={{ $('Question and Answer Chain').item.json.response }}\n\nSources: {{ (JSON.stringify($json.unique_file_names)) }},"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "9407fcaf-d90a-46bd-9b1f-b0493a0357c1",
"name": "応答",
"type": "n8n-nodes-base.code",
"position": [
880,
1140
],
"parameters": {
"jsCode": "const item = $input.item.json;\n\n// Creiamo Set per rimuovere duplicati\nconst uniqueFileIds = Array.from(new Set(item.file_id));\nconst uniqueFileNames = Array.from(new Set(item.file_name));\n\n// Ritorniamo un item con i valori univoci\nreturn [\n {\n json: {\n unique_file_ids: uniqueFileIds,\n unique_file_names: uniqueFileNames\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "0b8a715f-36eb-49fd-895e-e8e76fdbb0c1",
"name": "付箋2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-360,
-520
],
"parameters": {
"width": 840,
"height": 220,
"content": "## Complete RAG System with Automatic Source Citations Using Qdrant\n\nThis workflow implements a **Retrieval-Augmented Generation (RAG)** system that:\n\n* Stores vectorized documents in **Qdrant**,\n* Retrieves relevant content based on user input,\n* Generates AI answers using **Google Gemini**,\n* Automatically **cites the document sources** (from Google Drive).\n"
},
"typeVersion": 1
},
{
"id": "3220c323-a3d6-4855-ad05-2aaf8761771e",
"name": "付箋3",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
-200
],
"parameters": {
"color": 6,
"width": 880,
"height": 220,
"content": "# STEP 1\n\n## Create Qdrant Collection\nChange:\n- QDRANTURL\n- COLLECTION"
},
"typeVersion": 1
},
{
"id": "738835a3-888b-426e-a897-8ddc630b85bf",
"name": "付箋4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-220,
120
],
"parameters": {
"color": 4,
"width": 620,
"height": 520,
"content": "# STEP 2\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Documents vectorization with Qdrant and Google Drive\nChange:\n- QDRANTURL\n- COLLECTION"
},
"typeVersion": 1
},
{
"id": "70205511-2c4a-4f2f-8f68-97e3ede28851",
"name": "付箋",
"type": "n8n-nodes-base.stickyNote",
"position": [
1200,
620
],
"parameters": {
"color": 4,
"width": 520,
"height": 420,
"content": "Set as metadata:\n- FILE_ID from Google Drive\n- FILE_NAME from Google Drive\n\n```\n{\n \"source\": \"blob\",\n \"blobType\": \"text/plain\",\n \"loc\": {\n \"lines\": {\n \"from\": 1,\n \"to\": 15\n }\n },\n \"file_id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxx\",\n \"file_name\": \"FAQ\"\n}\n```\n\n\n"
},
"typeVersion": 1
},
{
"id": "921497ff-1beb-4bd1-aecd-81b68c5a0357",
"name": "付箋1",
"type": "n8n-nodes-base.stickyNote",
"position": [
680,
1400
],
"parameters": {
"color": 3,
"width": 520,
"height": 200,
"content": "The final output is:\n\n\nRESPONSE\n\nSources: [\"FILENAME 1\", \"FILENAME 2\",...]\n\n"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "33d05a21-33dd-422a-ba58-3eafffc7d50a",
"connections": {
"1f9b623c-4e93-44da-8c9d-cfe9f5d5be9a": {
"main": [
[
{
"node": "1311350d-75d3-4edc-8fa9-584a1c36da6d",
"type": "main",
"index": 0
}
]
]
},
"d0d32470-b1df-40ec-aac1-32e4c9cf2e4e": {
"main": [
[
{
"node": "9407fcaf-d90a-46bd-9b1f-b0493a0357c1",
"type": "main",
"index": 0
}
]
]
},
"e81ee92f-db50-4c62-aac7-7bc03e63cc1a": {
"main": [
[
{
"node": "9923f6be-c2a5-4498-9fd2-0ed74ccdab35",
"type": "main",
"index": 0
}
]
]
},
"9407fcaf-d90a-46bd-9b1f-b0493a0357c1": {
"main": [
[
{
"node": "265e2613-0155-4585-8d5c-fcda26975585",
"type": "main",
"index": 0
}
]
]
},
"2edbca72-220e-45a6-8295-830d58611549": {
"main": [
[
{
"node": "d0d32470-b1df-40ec-aac1-32e4c9cf2e4e",
"type": "main",
"index": 0
}
]
]
},
"c9bdc00a-ca8c-4457-8720-e6dce07e6b22": {
"main": [
[
{
"node": "1e132fba-00a5-414a-8f37-f34645f668ff",
"type": "main",
"index": 0
},
{
"node": "b65ca747-e738-4b7a-ae02-83840ce0a460",
"type": "main",
"index": 0
}
]
]
},
"0d4d3bab-2370-4ced-8f5d-2977d360f72b": {
"main": [
[
{
"node": "1311350d-75d3-4edc-8fa9-584a1c36da6d",
"type": "main",
"index": 0
}
]
]
},
"1311350d-75d3-4edc-8fa9-584a1c36da6d": {
"main": [
[],
[
{
"node": "e81ee92f-db50-4c62-aac7-7bc03e63cc1a",
"type": "main",
"index": 0
}
]
]
},
"b65ca747-e738-4b7a-ae02-83840ce0a460": {
"main": [
[
{
"node": "2edbca72-220e-45a6-8295-830d58611549",
"type": "main",
"index": 0
}
]
]
},
"8d116bc2-73d8-4349-8b4e-8dc0aef7cfa3": {
"main": [
[
{
"node": "0d4d3bab-2370-4ced-8f5d-2977d360f72b",
"type": "main",
"index": 0
}
]
]
},
"6cfe7e8a-e593-4e4e-a0be-3379dd85c748": {
"ai_embedding": [
[
{
"node": "0c7d1804-4525-4117-a19d-f2d59195fd47",
"type": "ai_embedding",
"index": 0
}
]
]
},
"db531b5a-588a-4982-aa00-e565d6f5610b": {
"ai_embedding": [
[
{
"node": "9923f6be-c2a5-4498-9fd2-0ed74ccdab35",
"type": "ai_embedding",
"index": 0
}
]
]
},
"d9aa08b5-ed04-4506-9a2e-f994d4694f48": {
"ai_embedding": [
[
{
"node": "b65ca747-e738-4b7a-ae02-83840ce0a460",
"type": "ai_embedding",
"index": 0
}
]
]
},
"9923f6be-c2a5-4498-9fd2-0ed74ccdab35": {
"main": [
[
{
"node": "1f9b623c-4e93-44da-8c9d-cfe9f5d5be9a",
"type": "main",
"index": 0
}
]
]
},
"5a1606d8-d851-4fb1-a18a-a45f5de3adf2": {
"ai_document": [
[
{
"node": "9923f6be-c2a5-4498-9fd2-0ed74ccdab35",
"type": "ai_document",
"index": 0
}
]
]
},
"0c7d1804-4525-4117-a19d-f2d59195fd47": {
"ai_vectorStore": [
[
{
"node": "ad8cec62-ce1d-4e58-8e40-9a7a9f4f93c7",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"ad8cec62-ce1d-4e58-8e40-9a7a9f4f93c7": {
"ai_retriever": [
[
{
"node": "1e132fba-00a5-414a-8f37-f34645f668ff",
"type": "ai_retriever",
"index": 0
}
]
]
},
"badee75e-bca7-49e4-9095-c098cb7adcab": {
"ai_languageModel": [
[
{
"node": "1e132fba-00a5-414a-8f37-f34645f668ff",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"1e132fba-00a5-414a-8f37-f34645f668ff": {
"main": [
[
{
"node": "d0d32470-b1df-40ec-aac1-32e4c9cf2e4e",
"type": "main",
"index": 1
}
]
]
},
"22aacdc0-8ec5-42e2-b9a0-fb9e5a4aa23c": {
"main": [
[
{
"node": "c9bdc00a-ca8c-4457-8720-e6dce07e6b22",
"type": "main",
"index": 0
}
]
]
},
"e0936863-4ece-429c-bf32-49f75b5c8bf0": {
"ai_textSplitter": [
[
{
"node": "5a1606d8-d851-4fb1-a18a-a45f5de3adf2",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"65d3e882-ef84-4b3b-88b0-bb69bbe6886f": {
"main": [
[
{
"node": "8d116bc2-73d8-4349-8b4e-8dc0aef7cfa3",
"type": "main",
"index": 0
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
上級 - 人工知能, IT運用
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
Mistral OCR を基にした完全な RAG パイソンデモ(PDF から始める)
Mistral OCR、Qdrant、Gemini AIを組み合わせてPDFドキュメントRAGシステムを構築
Set
Code
Wait
+
Set
Code
Wait
34 ノードDavide
人工知能
RAG内でドキュメントのアップデート機能を有効化
Google Drive、Qdrant、Gemini Chatを使ってRAGシステムを構築し、継続のに更新
Set
Wait
Google Drive
+
Set
Wait
Google Drive
29 ノードDavide
人工知能
Qdrant を使った完全な RAG システム、ドキュメントの自動更新機能付き
OpenAI、Google Gemini、Qdrant および Google Drive を使用して、自更新 RAG システムを構築
Set
Wait
Google Drive
+
Set
Wait
Google Drive
32 ノードDavide
AI RAG検索拡張
AI スマートアシスタント: Supabase ストレージと Google Drive ファイルとの対話
AIワンチャットボット:SupabaseストレージとGoogle Driveのファイルと対話
If
Set
Wait
+
If
Set
Wait
62 ノードMark Shcherbakov
エンジニアリング
AIで動くTelegramアシスタント完全入門ガイド(PDF、Brave検索、Google スイート)
Gemini、RAG PDF検索、Google Suiteを用いて多機能Telegramボットを構築
Set
Code
Wait
+
Set
Code
Wait
79 ノードIssam AGGOUR
人工知能
試験問題生成
GoogleドキュメントとGeminiを基にしたAI駆動の自動試験問題・解答生成
Code
Google Docs
Http Request
+
Code
Google Docs
Http Request
37 ノードDavide
その他
ワークフロー情報
難易度
上級
ノード数29
カテゴリー2
ノードタイプ18
作成者
Davide
@n3witaliaFull-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at info@n3w.it or add me on Linkedin.com/in/davideboizza
外部リンク
n8n.ioで表示 →
このワークフローを共有