EmbeddingGeneratorExtensions.GetService<TService> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Asks the IEmbeddingGenerator<TInput,TEmbedding> for an object of type TService
.
public static TService? GetService<TService>(this Microsoft.Extensions.AI.IEmbeddingGenerator generator, object? serviceKey = default);
static member GetService : Microsoft.Extensions.AI.IEmbeddingGenerator * obj -> 'Service
<Extension()>
Public Function GetService(Of TService) (generator As IEmbeddingGenerator, Optional serviceKey As Object = Nothing) As TService
Type Parameters
- TService
The type of the object to be retrieved.
Parameters
- generator
- IEmbeddingGenerator
The generator.
- serviceKey
- Object
An optional key that can be used to help identify the target service.
Returns
The found object, otherwise null
.
Exceptions
generator
is null
.
Remarks
The purpose of this method is to allow for the retrieval of strongly typed services that may be provided by the IEmbeddingGenerator<TInput,TEmbedding>, including itself or any services it might be wrapping.