IVectorSearchStore
AgentPrism.Abstractions.dllThe embedding-based semantic search store.
public interface IVectorSearchStoreRemarks
Section titled “Remarks”There is no default implementation. The only
concrete implementation is in AgentPrism.PostgreSql and requires the
pgvector extension. A SQL Server or SQLite consumer may register
their own implementation; when none is registered, EnableVectorSearch = true
throws an explicit error at startup instead of silently returning an empty result.
This interface does not wrap Microsoft.Extensions.VectorData.VectorStore.
Measured (10.8.0): that type requires an
Expression<Func<TRecord,bool>> filter; translating an
expression tree breaks the AOT stance, and AgentPrism.PostgreSql is
AOT-compatible.
Properties
Section titled “Properties”Dimensions
Section titled “ Dimensions”The embedding dimensionality the store expects.
int Dimensions { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”DeleteSourceAsync(string, string, string, CancellationToken)
Section titled “ DeleteSourceAsync(string, string, string, CancellationToken)”Deletes all chunks of a source.
ValueTask<int> DeleteSourceAsync(string tenantId, string collection, string sourceId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
collection string
The collection name.
sourceId string
The source identifier to delete.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The number of deleted chunks.
ListSourcesAsync(string, string, CancellationToken)
Section titled “ ListSourcesAsync(string, string, CancellationToken)”Lists all source identifiers in a collection.
ValueTask<IReadOnlyList<string>> ListSourcesAsync(string tenantId, string collection, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
collection string
The collection name.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<string>>
The source identifiers, in alphabetical order.
SearchAsync(VectorSearchRequest, CancellationToken)
Section titled “ SearchAsync(VectorSearchRequest, CancellationToken)”Returns the chunks nearest to the embedding.
ValueTask<IReadOnlyList<VectorSearchHit>> SearchAsync(VectorSearchRequest request, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”request VectorSearchRequest
The search request.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<VectorSearchHit>>
Results ordered by ascending distance.
UpsertAsync(string, string, string, IReadOnlyList<VectorChunk>, CancellationToken)
Section titled “ UpsertAsync(string, string, string, IReadOnlyList<VectorChunk>, CancellationToken)”Writes chunks together with their embeddings. If the same source
(sourceId) is written again, the old chunks are deleted.
ValueTask UpsertAsync(string tenantId, string collection, string sourceId, IReadOnlyList<VectorChunk> chunks, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
collection string
The collection name.
sourceId string
The source identifier distinguishing the document.
chunks IReadOnlyList<VectorChunk>
The chunks to write.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”Exceptions
Section titled “Exceptions”A chunk’s embedding length does not match IVectorSearchStore.Dimensions.