Difference in Content Format

Hello!

When specifying messages in the openai chat completion API, is there any difference between:
{ "role": "user", "content": "Hello!"
And:
{ "role": "user", "content": [ { "type": "text", "text": "Hello!", } ] }

Also is there any difference between having two user prompts with one message each or having one user prompt with two content text params?
messages=[{ "role": "user", "content": "hello1" }, { "role": "user", "content": "hello2" }]
And
messages=[{ "role": "user", "content": [{ "type": "text", "text": "hello1", } , { "type": "text", "text": "hello2", } ] }]

1 Like

There isn’t a difference in what the AI model receives between the two initial hello “content” shown.

The list of types is for multimodal content, such as passing multiple images or interleaving them with text.

If you have two “text” in a row within content, they are just appended together within that user message: "hello1hello2".

Multiple user messages are separately contained, and the AI will tend to act on just instructions of the most recent one.

1 Like