-
-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow user to provide their own HTTP client. #47
Comments
Hello, thank you for mentioning this! Please, if you can, can you provide me with a clear explanation of the difference between having an internal http client and providing a way to assign a new one externally. and if I am getting it right, you mean that all methods in client.dart should use that http client, right? Thank you |
Exactly. Sometimes environments have specific requirements that cause devs to modify or create their own HTTP client. If we could optionally specify our own client and all methods used the custom http, devs could fix these problems without submitting issues here. |
Seems good to me, working on it! |
starting from 1.9.93, all package method that uses an HTTP client internally offers now the option to set your custom client to: final cmpl = await OpenAI.instance.completion.create(
// ...
client: MyCustomClient(),
); |
@anasfik is there a way to update the instance's client globally? This works for completions but I cannot use with other modules like transcription. |
Per this issue -- invertase/dart_edge#34 this library is hard to use with serverless functions. It would be nice if this library allowed users to provide their own HTTP client for use such as supabase or https://pub.dev/documentation/googleapis_auth/latest/auth_io/clientViaServiceAccount.html.
The text was updated successfully, but these errors were encountered: