Partager via


IVectorStore.GetCollection<TKey,TRecord> Method

Definition

Get a collection from the vector store.

public Microsoft.SemanticKernel.Data.IVectorStoreRecordCollection<TKey,TRecord> GetCollection<TKey,TRecord> (string name, Microsoft.SemanticKernel.Data.VectorStoreRecordDefinition? vectorStoreRecordDefinition = default) where TRecord : class;
abstract member GetCollection : string * Microsoft.SemanticKernel.Data.VectorStoreRecordDefinition -> Microsoft.SemanticKernel.Data.IVectorStoreRecordCollection<'Key, 'Record (requires 'Record : null)> (requires 'Record : null)
Public Function GetCollection(Of TKey, TRecord) (name As String, Optional vectorStoreRecordDefinition As VectorStoreRecordDefinition = Nothing) As IVectorStoreRecordCollection(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.

vectorStoreRecordDefinition
VectorStoreRecordDefinition

Defines the schema of the record type.

Returns

A new IVectorStoreRecordCollection<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 vectorStoreRecordDefinition must be provided.

Applies to

See also