Table of Contents

Class SqliteVectorStore

Namespace
JD.AI.Core.Memory
Assembly
JD.AI.Core.dll

SQLite-based vector store using manual cosine similarity. For production, consider sqlite-vec extension or a dedicated vector DB.

public sealed class SqliteVectorStore : IVectorStore, IDisposable
Inheritance
SqliteVectorStore
Implements
Inherited Members

Constructors

SqliteVectorStore(string?)

public SqliteVectorStore(string? dbPath = null)

Parameters

dbPath string

Methods

CountAsync(CancellationToken)

Returns the total number of stored entries.

public Task<long> CountAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task<long>

DeleteAsync(IReadOnlyList<string>, CancellationToken)

Deletes entries by IDs.

public Task DeleteAsync(IReadOnlyList<string> ids, CancellationToken ct = default)

Parameters

ids IReadOnlyList<string>
ct CancellationToken

Returns

Task

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

SearchAsync(float[], int, string?, CancellationToken)

Searches for similar entries by embedding vector.

public Task<IReadOnlyList<MemorySearchResult>> SearchAsync(float[] queryEmbedding, int topK = 5, string? categoryFilter = null, CancellationToken ct = default)

Parameters

queryEmbedding float[]
topK int
categoryFilter string
ct CancellationToken

Returns

Task<IReadOnlyList<MemorySearchResult>>

UpsertAsync(IReadOnlyList<MemoryEntry>, CancellationToken)

Upserts entries with their embeddings.

public Task UpsertAsync(IReadOnlyList<MemoryEntry> entries, CancellationToken ct = default)

Parameters

entries IReadOnlyList<MemoryEntry>
ct CancellationToken

Returns

Task