Repository navigation
Conversation
Author
|
Just found out that what I'm trying to do is already possible with import openai
import requests
def make_session():
s = requests.Session()
s.auth = ...
s.verify = ...
openai.requestssession = make_sessionFor async requests, there's similarly So I'll close this PR now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi! I'm working on a project that requires proxied access to OpenAI APIs. For that to work correctly, we need to customize both the
authandverifyarguments in (synchronous) requests, which isn't possible with the current client library.This pull request introduces a fairly general mechanism to pass arbitrary extra keyword arguments in requests. Since synchronous and asynchronous requests use different libraries under the hood (requests vs aiohttp), they have separate sets of arguments. For the project I'm working on we'd do something like:
An alternative to this is to provide the same API to customize
authandverifyfor both synchronous and asynchronou requests. However, the API of requests and aiohttp are quite different, so I'd like to propose this simpler alternative first.This is similar to #562, but is more general and uses module-level variables - the idea is that a certain user will use the same set of extra arguments for all OpenAI requests, in much the same way as they may customize
openai.api_basefor all their OpenAI requests.This fixes #561.
Thanks!