Share via


VectorStoreExtensions.GetRequiredService<TRecord> Method

Definition

Asks the VectorStore for an object of the specified type serviceType and throws an exception if one isn't available.

public static object GetRequiredService<TRecord>(this Microsoft.Extensions.VectorData.VectorStore vectorStore, Type serviceType, object? serviceKey = default);
static member GetRequiredService : Microsoft.Extensions.VectorData.VectorStore * Type * obj -> obj
<Extension()>
Public Function GetRequiredService(Of TRecord) (vectorStore As VectorStore, serviceType As Type, Optional serviceKey As Object = Nothing) As Object

Type Parameters

TRecord

The record data model to use for retrieving data from the store.

Parameters

vectorStore
VectorStore

The vector store.

serviceType
Type

The type of object being requested.

serviceKey
Object

An optional key that can be used to help identify the target service.

Returns

The found object.

Exceptions

serviceType is null.

No service of the requested type for the specified key is available.

Applies to