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

Add gpt-4o model

Open 4rc0s opened this issue 1 year ago • 12 comments
trafficstars

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

4rc0s avatar May 13 '24 18:05 4rc0s

Can we tag the new commit that added the model?

JanRuettinger avatar May 13 '24 18:05 JanRuettinger

https://github.com/sashabaranov/go-openai/blob/master/completion.go#L25

https://github.com/sashabaranov/go-openai/commit/3b25e09da90715681fe4049955d7c7ce645e218c

jackmcguire1 avatar May 14 '24 15:05 jackmcguire1

Do we need to perform migration too?

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

vbrunko-voc avatar May 16 '24 18:05 vbrunko-voc

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())

xiaocode337317439 avatar May 21 '24 09:05 xiaocode337317439

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

RayendraSabandar avatar May 22 '24 11:05 RayendraSabandar

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.

dezchai avatar Jun 14 '24 21:06 dezchai

Any update here?

fernandops26 avatar Jun 17 '24 05:06 fernandops26

Any update here?

@735

dezchai avatar Jun 18 '24 04:06 dezchai

Can I upload pictures and request gpt-4o now?

DanDanDD avatar Jul 08 '24 08:07 DanDanDD

I switched my model to gpt-4o-mini and got this error:

"message": "Failed to send message to OpenAI: error, status code: 400, message: The requested model 'gpt-4o-mini' cannot be used with the Assistants API in v1. Follow the migration guide to upgrade to v2: https://platform.openai.com/docs/assistants/migration."

any update to switching model to newer version?

mojafa avatar Aug 13 '24 08:08 mojafa

With GPT 3.5 being shut down on Sep 14th, it's becoming quite urgent to get Assistants V2 file support into this library.

Devin-Licastro avatar Aug 14 '24 04:08 Devin-Licastro

A friend of mine told me that GPT-4o works, but I can't find anything on this anywhere, does it exist and if not when will support be added as 3.5 doesn't work anymore.

pateljoel avatar Oct 15 '24 05:10 pateljoel