OpenAIServiceCollectionExtensions extension

Provides extension methods for registering OpenAI clients in a ServiceCollection.

on

Methods

addOpenAIChatClient(String modelId, String apiKey, {OpenAIClientOptions? options, void configure(ChatClientBuilder)?}) ServiceCollection

Available on ServiceCollection, provided by the OpenAIServiceCollectionExtensions extension

Registers an OpenAIChatClient (optionally wrapped by configure) and its ChatClient abstraction as singletons.
addOpenAIEmbeddingGenerator(String modelId, String apiKey, {int? defaultModelDimensions, OpenAIClientOptions? options, void configure(EmbeddingGeneratorBuilder)?}) ServiceCollection

Available on ServiceCollection, provided by the OpenAIServiceCollectionExtensions extension

Registers an OpenAIEmbeddingGenerator (optionally wrapped by configure) and its EmbeddingGenerator abstraction as singletons.
addOpenAIImageGenerator(String modelId, String apiKey, {OpenAIClientOptions? options, void configure(ImageGeneratorBuilder)?}) ServiceCollection

Available on ServiceCollection, provided by the OpenAIServiceCollectionExtensions extension

Registers an OpenAIImageGenerator (optionally wrapped by configure) and its ImageGenerator abstraction as singletons.
addOpenAISpeechToTextClient(String modelId, String apiKey, {OpenAIClientOptions? options, void configure(SpeechToTextClientBuilder)?}) ServiceCollection

Available on ServiceCollection, provided by the OpenAIServiceCollectionExtensions extension

Registers an OpenAISpeechToTextClient and its SpeechToTextClient abstraction as singletons.
addOpenAITextToSpeechClient(String modelId, String apiKey, {OpenAIClientOptions? options, void configure(TextToSpeechClientBuilder)?}) ServiceCollection

Available on ServiceCollection, provided by the OpenAIServiceCollectionExtensions extension

Registers an OpenAITextToSpeechClient and its TextToSpeechClient abstraction as singletons.