You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which is semi-useful, but as-implemented, it does mean the headers are unavailable for that request.
Headers contain extremely valuable information sometimes, even when there are exceptions, and the library should ideally still return the headers along with the exception somehow, so that on receiving an exception it's possible to still read the headers.
To Reproduce
try:
stream = sync_client.chat.completions.create(.... stream=True)
except Exception as e:
print(e)
print(vars(e))
print(stream)
raise e
stream is None, e is an exception with a bubbled up error message from the api, headers not available
Code snippets
seeaboveforcodesnippets.
OS
macOS
Python version
Python 3.10.12
Library version
openai 1.3.7 and above
The text was updated successfully, but these errors were encountered:
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
https://github.com/openai/openai-python/blob/main/src/openai/_base_client.py#L980 - raises exceptions if there's an HTTPStatusError, such as a 429, 500 etc.
Which is semi-useful, but as-implemented, it does mean the headers are unavailable for that request.
Headers contain extremely valuable information sometimes, even when there are exceptions, and the library should ideally still return the headers along with the exception somehow, so that on receiving an exception it's possible to still read the headers.
To Reproduce
stream is None, e is an exception with a bubbled up error message from the api, headers not available
Code snippets
OS
macOS
Python version
Python 3.10.12
Library version
openai 1.3.7 and above
The text was updated successfully, but these errors were encountered: