Results Syntax different than Input Syntax

When using Text Generation I’m a bit confused as to why I am only getting the results content as a string. In other words the returning json/array: ‘choices’[0]‘content’ holds a string while playground code claims it should be an array containing “text”, “type”.

For example I would expect ‘choices’[0]‘content’ to return something like this:

{
   "text": "results text here...",
   "type": "text"
}

But instead ‘choices’[0]‘content’ simply returns:

"results text here..."

Am I missing something? Thanks

The input format allows you to send blocks of text or blocks of images.

The content field for assistant does not return images, however, so it does not employ or need these updates for image parts of content that were more recently introduced for input.

As content, you can also just send a single string instead of the array of objects, similar to what you receive.

Okay, I’ll try that. Thanks.
Just to provide some context, I’m trying to log my chat messages so I can inspect them. (The input/output mismatch was making things sloppy)

When using assistants in the chat is there a way to get the entire output easily like this example from the docs? :

const response = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [
    {
      "role": "user",
      "content": [{ "type": "text", "text": "knock knock." }]
    },
    {
      "role": "assistant",
      "content": [{ "type": "text", "text": "Who's there?" }]
    },
    {
      "role": "user",
      "content": [{ "type": "text", "text": "Orange." }]
    }
  ]
});

As of know I’m manually creating this object each time I send / receive but it would be great to have some kind of final call to get the entire conversation of messages.

Just append the most recent user input and assistant response to a similar “chat history” list of messages. This can be what maintains the state of past chats up to the most recent, for a presentation of memory.

There is not a combined feed-forward messages output; you have to construct it yourself.

Yes sir, that’s what I already have going on here! Didn’t know if I could make one final call and get it all + other metrics like inputs, cost, etc…
(I often have a habit of reinventing the wheel but for once my efforts seem justified)

Thank you for your help.