Share via


RedisJsonVectorStoreRecordCollection<TRecord> Class

Definition

Service for storing and retrieving vector records, that uses Redis JSON as the underlying storage.

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

Type Parameters

TRecord

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

Inheritance
RedisJsonVectorStoreRecordCollection<TRecord>
Implements

Constructors

RedisJsonVectorStoreRecordCollection<TRecord>(IDatabase, String, RedisJsonVectorStoreRecordCollectionOptions<TRecord>)

Initializes a new instance of the RedisJsonVectorStoreRecordCollection<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(String, DeleteRecordOptions, CancellationToken)

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

DeleteBatchAsync(IEnumerable<String>, 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(String, 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<String>, 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