sashabaranov/go-openai

Add gpt-4o model

Opened this issue · 8 comments

4rc0s commented

gpt-4o now available and would be great to use. https://platform.openai.com/docs/models/gpt-4o

Can we tag the new commit that added the model?

Do we need to perform migration too?

https://platform.openai.com/docs/assistants/migration

payload = {
  "model": "gpt-4o",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What’s in this image?"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": f"data:image/jpeg;base64,{base64_image}"
          }
        }
      ]
    }
  ],
  "max_tokens": 300
}

response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload)

print(response.json())

Do we need to perform migration too?

https://platform.openai.com/docs/assistants/migration

has this migration implemented in the latest version?

I'm trying to use CreateThreadAndRun this function but the ThreadMessage struct has not been updated

type ThreadMessage struct {
	Role     ThreadMessageRole `json:"role"`
	Content  string            `json:"content"`
	FileIDs  []string          `json:"file_ids,omitempty"`
	Metadata map[string]any    `json:"metadata,omitempty"`
}

I think there should be Attachments field, no?

image image

Wasted an hour or two debugging before I realized the new attachments field still isn't supported yet. I'll see if I can create a PR otherwise I hope someone can get to it soon. Right now it's not possible at all to make a request with files with GPT-4o.

Any update here?

Any update here?

@735