Skip to content

IVectorSearchStore

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

The embedding-based semantic search store.

public interface IVectorSearchStore

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.

The embedding dimensionality the store expects.

int Dimensions { get; }

int

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)

tenantId string

The tenant identifier.

collection string

The collection name.

sourceId string

The source identifier to delete.

cancellationToken CancellationToken

The cancellation token.

ValueTask<int>

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)

tenantId string

The tenant identifier.

collection string

The collection name.

cancellationToken CancellationToken

The cancellation token.

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)

request VectorSearchRequest

The search request.

cancellationToken CancellationToken

The cancellation token.

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)

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.

ValueTask

ArgumentException

A chunk’s embedding length does not match IVectorSearchStore.Dimensions.