Get startedGet started for free

Decoding the response

The format of the output response from the Chat Completions endpoint is an object where the message can be accessed by selecting the appropriate fields.

In this example, you've just submitted a request to the API to list three Python libraries with the year they were first released, and it has returned a response.

For the response shown, what is the correct way to extract the content of the message only?

This exercise is part of the course

Developing AI Systems with the OpenAI API

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise