Skip to content
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 passing requests.Session #390

Merged
merged 1 commit into from
Apr 27, 2023

Conversation

kristapratico
Copy link
Contributor

Allow the developer to control a request.Session that's reused for all requests, or provide a session factory to create and control the sessions used across threads.

Motivations:

  • Provides a path to synchronously refreshing and caching Azure AD tokens
  • Might help solve Connections aren't being closed #140 by giving developers the ability to close any open connections
  • Adds feature parity with async, where developers can set their own aiohttp.ClientSession and customize it to the needs of their application

@hallacy hallacy merged commit c556584 into openai:main Apr 27, 2023
eisber referenced this pull request in clemlesne/moaw-search Jun 12, 2023
Refresh OpenAI token every 25 minutes. The OpenAI SDK does not support token refresh, so we need to do it manually. We passe manually the token to the SDK. Azure AD tokens are valid for 30 mins, but we refresh every 25 minutes to be safe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants