Share via


VectorStore.GetCollection<TKey,TRecord> Method

Definition

Gets a collection from the vector store.

public abstract Microsoft.Extensions.VectorData.VectorStoreCollection<TKey,TRecord> GetCollection<TKey,TRecord>(string name, Microsoft.Extensions.VectorData.VectorStoreCollectionDefinition? definition = default) where TRecord : class;
abstract member GetCollection : string * Microsoft.Extensions.VectorData.VectorStoreCollectionDefinition -> Microsoft.Extensions.VectorData.VectorStoreCollection<'Key, 'Record (requires 'Record : null)> (requires 'Record : null)
Public MustOverride Function GetCollection(Of TKey, TRecord) (name As String, Optional definition As VectorStoreCollectionDefinition = Nothing) As VectorStoreCollection(Of TKey, 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 collection.

Parameters

name
String

The name of the collection.

definition
VectorStoreCollectionDefinition

The schema of the record type.

Returns

A new VectorStoreCollection<TKey,TRecord> instance for managing the records in the collection.

Remarks

To successfully request a collection, either TRecord must be annotated with attributes that define the schema of the record type, or definition must be provided.

Applies to

See also