Suppress HTTP Request: Post message

Every time that I call the client.chat.completions.create() function, I get the following message:

HTTP Request: POST my-endpoint//openai/deployments/gpt-35-xxxxx/chat/completions?api-version=date "HTTP/1.1 200 OK
"

Is there any way to suppress showing this message?

I’m not sure what you mean.

How is the message being shown? That’s a standard response message telling you the request was successful?

Are you just outputting the raw response to your users? Just don’t do that.

No, I am not outputting the response to the users in the terminal. That is processed separately through some API.
The above message does not include any part of response. It is just an information that the request (the chat completion request) was successfully sent, and it is shown in the server log. I just want to not getting that message.

Sorry. That’s standard protocol.

You’re free to delete the response message though.

That is odd. Basically you are saying there is no way to control the logger, right?

That’s not what I’m saying.

What it sounded like you were asking was how to get the message to not be sent.

I don’t know what’s controlling your logs so you’d need to look into that yourself.

But, I honestly don’t know what the issue is with it being in your logs, that’s what logs are for—to log what happened.

Maybe if you explained a bit more what you’re actually trying to do?

I am already set the status of each request in some managed logged in the application.
I print some logs in the terminal of the server. The way that OpenAI prints the logs in the terminal per request just creates a mess (think of few lines of logs per seconds) and I miss the info and warnings that created myself to be displayed in the terminal.

That is weird that there is no easy control over the OpenAI’s logger. When I searched for that looked like that there was a control for that (like openai.util.logger.setLevel(logging.ERROR) to only show errors), but it is no longer available.

Wow, those responses are frustrating to read.

I found another thread which fixed my issue, but this forum won’t let me post any links. Google “how-can-i-disable-openai-client-logs-in-python” posted no Nov 2023.

Basically add Assistant to your getLogger(). Hope this helps.

logger = logging.getLogger("Assitant")
2 Likes

I am not sure if you have resolved the issue. Here is my solution:

httpx_logger = logging.getLogger(“httpx”)
httpx_logger.setLevel(logging.WARNING)

2 Likes