Skip to content

Allow logging request body #1522

Open
Open
@palvarezcordoba

Description

@palvarezcordoba

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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions