-
Notifications
You must be signed in to change notification settings - Fork 5.1k
fix: await transport closure in AsyncOpenAI close method (#3541) #3620
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,9 +47,9 @@ def with_raw_response(self) -> UsersWithRawResponse: | |
| @cached_property | ||
| def with_streaming_response(self) -> UsersWithStreamingResponse: | ||
| """ | ||
| An alternative to `.with_raw_response` that doesn't eagerly read the response body. | ||
| An alternative to `.with_raw_response` that hooks into the response stream. | ||
|
|
||
| For more information, see https://www.github.com/openai/openai-python#with_streaming_response | ||
| For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers | ||
| """ | ||
| return UsersWithStreamingResponse(self) | ||
|
|
||
|
|
@@ -194,7 +194,7 @@ def list( | |
| query=maybe_transform( | ||
| { | ||
| "after": after, | ||
| "emails": emails, | ||
| "emails": emails if not isinstance(emails, (list, tuple)) else ",".join(emails), | ||
| "limit": limit, | ||
| }, | ||
| user_list_params.UserListParams, | ||
|
|
@@ -260,9 +260,9 @@ def with_raw_response(self) -> AsyncUsersWithRawResponse: | |
| @cached_property | ||
| def with_streaming_response(self) -> AsyncUsersWithStreamingResponse: | ||
| """ | ||
| An alternative to `.with_raw_response` that doesn't eagerly read the response body. | ||
| An alternative to `.with_raw_response` that hooks into the response stream. | ||
|
|
||
| For more information, see https://www.github.com/openai/openai-python#with_streaming_response | ||
| For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers | ||
| """ | ||
| return AsyncUsersWithStreamingResponse(self) | ||
|
|
||
|
|
@@ -373,7 +373,7 @@ def list( | |
| extra_query: Query | None = None, | ||
| extra_body: Body | None = None, | ||
| timeout: float | httpx.Timeout | None | NotGiven = not_given, | ||
| ) -> AsyncPaginator[OrganizationUser, AsyncConversationCursorPage[OrganizationUser]]: | ||
| ) -> AsyncConversationCursorPage[OrganizationUser]: | ||
| """ | ||
| Lists all of the users in the organization. | ||
|
|
||
|
|
@@ -407,7 +407,7 @@ def list( | |
| query=maybe_transform( | ||
| { | ||
| "after": after, | ||
| "emails": emails, | ||
| "emails": emails if not isinstance(emails, (list, tuple)) else ",".join(emails), | ||
| "limit": limit, | ||
| }, | ||
| user_list_params.UserListParams, | ||
|
|
@@ -481,16 +481,16 @@ class AsyncUsersWithRawResponse: | |
| def __init__(self, users: AsyncUsers) -> None: | ||
| self._users = users | ||
|
|
||
| self.retrieve = _legacy_response.async_to_raw_response_wrapper( | ||
| self.retrieve = async_to_streamed_response_wrapper( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For async Useful? React with 👍 / 👎. |
||
| users.retrieve, | ||
| ) | ||
| self.update = _legacy_response.async_to_raw_response_wrapper( | ||
| self.update = async_to_streamed_response_wrapper( | ||
| users.update, | ||
| ) | ||
| self.list = _legacy_response.async_to_raw_response_wrapper( | ||
| self.list = async_to_streamed_response_wrapper( | ||
| users.list, | ||
| ) | ||
| self.delete = _legacy_response.async_to_raw_response_wrapper( | ||
| self.delete = async_to_streamed_response_wrapper( | ||
| users.delete, | ||
| ) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The async client's
get_api_liststill returns anAsyncPaginator, and callers materialize the first page by awaiting it or iterate it asynchronously. Annotating this method as an already-materializedAsyncConversationCursorPagemakes exported types allowasync_client.admin.organization.users.list()to be used withoutawait, which will fail at runtime because the returned object is the paginator; the surrounding async list methods keep theAsyncPaginator[...]return type.Useful? React with 👍 / 👎.