Conversation
nfcampos
reviewed
Jan 12, 2023
openai/api_requestor.py
Outdated
Contributor
There was a problem hiding this comment.
Why do you prefer to change what the server sends here? iter_chunks returns exactly the chunks as received from the server
Contributor
Author
There was a problem hiding this comment.
When stress testing this I saw that iter_chunks would return multiple lines in a chunk maybe 1/3 of the time so I believe we still need to handle this edge case. We could go back to using iter_chunks rather than the regular async stream iterator though, you're right.
691f85d to
f3489d7
Compare
athyuttamre
approved these changes
Jan 13, 2023
cgayapr
pushed a commit
to cgayapr/openai-python
that referenced
this pull request
Dec 14, 2024
stainless-app bot
pushed a commit
that referenced
this pull request
Mar 27, 2025
Update README.md to mention which website the key lives on
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.
There were a bunch of mypy issues when I applied this internally so fixing them here.
Also deal with async stream line parsing a bit more robustly (iterating over an
aiohttp.StreamReaderby chunks could still return multiple lines so let's keep using the regular one and deal with multiple lines separately).Finally make sure that we correctly close the underlying session if an exception is raised while we're making the raw request.