-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 for custom SSL certs to be used by the APIClient classes #1204
Comments
Signed-off-by: Teodor-Dumitru Ene <teodord.ene@gmail.com>
How so? Can you share more about this? |
FWIW I think we are more likely to simply make it easier to configure a custom client, as discussed here: #1190 (comment) |
It has to do with connecting to multiple openai-compatible servers in the same piece of user code, while the various servers have different SSL certs. Continually setting and unsetting the env-var while running async code will lead to the wrong value being read at times. Wrapping everything in an asyncio lock ends up being more difficult than using the Apologies, I don't have any shareable reproduction steps. |
Got it, that makes sense - thank you. Do you think this would work just as well for you? import openai
client = openai.OpenAI(
http_client=openai.DefaultHttpxClient(verify=…),
) |
That solution would work¹. When I originally posted this I had not noticed the other discussion thread, but I've been keeping up since then. That's part of how I'm doing it already, and a Feel free to close this issue and the associated PR as completed, and I will keep an eye out for ¹ The pain with the |
Terrific, thank you! |
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
Currently, the APIClient classes allow for custom timeout, custom headers, custom max_retries, to be easily passed in as parameters.
The only way to pass in custom SSL certs are by one of these two options:
SSL_CERT_FILE
environment variable. This causes issues with async calls.http_client
. This causes inconsistencies, and is unnecessarily complicated when handling both Sync and Async clients through a 3rd party library like langchain.Instead,
verify
should be an argument that can be passed in just liketimeout
ormax_retries
.PR #1205 fixes this issue.
To Reproduce
Code snippets
No response
OS
Ubuntu 20.04.5 LTS
Python version
Python v.3.11.6
Library version
openai v1.13.3
The text was updated successfully, but these errors were encountered: