Skip to content

Cannot inject custom http client for text to audio and audio to text services using open ai services #9277

Answered by RogerBarret0
giannik asked this question in Q&A
Discussion options

You must be logged in to vote

When using builder.Services you are targeting ServiceCollection which is a Dependency Injection focused collection.

To achieve your goal, you need to have a HttpClient added to your services DI Container so it can be injected automatically in the Connector Services.

AddOpenAITextToAudio code.

HttpClientProvider.GetHttpClient

public static HttpClient GetHttpClient(IServiceProvider? serviceProvider

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by RogerBarreto
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants