Share via


VectorStoreCollection<TKey,TRecord> Class

Definition

Represents a named collection of records in a vector store, which can be used to search and manage records, and to create or delete the collection itself.

generic <typename TKey, typename TRecord>
 where TRecord : classpublic ref class VectorStoreCollection abstract : IDisposable, Microsoft::Extensions::VectorData::IVectorSearchable<TRecord>
public abstract class VectorStoreCollection<TKey,TRecord> : IDisposable, Microsoft.Extensions.VectorData.IVectorSearchable<TRecord> where TRecord : class
type VectorStoreCollection<'Key, 'Record (requires 'Record : null)> = class
    interface IVectorSearchable<'Record (requires 'Record : null)>
    interface IDisposable
Public MustInherit Class VectorStoreCollection(Of TKey, TRecord)
Implements IDisposable, IVectorSearchable(Of TRecord)

Type Parameters

TKey

The data type of the record key.

TRecord

The record data model to use for adding, updating, and retrieving data from the store.

Inheritance
VectorStoreCollection<TKey,TRecord>
Implements

Remarks

Unless otherwise documented, implementations of this abstract base class can be expected to be thread-safe, and can be used concurrently from multiple threads.

Constructors

VectorStoreCollection<TKey,TRecord>()

Properties

Name

Gets the name of the collection.

Methods

CollectionExistsAsync(CancellationToken)

Checks if the collection exists in the vector store.

DeleteAsync(IEnumerable<TKey>, CancellationToken)

Deletes a batch of records from the vector store. Does not guarantee that the collection exists.

DeleteAsync(TKey, CancellationToken)

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

Dispose()

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

Dispose(Boolean)

Disposes the VectorStoreCollection<TKey,TRecord> and releases any resources it holds.

EnsureCollectionDeletedAsync(CancellationToken)

Deletes the collection from the vector store if it exists.

EnsureCollectionExistsAsync(CancellationToken)

Creates this collection in the vector store if it doesn't already exist.

GetAsync(Expression<Func<TRecord,Boolean>>, Int32, FilteredRecordRetrievalOptions<TRecord>, CancellationToken)

Gets matching records from the vector store. Does not guarantee that the collection exists.

GetAsync(IEnumerable<TKey>, RecordRetrievalOptions, CancellationToken)

Gets a batch of records from the vector store. Does not guarantee that the collection exists.

GetAsync(TKey, RecordRetrievalOptions, CancellationToken)

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

GetService(Type, Object)

Asks the IVectorSearchable<TRecord> for an object of the specified type serviceType.

SearchAsync<TInput>(TInput, Int32, VectorSearchOptions<TRecord>, CancellationToken)

Searches the vector store for records that are similar to the given value.

UpsertAsync(IEnumerable<TRecord>, CancellationToken)

Upserts a batch of records into the vector store. Does not guarantee that the collection exists. If the record already exists, it is updated. If the record does not exist, it is created.

UpsertAsync(TRecord, CancellationToken)

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

Extension Methods

GetRequiredService<TRecord>(IVectorSearchable<TRecord>, Type, Object)

Asks the IVectorSearchable<TRecord> for an object of the specified type serviceType and throw an exception if one isn't available.

Applies to