Agent de connaissances (avec Google Drive, Telegram)

Intermédiaire

Ceci est unAI RAG, Multimodal AIworkflow d'automatisation du domainecontenant 13 nœuds.Utilise principalement des nœuds comme Telegram, GoogleDrive, Agent, TelegramTrigger, GoogleDriveTrigger. Chatbot de questions-réponses pour documents basé sur Google Drive, GPT-4-mini et Telegram (système RAG)

Prérequis
  • Token Bot Telegram
  • Informations d'identification Google Drive API
  • Clé API OpenAI
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "UZz84VC8pY6FRROm",
  "meta": {
    "instanceId": "0e8fdabaa466e62faf8e9a5c8aa5dd452ffac3f7ec047a63d5c8b1d769a5fcf7",
    "templateId": "knowledge_store_agent_with_google_drive",
    "templateCredsSetupCompleted": true
  },
  "name": "Knowledge agent (with Google Drive, Telegram)",
  "tags": [],
  "nodes": [
    {
      "id": "708d9e4e-6566-4b18-86b8-8301bf0c72dd",
      "name": "Chargeur de données par défaut",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        384,
        -64
      ],
      "parameters": {
        "options": {},
        "dataType": "binary"
      },
      "typeVersion": 1.1
    },
    {
      "id": "604a4e5e-5ccc-4db1-94dc-673711bea6af",
      "name": "Télécharger le fichier",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -192,
        -240
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "LQ155GD7daIPvHOZ",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "e8db240e-bb3f-43ab-b4ed-527c6c2e8f54",
      "name": "Modèle d'embedding",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        144,
        -48
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "EwkNMKtlWGUUxIVL",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "99f9315f-4f3d-48d9-a6f4-8c519b249eba",
      "name": "Agent IA",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -352,
        320
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "# Knowledge Store Agent System Prompt\n\nYou are a data analysis agent that retrieves and analyzes information from a vector store to answer user questions.\n\n## Your Task\n\n1. **Search the vector store** - Use similarity search to find relevant documents and data\n2. **Analyze the results** - Understand what the retrieved data tells you\n3. **Provide clear answers** - Give helpful responses based on the data you found\n\n## How to Work with Vector Data\n\n### Search Process\n- Use the user's question to search for similar content\n- Retrieve multiple relevant chunks of data\n- Look for patterns and connections across the results\n- Consider both exact matches and conceptually similar information\n\n### Analysis Guidelines\n- Read through all retrieved documents carefully\n- Identify key information that answers the user's question\n- Note any conflicting or incomplete information\n- Look for trends, patterns, or insights in the data\n\n### Response Format\n- Start with a direct answer to the user's question\n- Support your answer with specific information from the data\n- Cite which documents or sources your information comes from\n- Be clear about what you found and what you didn't find\n\n## Response Guidelines\n\n### When You Find Good Data\n- Give a confident, detailed answer\n- Include relevant quotes or data points\n- Explain how the information relates to their question\n- Offer additional insights if available\n\n### When Data is Limited\n- Be honest about what information is available\n- Share what you did find, even if partial\n- Suggest related questions you could help with\n- Don't make up information not in the data\n\n### When No Relevant Data is Found\n- Clearly state that you couldn't find relevant information\n- Suggest alternative ways to phrase the question\n- Offer to search for related topics\n\n## Key Principles\n\n- Always base answers on the retrieved data\n- Be transparent about your sources\n- Admit when information is unclear or missing\n- Help users understand what the data shows\n- Ask clarifying questions if the user's request is vague\n\nRemember: Your strength is finding and explaining information that already exists in the vector store. Focus on being accurate and helpful with the data you can retrieve."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "9751b75b-50ac-49c8-8f4d-24a8035b6e73",
      "name": "Modèle",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -416,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "EwkNMKtlWGUUxIVL",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "167d097a-69f6-4f1b-a741-8c8936adb3d2",
      "name": "Mémoire simple",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -272,
        544
      ],
      "parameters": {
        "sessionKey": "={{ $json.message.chat.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "0cddc21e-a75f-48df-b168-8e288be12469",
      "name": "Fichier téléversé",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -608,
        -240
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1Nc_T_wHj8eF6LLed8D8hZX-q1YUeZT5j",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1Nc_T_wHj8eF6LLed8D8hZX-q1YUeZT5j",
          "cachedResultName": "Rag-Folder"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "LQ155GD7daIPvHOZ",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b60fde91-e9bf-4f03-a847-b471af228a95",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        -16
      ],
      "parameters": {
        "color": 5,
        "width": 304,
        "height": 512,
        "content": "### Knowledge store agent\nA chat-based AI agent to retrieve, analyze, and answer questions using documents uploaded to Google Drive and stored in a vector database.\n\n#### Set up\n- Configure credentials in the **Google Drive** and **Open AI** nodes\n- Create a folder in Google Drive to store your documents, then select it in the \"File uploaded\" trigger node\n- Upload a file to that folder, return to n8n and click \"Execute workflow\"\n- Once **Insert documents** has been completed you can Open chat and ask the agent questions about your files.\n\n#### Next steps\nTry connecting other data sources to your knowledge base, using other triggers before the **Insert documents** node.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2fa9684d-f20a-4262-9b8b-81babb2fecc5",
      "name": "Note adhésive 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        624
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 240,
        "content": "### Embeddings\n\nThe Insert and Retrieve operation use the same embedding node.\n\nThis is to ensure that they are using the **exact same embeddings and settings**.\n\nDifferent embeddings might not work at all, or have unintended consequences.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "64d17551-1637-4a53-a3e0-db45894c12a6",
      "name": "Insérer des documents",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        240,
        -240
      ],
      "parameters": {
        "mode": "insert",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key",
          "cachedResultName": "vector_store_key"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "4f8a4a45-28a4-4684-b838-66011cc6a4a5",
      "name": "Récupérer des documents",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        -288,
        0
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 10,
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key",
          "cachedResultName": "vector_store_key"
        },
        "toolDescription": "Use this tool to retrieve any information required."
      },
      "typeVersion": 1.3
    },
    {
      "id": "a5249962-686f-40fe-bee4-1b7d3bea5e79",
      "name": "Écouter les événements entrants",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -640,
        320
      ],
      "webhookId": "322dce18-f93e-4f86-b9b1-3305519b7834",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "23MJQt59L7oOwA07",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "36f64ae1-cd45-4c4d-a130-434240fae577",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueErrorOutput",
      "position": [
        32,
        320
      ],
      "webhookId": "b0c8b1dc-6607-4681-84d7-7e600348cb56",
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Listen for incoming events').first().json.message.from.id }}",
        "additionalFields": {
          "parse_mode": "Markdown",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "23MJQt59L7oOwA07",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "fede1a58-ea3d-45f3-a4fa-4b4a367dadea",
  "connections": {
    "9751b75b-50ac-49c8-8f4d-24a8035b6e73": {
      "ai_languageModel": [
        [
          {
            "node": "99f9315f-4f3d-48d9-a6f4-8c519b249eba",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "99f9315f-4f3d-48d9-a6f4-8c519b249eba": {
      "main": [
        [
          {
            "node": "36f64ae1-cd45-4c4d-a130-434240fae577",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "604a4e5e-5ccc-4db1-94dc-673711bea6af": {
      "main": [
        [
          {
            "node": "64d17551-1637-4a53-a3e0-db45894c12a6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0cddc21e-a75f-48df-b168-8e288be12469": {
      "main": [
        [
          {
            "node": "604a4e5e-5ccc-4db1-94dc-673711bea6af",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "167d097a-69f6-4f1b-a741-8c8936adb3d2": {
      "ai_memory": [
        [
          {
            "node": "99f9315f-4f3d-48d9-a6f4-8c519b249eba",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "e8db240e-bb3f-43ab-b4ed-527c6c2e8f54": {
      "ai_embedding": [
        [
          {
            "node": "64d17551-1637-4a53-a3e0-db45894c12a6",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "4f8a4a45-28a4-4684-b838-66011cc6a4a5",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "4f8a4a45-28a4-4684-b838-66011cc6a4a5": {
      "ai_tool": [
        [
          {
            "node": "99f9315f-4f3d-48d9-a6f4-8c519b249eba",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "708d9e4e-6566-4b18-86b8-8301bf0c72dd": {
      "ai_document": [
        [
          {
            "node": "64d17551-1637-4a53-a3e0-db45894c12a6",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "a5249962-686f-40fe-bee4-1b7d3bea5e79": {
      "main": [
        [
          {
            "node": "99f9315f-4f3d-48d9-a6f4-8c519b249eba",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

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é ?

Intermédiaire - RAG IA, IA Multimodale

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.

Informations sur le workflow
Niveau de difficulté
Intermédiaire
Nombre de nœuds13
Catégorie2
Types de nœuds11
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34