addOpenAITextToSpeechClient method
ServiceCollection
addOpenAITextToSpeechClient(
- String modelId,
- String apiKey, {
- OpenAIClientOptions? options,
- void configure()?,
Registers an OpenAITextToSpeechClient and its TextToSpeechClient abstraction as singletons.
Implementation
ServiceCollection addOpenAITextToSpeechClient(
String modelId,
String apiKey, {
OpenAIClientOptions? options,
void Function(TextToSpeechClientBuilder)? configure,
}) {
final inner = OpenAITextToSpeechClient(modelId, apiKey, options: options);
final builder = TextToSpeechClientBuilder(inner);
configure?.call(builder);
add(ServiceDescriptor.singleton<TextToSpeechClient>(
(_) => builder.build(),
));
add(ServiceDescriptor.singleton<OpenAITextToSpeechClient>((_) => inner));
return this;
}