- +9
This template creates a powerful Retrieval Augmented Generation (RAG) AI agent workflow in n8n. It monitors a specified Google Drive folder for new PDF files, extracts their content, generates vector embeddings using Cohere, and stores these embeddings in a Milvus vector database. Subsequently, it enables a RAG agent that can retrieve relevant information from the Milvus database based on user queries and generate responses using OpenAI, enhanced by the retrieved context.
The workflow automates the process of ingesting documents into a vector database for use with a RAG system.
Watch New Files: Triggers when a new file (specifically targeting PDFs) is added to a designated Google Drive folder.
Download New: Downloads the newly added file from Google Drive.
Extract from File: Extracts text content from the downloaded PDF file.
Default Data Loader / Set Chunks: Processes the extracted text, splitting it into manageable chunks for embedding.
Embeddings Cohere: Generates vector embeddings for each text chunk using the Cohere API.
Insert into Milvus: Inserts the generated vector embeddings and associated metadata into a Milvus vector database.
When chat message received: Adapt the trigger tool to fit your needs.
RAG Agent: Orchestrates the RAG process.
Retrieve from Milvus: Queries the Milvus database with the user's chat query to find the most relevant chunks.
Memory: Manages conversation history for the RAG agent to optimize cost and response speed.
OpenAI / Cohere embeddings: Uses ChatGPT 4o for text generation.
To use this template, you will need:
An n8n instance (cloud or self-hosted).
Access to a Google Drive account to monitor a folder.
A Milvus instance or access to a Milvus cloud service like Zilliz.
A Cohere API key for generating embeddings.
An OpenAI API key for the RAG agent's text generation.
Set up the required credentials in n8n for Google Drive, Milvus, Cohere, and OpenAI.
Configure the "Watch New Files" node to point to the Google Drive folder you want to monitor for PDFs.
Ensure your Milvus instance is running and the target cluster is set up correctly.
Activate the workflow.
Add PDF files to the monitored Google Drive folder. The workflow will automatically process them and insert their embeddings into Milvus.
Interact with the RAG agent. The agent will use the data in Milvus to provide context-aware answers.
Automates document ingestion for RAG applications.
Leverages Milvus for high-performance vector storage and search.
Uses Cohere for generating high-quality text embeddings.
Enables building a context-aware AI agent using your own documents.
Support for More File Types: Extend the "Watch New Files" node and subsequent extraction steps to handle various document types (e.g., .docx, .txt, .csv, web pages) in addition to PDFs.
Error Handling and Notifications: Implement robust error handling for each step of the workflow (e.g., failed downloads, extraction errors, Milvus insertion failures) and add notification mechanisms (e.g., email, Slack) to alert the user.
Contact us at https://1node.ai