Documentation
¶
Overview ¶
Package pgvector implements the vector.Backend interface using PostgreSQL with pgvector.
Index ¶
- Constants
- type Backend
- func (b *Backend) Delete(ctx context.Context, id string) error
- func (b *Backend) DeleteBatch(ctx context.Context, ids []string) error
- func (b *Backend) EmbeddingDimension() int
- func (b *Backend) Ping(ctx context.Context) error
- func (b *Backend) Search(ctx context.Context, query []float64, filter vector.Filter, topK int) ([]vector.SearchResult, error)
- func (b *Backend) Store(ctx context.Context, id string, embedding []float64, metadata map[string]any) error
- func (b *Backend) StoreBatch(ctx context.Context, items []vector.StoreItem) error
Constants ¶
const DefaultEmbeddingDimension = 1536
DefaultEmbeddingDimension is the default dimension for the pgvector chunk_embeddings column. Must match the vector(N) in the migration.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend implements vector.Backend using pgvector cosine similarity.
func New ¶
New creates a new pgvector backend with the default embedding dimension (1536). coverage:ignore - requires pgvector
func NewWithDimension ¶
NewWithDimension creates a new pgvector backend with a custom embedding dimension. coverage:ignore - requires pgvector
func (*Backend) DeleteBatch ¶
DeleteBatch removes multiple embeddings. coverage:ignore - requires pgvector
func (*Backend) EmbeddingDimension ¶
EmbeddingDimension returns the number of dimensions this backend expects. coverage:ignore - requires pgvector
func (*Backend) Search ¶
func (b *Backend) Search(ctx context.Context, query []float64, filter vector.Filter, topK int) ([]vector.SearchResult, error)
Search returns chunk IDs ranked by cosine similarity. coverage:ignore - requires pgvector