Skip to content

Conversation

ddeville
Copy link
Contributor

@ddeville ddeville commented Jan 6, 2023

When a global session wasn't set in openai.aiosession, we would create a temp ClientSession on the fly. Unfortunately, this session wasn't scoped correctly since it was closed upon returning from arequest_raw but _interpret_async_response would later call await result.read() on the response, which would hang since the backing session had already been closed.

This patch ensures that the session is kept open for the duration of the request and the entire parsing of the response.

@ddeville ddeville requested a review from hallacy January 6, 2023 17:09
@ddeville ddeville force-pushed the damien/async-session-fix branch from 79ee0ba to 3c07c16 Compare January 6, 2023 19:57
@ddeville ddeville merged commit 7af43ce into main Jan 6, 2023
@ddeville ddeville deleted the damien/async-session-fix branch January 6, 2023 20:15
cgayapr pushed a commit to cgayapr/openai-python that referenced this pull request Dec 14, 2024
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.

2 participants