pg_vectorize  by ChuckHend

Postgres extension for building AI workloads

created 2 years ago
804 stars

Top 44.8% on sourcepulse

GitHubView on GitHub
Project Summary

pg_vectorize is a PostgreSQL extension that simplifies building AI applications by automating text-to-embedding transformations and integrating with LLMs. It targets developers and researchers who want to leverage their existing PostgreSQL data for vector search and Retrieval-Augmented Generation (RAG) without complex infrastructure setup. The extension offers a high-level API for seamless embedding management and LLM interaction directly within SQL.

How It Works

pg_vectorize leverages several key PostgreSQL extensions: pgvector for efficient vector similarity search, pgmq for background job orchestration, and pgrx for Rust-based extension development. It automates the creation of embeddings using specified models (like Hugging Face's Sentence-Transformers or OpenAI's embeddings) and stores them in new columns. For RAG, it integrates with LLMs like OpenAI's GPT models or local Ollama services, enabling conversational AI directly on PostgreSQL data. The extension supports real-time or cron-based embedding updates via triggers or scheduled jobs.

Quick Start & Requirements

  • Installation: The easiest method is via Docker Compose: docker compose up -d. Connect to PostgreSQL using docker compose exec -it postgres psql and enable the extension with CREATE EXTENSION vectorize CASCADE;.
  • Prerequisites: For existing PostgreSQL instances, requires Rust toolchain (pgrx), pg_cron (^1.5), pgmq (^1), and pgvector (^0.5.0). Configuration requires setting shared_preload_libraries and vectorize.embedding_service_url.
  • Resources: Running the Docker stack is recommended for quick setup.
  • Documentation: https://tembo.io/pg_vectorize/

Highlighted Details

  • Supports both vector search and RAG workflows.
  • Integrates with OpenAI embeddings/chat endpoints and self-hosted Hugging Face Sentence-Transformers.
  • Automates embedding updates via realtime triggers or cron schedules.
  • Provides direct SQL functions for text generation (vectorize.generate) and embedding encoding (vectorize.encode).
  • Allows importing pre-computed embeddings and creating tables from existing embeddings.

Maintenance & Community

  • Powers the VectorDB Stack on Tembo Cloud.
  • Community support available via Tembo Community Slack.
  • Open to community contributions.

Licensing & Compatibility

  • License: Apache 2.0.
  • Compatible with commercial and closed-source applications.

Limitations & Caveats

  • Requires specific PostgreSQL extension versions and Rust toolchain for self-hosting.
  • Embedding updates depend on correctly configured updated_at_col or schedule parameters.
Health Check
Last commit

3 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
0
Star History
27 stars in the last 90 days

Explore Similar Projects

Starred by Jared Palmer Jared Palmer(Ex-VP of AI at Vercel; Founder of Turborepo; Author of Formik, TSDX).

pgvector-node by pgvector

0.8%
399
Node.js library for pgvector support
created 4 years ago
updated 2 weeks ago
Feedback? Help us improve.