Rag.VectorStore.Pgvector (rag v0.3.4)

View Source

PostgreSQL pgvector implementation of VectorStore.Store.

Uses pgvector extension for efficient vector similarity search with L2 distance.

Usage

# Create a store with your Repo
store = %Rag.VectorStore.Pgvector{repo: MyApp.Repo}

# Insert documents
{:ok, count} = Rag.VectorStore.Store.insert(store, documents)

# Search by embedding
{:ok, results} = Rag.VectorStore.Store.search(store, embedding, limit: 10)

Requirements

  • PostgreSQL with pgvector extension
  • The rag_chunks table (see migrations in README)

Summary

Functions

Create a new Pgvector store.

Types

t()

@type t() :: %Rag.VectorStore.Pgvector{repo: module()}

Functions

new(opts)

@spec new(keyword()) :: t()

Create a new Pgvector store.

Options

  • :repo - The Ecto Repo module to use (required)

Examples

iex> Rag.VectorStore.Pgvector.new(repo: MyApp.Repo)
%Rag.VectorStore.Pgvector{repo: MyApp.Repo}