Share via


VectorStore.GetCollection<TKey,TRecord> Method

Definition

Gets a collection from the vector store.

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("This API is not compatible with NativeAOT. For dynamic mapping via Dictionary<string, object?>, use GetCollectionDynamic() instead.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("This API is not compatible with trimming. For dynamic mapping via Dictionary<string, object?>, use GetCollectionDynamic() instead.")]
public abstract Microsoft.Extensions.VectorData.VectorStoreCollection<TKey,TRecord> GetCollection<TKey,TRecord>(string name, Microsoft.Extensions.VectorData.VectorStoreCollectionDefinition? definition = default) where TRecord : class;
public abstract Microsoft.Extensions.VectorData.VectorStoreCollection<TKey,TRecord> GetCollection<TKey,TRecord>(string name, Microsoft.Extensions.VectorData.VectorStoreCollectionDefinition? definition = default) where TRecord : class;
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("This API is not compatible with NativeAOT. For dynamic mapping via Dictionary<string, object?>, use GetCollectionDynamic() instead.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("This API is not compatible with trimming. For dynamic mapping via Dictionary<string, object?>, use GetCollectionDynamic() instead.")>]
abstract member GetCollection : string * Microsoft.Extensions.VectorData.VectorStoreCollectionDefinition -> Microsoft.Extensions.VectorData.VectorStoreCollection<'Key, 'Record (requires 'Record : null)> (requires 'Record : null)
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.

Attributes

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