Convert PDFs and Office documents to RAG-ready Markdown with Apify and OpenAI
Ready for 3.0What this workflow does
This AI workflow has 13 nodes and runs when someone submits an n8n form (“Add documents to the knowledge base”) (plus 1 other trigger). Along the way it connects Embeddings OpenAI and OpenAI Chat Model. It also calls api.apify.com over HTTP.
How it runs
Trigger: When someone submits an n8n form (“Add documents to the knowledge base”) (plus 1 other trigger).
- Configure (Edit Fields (Set)): sets 3 fields: fileUrls, chunkSize, chunkOverlap
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; 1 tool (Search documents); memory: Conversation memory
- Convert to Markdown (HTTP Request): calls api.apify.com (POST)
- One item per chunk (Code): runs custom JavaScript code
- Store chunks (Simple Vector Store): stores documents in the Simple vector store, with embeddings: Embeddings for storing; document loader: Chunk text and metadata
Services it uses
HTTP calls to: api.apify.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (11)
- n8n Form Trigger
n8n-nodes-base.formTrigger - Edit Fields (Set)
n8n-nodes-base.set - HTTP Request
n8n-nodes-base.httpRequest - Code
n8n-nodes-base.code - Simple Vector Store
@n8n/n8n-nodes-langchain.vectorStoreInMemory - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow
From the author
Quick overview Paste document links into a form, convert them into Markdown chunks with page numbers using the Apify Document to Markdown Actor, store them with OpenAI embeddings, and chat with an AI agent that answers only from your files and cites the title…