CtrlK
BlogDocsLog inGet started
Tessl Logo

g14wxz/rag-ingestion-trigger-pipeline

Configures database INSERT triggers that offload document chunking and embedding to Edge Functions.

94

Quality

94%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Risky

Do not use without reviewing

Overview
Quality
Evals
Security
Files

RAG Ingestion Trigger Pipeline

Configures database INSERT triggers that offload document chunking and embedding to Edge Functions.

Overview

This tile implements the ingestion half of a RAG system. When a raw document is inserted into the source table, a Postgres trigger fires an asynchronous HTTP request via pg_net to an Edge Function. The Edge Function chunks the document, generates embeddings, and stores the resulting vectors. The pipeline: INSERT raw doc -> trigger fires -> Edge Function chunks -> embeds -> stores vectors.

Reference

Pipeline Flow

  1. Client inserts a row into the document table.
  2. AFTER INSERT trigger calls pg_net.http_post() targeting the embedding Edge Function.
  3. Edge Function receives {id, content, metadata}.
  4. Edge Function splits content into chunks (configurable size).
  5. Edge Function calls the embedding model API for each chunk.
  6. Edge Function inserts vector rows into the target table with source document reference.
  7. Edge Function updates the document row status to embedded or failed.

Required Extensions

CREATE EXTENSION IF NOT EXISTS pg_net;
CREATE EXTENSION IF NOT EXISTS vector;

Status Flow

pending -> processing -> embedded | failed

Dependencies

  • supabase-mcp-verification — validates migrations.
  • pgvector-hnsw-index-selection — provides the target vector table and HNSW index configuration.
  • edge-function-background-orchestration — provides the Edge Function runtime pattern for the chunking/embedding worker.

Composition Position

Runs after pgvector-hnsw-index-selection creates the vector storage table. Runs before any retrieval tile (hybrid-search-rrf-pattern, retrieval-threshold-guard) that queries the stored vectors.

Workspace
g14wxz
Visibility
Public
Created
Last updated
Publish Source
CLI
Badge
g14wxz/rag-ingestion-trigger-pipeline badge