daimon-plugin-pgvector 0.15.0

pgvector-backed VectorStore plugin for the Daimon AI agent framework
Documentation

daimon-plugin-pgvector

A pgvector-backed VectorStore plugin for the Daimon AI agent framework.

This crate provides [PgVectorStore], which stores document embeddings in PostgreSQL using the pgvector extension. It supports cosine, L2, and inner-product distance metrics with HNSW indexing.

Quick Start

use daimon_plugin_pgvector::{PgVectorStoreBuilder, DistanceMetric};
use daimon::retriever::SimpleKnowledgeBase;
use std::sync::Arc;

let store = PgVectorStoreBuilder::new("postgresql://user:pass@localhost/db", 1536)
    .table("my_docs")
    .distance_metric(DistanceMetric::Cosine)
    .build()
    .await?;

// Compose with an embedding model for a full RAG pipeline:
let kb = SimpleKnowledgeBase::new(embedding_model, store);

Manual Schema Setup

If you prefer to manage migrations yourself, disable auto-migration and use the SQL from [migrations]:

let store = PgVectorStoreBuilder::new(conn_str, 1536)
    .auto_migrate(false)
    .build()
    .await?;

Then run the SQL from [migrations::CREATE_EXTENSION], [migrations::create_table_sql], and [migrations::create_hnsw_index_sql] against your database.