Documentation
¶
Overview ¶
Package vectorstore defines the pluggable interface for vector storage and similarity search.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
ID string `json:"id"`
Vector []float32 `json:"vector"`
Content string `json:"content"`
Metadata map[string]string `json:"metadata"`
}
Entry represents a single vector entry in the store.
type SearchOptions ¶
type SearchOptions struct {
// TopK is the maximum number of results to return.
TopK int `json:"top_k"`
// Filter restricts search to entries matching these metadata key-value pairs.
Filter map[string]string `json:"filter"`
// TenantKey is the namespace key for tenant isolation.
TenantKey string `json:"tenant_key"`
// MinScore is the minimum similarity score threshold.
MinScore float64 `json:"min_score"`
}
SearchOptions configures a vector similarity search.
type SearchResult ¶
SearchResult is an Entry paired with a similarity score.
type VectorStore ¶
type VectorStore interface {
// Upsert inserts or updates vector entries.
Upsert(ctx context.Context, entries []Entry) error
// Search returns the most similar entries to the given vector.
Search(ctx context.Context, vector []float32, opts *SearchOptions) ([]SearchResult, error)
// Delete removes entries by their IDs.
Delete(ctx context.Context, ids []string) error
// DeleteByMetadata removes entries matching the given metadata filter.
DeleteByMetadata(ctx context.Context, filter map[string]string) error
}
VectorStore is the pluggable interface for vector storage and retrieval. It is separate from the metadata store and holds the embeddings.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fabriqvec provides a fabriq VectorQuerier-backed implementation of the vectorstore.VectorStore interface.
|
Package fabriqvec provides a fabriq VectorQuerier-backed implementation of the vectorstore.VectorStore interface. |
|
Package memory provides an in-memory vector store using brute-force cosine similarity.
|
Package memory provides an in-memory vector store using brute-force cosine similarity. |
|
Package pgvector provides a PostgreSQL + pgvector implementation of the VectorStore interface.
|
Package pgvector provides a PostgreSQL + pgvector implementation of the VectorStore interface. |
Click to show internal directories.
Click to hide internal directories.