AI Document Template Generator using Mistral and Qdrant RAG - n8n Workflow

Automate document processing using this advanced n8n workflow. It uses Mistral AI and Qdrant vector database for RAG to break down source files into study guides, timelines, and briefing docs.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Students and educators needing automated study material generation.
Knowledge managers seeking to convert long documents into actionable briefing materials.
Users looking for advanced examples of RAG and AI agent integration within an n8n workflow.
Developers seeking robust, real-world n8n templates utilizing vector databases like Qdrant.

Overview

This sophisticated n8n workflow addresses the challenge of manually synthesizing large documents into useful, structured study materials. By leveraging Retrieval-Augmented Generation (RAG) powered by the Qdrant vector store and Mistral AI models, this automation ensures accuracy and contextual relevance in the output. The primary goal of this n8n template is to take any uploaded source file (PDF, DOCX, TXT) and generate three predefined template documents: a Study Guide, a Timeline, and a Briefing Document. The core of this n8n workflow relies on a chain of AI agents (Mistral Cloud Chat Model) that interview the vectorized source material to generate high-quality, structured notes. This n8n workflow is perfect for maximizing productivity and creating custom n8n templates for specific documentation needs.

How it Works


  1. Trigger and Import: The process begins with the Local File Trigger, an essential n8n trigger, which monitors a specified directory for new file additions (specifically /home/node/storynotes/context). The file path is captured and processed by the Import File n8n node.

  2. Document Analysis: A Switch n8n node (Get FileType) directs the file to the appropriate Extract from... n8n node based on its type (PDF, DOCX, Text), preparing the raw text.

  3. Summarization and Vectorization: The extracted text is first summarized using the Summarization Chain (powered by Mistral AI). Simultaneously, the text is split by the Recursive Character Text Splitter and converted into embeddings using Embeddings Mistral Cloud. These embeddings are stored in the Qdrant Vector Store (collection 'storynotes') to build the RAG knowledge base.

  4. Template Definition Loop: The n8n workflow defines three target documents (Get Doc Types): Study Guide, Timeline, and Briefing Doc. The Split Out Doc Types and For Each Doc Type... n8n nodes initiate a loop, ensuring each template is generated sequentially.

  5. AI Agent Interview and Retrieval: Inside the loop, the Interview LLM Chain generates guiding questions based on the document summary. The subsequent Discover n8n node (a Retrieval QA Chain) uses these questions to query the Qdrant vector database, retrieving contextually relevant chunks of the original document. This retrieval process utilizes another Mistral Cloud Chat Model to formulate precise answers based on the context.

  6. Final Generation and Export: The retrieved answers are aggregated, and the final Generate LLM Chain constructs the full, formatted template document (using the specific instructions for Study Guide, Timeline, etc.). The resulting markdown content is converted to binary using the To Binary n8n node and written back to the local disk using the Export to Folder n8n node, completing the execution of this complex n8n workflow.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON code and import it directly into your n8n instance.

  2. Configure Credentials: This n8n workflow requires two sets of credentials:

Mistral Cloud API: Set up a Mistral Cloud account credential (required for all AI Chat Model and Embedding n8n nodes).
Qdrant API: Set up a Qdrant API credential (required for storing and retrieving vectors).

  1. Set Up Local File Trigger: Configure the Local File Trigger n8n node (a3af309b) to watch the directory where you will drop your source documents (e.g., PDF or DOCX files). The current path is set to /home/node/storynotes/context.

  2. Vector Store Setup: Ensure the Qdrant instance is running and accessible. The workflow targets the collection named storynotes.

  3. Activation: Save the n8n workflow and activate it. Dropping a file into the watched folder will initiate the n8n trigger and start the process.

Node Details

Local File Trigger (n8n trigger): The starting point of the n8n workflow. Monitors a local folder for new files, providing the path as input.
Get FileType (n8n node): A Switch node that inspects the file extension and routes the data stream to the correct extraction node (PDF, DOCX, or TEXT).
Summarization Chain (Langchain n8n node): Uses the Mistral Cloud Chat Model1 to quickly generate a summary of the source document, which is later used to guide the template generation process.
Qdrant Vector Store (Langchain n8n node, Insert Mode): The core component for RAG. It takes embeddings generated by the Embeddings Mistral Cloud n8n node and inserts the document chunks into the storynotes collection.
For Each Doc Type... (n8n node): A Split In Batches n8n node that loops through the predefined documentation templates (Study Guide, Timeline, Briefing Doc).
Interview (Langchain n8n node): An LLM Chain powered by Mistral AI that generates relevant, guiding questions based on the document summary for the specific template being created.
Discover (Langchain n8n node): A sophisticated RetrievalQa Chain that uses the questions generated in the previous step to perform semantic searches against the Qdrant vector database, ensuring accurate context retrieval for the final answer generation.
Generate (Langchain n8n node): The final LLM Chain that synthesizes the aggregated, retrieved context into the final formatted Markdown document, following the detailed instructions of the specific template.


  • Export to Folder (n8n node): Writes the final, AI-generated document (Study Guide, Timeline, or Briefing Doc) back to the local file system.

Related n8n Workflows

Free

Nodes: 22 Nodes
Updated: December 26 2025
View all
Created by
Jimleuk
Jimleuk

Freelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at [email protected] LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk

Featured*