Documentation
¶
Overview ¶
Package vector defines the interface for pluggable vector storage backends.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
// EmbeddingDimension returns the number of dimensions this backend expects.
EmbeddingDimension() int
// Store persists a chunk's embedding.
Store(ctx context.Context, id string, embedding []float64, metadata map[string]any) error
// Delete removes a chunk's embedding.
Delete(ctx context.Context, id string) error
// Search returns chunk IDs ranked by similarity to the query vector.
Search(ctx context.Context, query []float64, filter Filter, topK int) ([]SearchResult, error)
// StoreBatch persists multiple embeddings.
StoreBatch(ctx context.Context, items []StoreItem) error
// DeleteBatch removes multiple embeddings.
DeleteBatch(ctx context.Context, ids []string) error
// Ping checks backend connectivity.
Ping(ctx context.Context) error
}
Backend is the interface that all vector store implementations must satisfy.
type Filter ¶
type Filter struct {
// ChunkIDs restricts search to specific chunks (used for ACL filtering).
ChunkIDs []string
// Metadata filters on chunk metadata fields.
Metadata map[string]any
}
Filter constrains a similarity search.
type SearchResult ¶
SearchResult is a single result from a similarity search.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pgvector implements the vector.Backend interface using PostgreSQL with pgvector.
|
Package pgvector implements the vector.Backend interface using PostgreSQL with pgvector. |
|
Package vectortest provides a reusable conformance test suite for vector backends.
|
Package vectortest provides a reusable conformance test suite for vector backends. |
Click to show internal directories.
Click to hide internal directories.