Documentation
¶
Overview ¶
Package fabriqvec provides a fabriq VectorQuerier-backed implementation of the vectorstore.VectorStore interface. Each weave Entry is stored as a fabriq vector embedding keyed by Entry.ID, with the Entry's Content folded into the meta map under the key "content" and all remaining Metadata key/value pairs included alongside it.
Index ¶
- func EngineOption(c vessel.Vessel, opts ...Option) engine.Option
- type Option
- type Store
- func (s *Store) Delete(ctx context.Context, ids []string) error
- func (s *Store) DeleteByMetadata(ctx context.Context, filter map[string]string) error
- func (s *Store) Describe() weave.ComponentInfo
- func (s *Store) Search(ctx context.Context, vector []float32, opts *vectorstore.SearchOptions) ([]vectorstore.SearchResult, error)
- func (s *Store) Upsert(ctx context.Context, entries []vectorstore.Entry) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EngineOption ¶
EngineOption auto-discovers a fabriq facade from the DI container and wires it as weave's vector store. Returns a no-op option when no facade is present.
The container is keyed on query.Fabric, the port, not on the concrete *fabriq.Fabriq. Naming the concrete facade would link fabriq's composition root, and with it every adapter it wires. It also means an engine reached over the wire (*remote.Fabric, same port) drops in here unchanged.
Types ¶
type Option ¶
type Option func(*Store)
Option configures the Store.
func WithEntity ¶
WithEntity sets a custom fabriq entity name (default: "weave_vector").
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store bridges weave's VectorStore interface to fabriq's VectorQuerier port.
func New ¶
func New(vq query.VectorQuerier, opts ...Option) *Store
New creates a new fabriqvec Store backed by the given VectorQuerier.
func (*Store) Delete ¶
Delete removes entries by their IDs, under the Fabriq tenant of the weave tenant on ctx (weave.WithTenant), as the engine calls it. Without one it uses a Fabriq tenant already on ctx, and with neither it is ErrTenantRequired.
func (*Store) DeleteByMetadata ¶
DeleteByMetadata removes entries whose meta matches all key/value pairs in filter. Delegates to fabriq's DeleteByMeta (AND-of-equals semantics) under the Fabriq tenant filter["tenant_id"] names, which the engine always sends. An empty filter is ErrInvalidArgument and a filter without tenant_id is ErrTenantRequired.
func (*Store) Describe ¶
func (s *Store) Describe() weave.ComponentInfo
Describe reports the fabriq store. Its score is whatever fabriq returns, and how fabriq applies a tenant_id filter of "" has not been checked.
func (*Store) Search ¶
func (s *Store) Search(ctx context.Context, vector []float32, opts *vectorstore.SearchOptions) ([]vectorstore.SearchResult, error)
Search returns the most similar entries to the given vector. TenantKey is required (ErrTenantRequired without it) and scopes the search via tenant.WithTenant; MinScore post-filters results below the threshold; SearchResult.Vector is always nil (fabriq VectorQuerier does not return stored embeddings from Similar).
func (*Store) Upsert ¶
Upsert inserts or updates vector entries. Each Entry's Content is stored under the "content" meta key; remaining Metadata keys are stored alongside. An entry without metadata["tenant_id"] is ErrTenantRequired, and nothing in the batch is written.
Each entry is written under the Fabriq tenant its tenant_id names, which replaces any Fabriq tenant already on ctx: the engine labels every entry with the weave tenant and sets no Fabriq tenant of its own. A tenant_id Fabriq cannot accept as a tenant ID refuses the batch before anything is written.