Partager via


VolatileVectorStoreRecordCollection<TKey,TRecord> Class

Definition

Service for storing and retrieving vector records, that uses an in memory dictionary as the underlying storage.

public sealed class VolatileVectorStoreRecordCollection<TKey,TRecord> : Microsoft.SemanticKernel.Data.IVectorStoreRecordCollection<TKey,TRecord> where TRecord : class
type VolatileVectorStoreRecordCollection<'Key, 'Record (requires 'Record : null)> = class
    interface IVectorStoreRecordCollection<'Key, 'Record (requires 'Record : null)>
Public NotInheritable Class VolatileVectorStoreRecordCollection(Of TKey, TRecord)
Implements IVectorStoreRecordCollection(Of TKey, TRecord)

Type Parameters

TKey

The data type of the record key.

TRecord

The data model to use for adding, updating and retrieving data from storage.

Inheritance
VolatileVectorStoreRecordCollection<TKey,TRecord>
Implements

Constructors

VolatileVectorStoreRecordCollection<TKey,TRecord>(String, VolatileVectorStoreRecordCollectionOptions)

Initializes a new instance of the VolatileVectorStoreRecordCollection<TKey,TRecord> class.

Properties

CollectionName

Gets the name of the collection.

Methods

CollectionExistsAsync(CancellationToken)

Check if the collection exists in the vector store.

CreateCollectionAsync(CancellationToken)

Create this collection in the vector store.

CreateCollectionIfNotExistsAsync(CancellationToken)

Create this collection in the vector store if it does not already exist.

DeleteAsync(TKey, DeleteRecordOptions, CancellationToken)

Deletes a record from the vector store. Does not guarantee that the collection exists.

DeleteBatchAsync(IEnumerable<TKey>, DeleteRecordOptions, CancellationToken)

Deletes a batch of records from the vector store. Does not guarantee that the collection exists. Deletes will be made in a single request or in a single parallel batch depending on the available store functionality. If a record is not found, it will be ignored and the batch will succeed. If any record cannot be deleted for any other reason, the operation will throw. Some records may have already been deleted, while others may not, so the entire operation should be retried.

DeleteCollectionAsync(CancellationToken)

Delete the collection from the vector store.

GetAsync(TKey, GetRecordOptions, CancellationToken)

Gets a record from the vector store. Does not guarantee that the collection exists. Returns null if the record is not found.

GetBatchAsync(IEnumerable<TKey>, GetRecordOptions, CancellationToken)

Gets a batch of records from the vector store. Does not guarantee that the collection exists. Gets will be made in a single request or in a single parallel batch depending on the available store functionality. Only found records will be returned, so the resultset may be smaller than the requested keys. Throws for any issues other than records not being found.

UpsertAsync(TRecord, UpsertRecordOptions, CancellationToken)

Upserts a record into the vector store. Does not guarantee that the collection exists. If the record already exists, it will be updated. If the record does not exist, it will be created.

UpsertBatchAsync(IEnumerable<TRecord>, UpsertRecordOptions, CancellationToken)

Upserts a group of records into the vector store. Does not guarantee that the collection exists. If the record already exists, it will be updated. If the record does not exist, it will be created. Upserts will be made in a single request or in a single parallel batch depending on the available store functionality.

Applies to