Method AddVectorStore
- Namespace
- Qavren.Edge.VectorData
- Assembly
- Qavren.Edge.VectorData.dll
AddVectorStore(EdgeBuilder, Action<EdgeVectorStoreOptions>?)
Registers EdgeVectorStore and MEVD's VectorStore over the named
sub-project 1 database, plus the diagnostics contributor and the lifecycle observer.
Embedding generator resolution, which is what makes the four-call path work. The
registered factory resolves IEmbeddingGenerator from the container with
GetService - never GetRequiredService, because a store used only with
pre-computed ReadOnlyMemory<T> vectors needs no generator and demanding one
would break that. The result goes to EdgeVectorStore's
embeddingGenerator parameter, which applies it only where
EmbeddingGenerator is still null.
The query generator is then resolved from the generator itself, by service key, with
no reference to Qavren.Edge.Embeddings.Onnx: the key is this package's own
QueryGeneratorServiceKey, the call is GetService rather
than the ONNX package's AsQueryGenerator() convenience, and it asks for the
non-generic IEmbeddingGenerator - a third-party generator may be typed
IEmbeddingGenerator<DataContent, Embedding<float>>, and asking for a
closed generic it does not implement would return null and quietly lose the query lane.
Builder-call order does not matter, because the factory runs at resolve time.
public static EdgeBuilder AddVectorStore(this EdgeBuilder builder, Action<EdgeVectorStoreOptions>? configure = null)
Parameters
builderEdgeBuilderThe Qavren.Edge builder.
configureAction<EdgeVectorStoreOptions>Configures the store options.
Returns
- EdgeBuilder
The builder, for chaining.
AddVectorStore(EdgeBuilder, string, Action<EdgeVectorStoreOptions>?)
Keyed variant. Resolves the keyed IEmbeddingGenerator under the same
name first, then the unkeyed one, so a named store pairs with a named
generator by convention.
public static EdgeBuilder AddVectorStore(this EdgeBuilder builder, string name, Action<EdgeVectorStoreOptions>? configure = null)
Parameters
builderEdgeBuilderThe Qavren.Edge builder.
namestringThe service key the store registers under.
configureAction<EdgeVectorStoreOptions>Configures the store options.
Returns
- EdgeBuilder
The builder, for chaining.