Skip to content
NEWMarketplace and your team: sell what you build, and get plans and changes that are tested before you see them. See what is new

Library / RAG & Knowledge Bases

RAG & Knowledge Bases

Convert PDFs and Office files to RAG-ready Markdown with Apify and OpenAI

Runs from a form where users submit document links, converts them to heading-aware Markdown chunks with page numbers via Apify, and stores them for OpenAI answers with citations.

What it does

## Chat with your PDF and Office files, with page citations Who's it for: teams and solo builders who want answers from their own documents (contracts, manuals, reports, slide decks, spreadsheets, scans) with the file and page each answer comes from. How it works 1. Add documents is a form: paste links to PDF, DOCX, PPTX, XLSX, HTML, EPUB or image files. 2. Convert to Markdown runs the Apify Actor *Document to Markdown*. It keeps headings and tables (also borderless PDF tables), reads scanned pages with OCR, and returns heading-aware chunks with page numbers. 3. Store chunks embeds each chunk with OpenAI and saves it in a vector store, with file, title, page and heading as metadata. 4. Chat with your documents opens a chat. The AI agent searches the store, answers only from what it finds and cites (title, p. N). How to set up 1. Create a free Apify account and copy your API token (Apify Console → Settings → API & Integrations). 2. In Convert to Markdown, create a *Header Auth* credential: name Authorization, value Bearer YOUR_APIFY_TOKEN. 3. Add your OpenAI credential to the two embeddings nodes and the chat model. 4. Click Execute workflow to open the form, paste a few file links and submit. When the run finishes, click Open chat and ask a question. Requirements: Apify account ($2 per 1,000 pages, $5 per 1,000 OCR pages) and an OpenAI API key (embeddings cost a few cents per 1,000 pages). How to customize - The Simple Vector Store lives in n8n's memory and is cleared on restart. For production, swap both vector store nodes for Pinecone, Qdrant, Supabase or Postgres (PGVector) with the same embeddings. - Feed files from Google Drive, Dropbox or S3 with a pre-signed link instead of the form. - Change the chunk size in Configure. Keep chunk size plus overlap under 1,000 characters, or the loader splits the chunks again.

The steps

  1. Add documents
  2. Configure
  3. Convert to Markdown
  4. One item per chunk
  5. Store chunks
  6. Embeddings for storing
  7. Chunk text and metadata
  8. Chat with your documents
  9. AI agent
  10. OpenAI chat model
  11. Conversation memory
  12. Search documents
  13. Embeddings for search

Similar automations