-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
Labels
Description
Confirm this is a feature request for the Python library and not the underlying OpenAI API.
- This is a feature request for the Python library
Describe the feature or improvement you're requesting
It would be nice to be able to be able to log the body of the requests.
I needed to see what was sent over the wire, so I checked how to log body requests.
Turns out, there's no way.
I needed to modify this, in order to do it.
openai-python/src/openai/_base_client.py
Lines 447 to 448 in 58bec2f
if log.isEnabledFor(logging.DEBUG): | |
log.debug("Request options: %s", model_dump(options, exclude_unset=True)) |
Could you add support to log body requests?
I'm not sure if this is the only place that has to change.
In fact, I just ended capturing network traffic just to be sure.
Having to resort to this kind of technique, is not nice.
I'm aware that you can log request/response using a custom httpx client with a custom transport: encode/httpx#3073
EDIT: the same applies to responses body
Additional context
No response
ketsapiwiq