Skip to content

rag_bge_small_en_v15

rag_bge_small_en_v15: local bge-small-en-v1.5 embeddings in PostgreSQL

pgrag · rag_bge_small_en_v15: local bge-small-en-v1.5 embeddings in PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
100255rag_bge_small_en_v15pgrag0.0.0RAGApache-2.0Rust

PostgreSQL · 13, 14, 15, 16, 17, 18

Relationships
Requiresvector

Usage

Sources:

rag_bge_small_en_v15 runs the 33-million-parameter bge-small-en-v1.5 model locally to tokenize text, split model-aware chunks, and generate 384-dimensional passage or query embeddings. It is deprecated and no longer maintained.

Core Workflow

The model executes in a background worker, so preload the library and restart PostgreSQL before creating the extension:

shared_preload_libraries = 'rag_bge_small_en_v15.so'
CREATE EXTENSION vector;
CREATE EXTENSION rag_bge_small_en_v15;

SELECT rag_bge_small_en_v15.embedding_for_query(
    'What did the quick brown fox jump over?'
);

On macOS, the upstream instructions use .dylib instead of .so in shared_preload_libraries.

SQL API

  • rag_bge_small_en_v15.chunks_by_token_count(text, integer, integer) returns chunks bounded by model tokens with the requested overlap.
  • rag_bge_small_en_v15.embedding_for_passage(text) returns vector(384) for stored passages.
  • rag_bge_small_en_v15.embedding_for_query(text) returns vector(384) for search queries.

Operational Notes

The reviewed version is 0.0.0, non-relocatable, requires vector, and sets superuser = true. The worker starts with PostgreSQL but lazy-loads the model on first use; expect first-call latency and substantial memory use. The default build embeds the large ONNX model. A remote_onnx build downloads it after restart and should use a controlled URL. The repository pins patched ONNX Runtime dependencies and documents possible platform-specific symbol failures. Pin the entire build because the project is archived and deprecated.

Table reader