openai-go icon indicating copy to clipboard operation
openai-go copied to clipboard

OfMessage/OfInputItemContentList cannot be used with assistant role

Open adambaratz opened this issue 3 months ago • 1 comments

It's possible to generate this JSON:

{
  "input": [
    {
      "content": [
        {
          "text": "write me a haiku about a sunset",
          "type": "input_text"
        }
      ],
      "role": "user"
    },
    {
      "content": [
        {
          "text": "Colors bleed and blend,  \nWhispers of the day retreat,  \nNight wraps the horizon.",
          "type": "input_text"
        }
      ],
      "role": "assistant"
    },
    {
      "content": [
        {
          "text": "mention the color red",
          "type": "input_text"
        }
      ],
      "role": "user"
    }
  ],
  "model": "gpt-4o-mini-2024-07-18"
}

Which in turn results in this error:

400 Bad Request { "message": "Invalid value: 'input_text'. Supported values are: 'output_text' and 'refusal'.", "type": "invalid_request_error", "param": "input[1].content[0]", "code": "invalid_value" }

adambaratz avatar Aug 19 '25 19:08 adambaratz