FlowKit

n8n template · RAG Assistant Pack

Ingest PDFs into Supabase pgvector with n8n

First link of a RAG pipeline: this workflow exposes a webhook that accepts your PDFs, extracts the text, splits it into chunks, computes embeddings and inserts everything into a Supabase pgvector table. One curl command indexes a document.

Pipelineingestion-pdf-supabase-pgvector.json · 6 nodes
  1. Dépôt de PDF (Webhook)triggerWebhook
  2. Insérer dans la base vectorielleSupabase vector store
  3. Confirmer l'ingestionWebhook response

Attached AI sub-nodes

  • Chargeur de PDFDocument loader
  • Découpage du texteText splitter
  • Embeddings OpenAIOpenAI embeddings

The problem it solves

A documentation chatbot is only as good as its index: without a reliable ingestion pipeline, the vector store gets filled by hand, badly, then not at all. Ingestion is the unglamorous part of RAG — extraction, chunking, vectorization, metadata — and exactly the part worth standardizing.

By exposing it as a simple HTTP endpoint, this template makes indexing trivial: from a terminal, an internal form or another workflow, anything that can upload a file can feed your assistant.

How the workflow works, node by node

Node names are in French, exactly as they appear in the imported workflow — the logic is language-agnostic.

  1. 01

    Dépôt de PDF (Webhook)

    Webhook

    Receives the PDF as multipart (curl -F) on the flowkit-ingest path. The file arrives as binary data, ready for extraction.

  2. 02

    Insérer dans la base vectorielle

    Supabase vector store

    Root node in insert mode targeting the documents table: it orchestrates loading, chunking and embeddings from its three sub-nodes, then writes chunks, metadata and vectors to Supabase.

  3. 03

    Chargeur de PDF

    Document loader

    ai_document sub-node: extracts text from the PDF binary page by page — no prior conversion needed.

  4. 04

    Découpage du texte

    Text splitter

    ai_textSplitter sub-node: 1,000-character chunks with 150 overlap, the best precision/recall trade-off for business documents.

  5. 05

    Embeddings OpenAI

    OpenAI embeddings

    ai_embedding sub-node: text-embedding-3-small (1,536 dimensions), matching the table's vector(1536) column — dimensions must match on both sides.

  6. 06

    Confirmer l'ingestion

    Webhook response

    Returns a JSON confirmation to the caller once indexing completes: easy to integrate in a bulk-load script.

What you need to run it

  • n8n ≥ 1.60 with the LangChain nodes
  • A Supabase project with pgvector enabled and the match_documents function (full SQL in the pack guide)
  • An OpenAI API key (embeddings)
  • Text-based PDFs (for scans, add an OCR step upstream)

Customization ideas

  • Add metadata (client, version, confidentiality) to the loader to filter searches later
  • Tune chunkSize and chunkOverlap to your documents: shorter for FAQs, longer for contracts
  • Chain ingestion from Google Drive: a Drive trigger replaces the webhook, the rest stays put

FAQ

Frequently asked questions

How do I import this template into n8n?

Import ingestion-pdf-supabase-pgvector.json via 'Import from File', attach your Supabase and OpenAI credentials, run the pgvector SQL from the guide, activate, then test: curl -F 'file=@document.pdf' https://your-n8n/webhook/flowkit-ingest.

What PDF size can the workflow handle?

Reports of several hundred pages go through fine; the limit mostly comes from your reverse proxy's max request body (often 100 MB by default on self-hosted n8n). For whole corpora, call the webhook in a loop, one file at a time.

Can I re-ingest an updated document?

Yes, but delete its old chunks first (delete from documents where metadata->>'source' = '…'), otherwise both versions will coexist in search results.