Templates / Maintain RAG embeddings with OpenAI, Postgres and auto drift rollback

Maintain RAG embeddings with OpenAI, Postgres and auto drift rollback

Ready for 3.0

by ResilNext ✓ · 238 views · created 2026-03-14 · Engineering, AI RAG

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 27 nodes and runs on a schedule (every day at 02:00) (plus 1 other trigger). Along the way it connects Postgres, Embeddings OpenAI and OpenAI Chat Model.

How it runs

Trigger: On a schedule (every day at 02:00) (plus 1 other trigger).

  1. Workflow Configuration (Edit Fields (Set)): sets 6 fields: documentSourceUrl, chunkSize, chunkOverlap…
  2. Fetch Documents from Source (HTTP Request): calls an HTTP API
  3. Fetch Previous Chunk Hashes (Postgres): run a query
  4. Chunk Documents & Compute Hash (Code): runs custom JavaScript code
  5. Detect Changed Chunks (Compare Datasets): uses Compare Datasets
  6. New Vector Store (Candidate) (Simple Vector Store): stores documents in the Simple vector store, with embeddings: OpenAI Embeddings; document loader: Document Loader
  7. Store Embedding Metadata (Code): runs custom JavaScript code
  8. Save Embedding Version Metadata (Postgres): uses Postgres
  9. Fetch Golden Questions (Postgres): run a query
  10. Fetch Previous Embeddings (Postgres): run a query

…plus 9 more steps. See the full node list below.

Services it uses

PostgresEmbeddings OpenAIOpenAI Chat Model

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 (14)

From the author

Overview This workflow implements a self-healing Retrieval-Augmented Generation (RAG) maintenance system that automatically updates document embeddings, evaluates retrieval quality, detects embedding drift, and safely promotes or rolls back embedding updates.…

Excerpt from ResilNext's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.