Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPT Vision new model issue #174

Open
Gisman4ik opened this issue Feb 16, 2024 · 2 comments
Open

GPT Vision new model issue #174

Gisman4ik opened this issue Feb 16, 2024 · 2 comments

Comments

@Gisman4ik
Copy link

Gisman4ik commented Feb 16, 2024

If you want to send img to gpt vision, you have to pass it in payload like this, where "content" - array

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

With new models in library i didn't find how to combine content parts into one array
Now library can send only one type of content part. And this is an error

{
    "model": "gpt-4-vision-preview",
    "temperature": 0,
    "messages": [
        {
            "role": "system",
            "content": "Be helpful"
        },
        {
            "role": "user",
            "content":  {
                    "type": "image_url",
                    "image_url": {
                        "url": "\{base64}",
                        "detail": "auto"
                    }
             }
    ],
    "max_tokens": 300
}

Is it bug or i just don't see it?

Also is't possible to send imageUrl as base64 string, only as URL

@kalafus
Copy link
Contributor

kalafus commented Feb 16, 2024

does this pull address the issue?

@Gisman4ik
Copy link
Author

does this pull address the issue?

Yes

tisfeng pushed a commit to tisfeng/OpenAI that referenced this issue May 11, 2024
vishnuravi pushed a commit to StanfordBDHG/OpenAI that referenced this issue May 15, 2024
vandyshev pushed a commit to vandyshev/OpenAI that referenced this issue Jun 19, 2024
* macpaw/main:
  Adds gpt-4o
  Fixes the `m4a` content type sent as `mp4` instead
  Update Models.swift
  gpt-4-vision-preview support fix and test MacPaw#169 MacPaw#174
vishnuravi added a commit to StanfordBDHG/OpenAI that referenced this issue Jul 23, 2024
* gpt-4-vision-preview support fix and test
MacPaw#169 MacPaw#174

* Update Models.swift

* Fixes the `m4a` content type sent as `mp4` instead

* Adds gpt-4o

* chore: add gpt-4o-mini support

Added the gpt-4o-mini model to Models.swift

* Fix merge conflict

* Update demo app

---------

Co-authored-by: James J Kalafus <[email protected]>
Co-authored-by: Quill Zhou <[email protected]>
Co-authored-by: Doğu Emre Demirçivi <[email protected]>
Co-authored-by: Sergii Kryvoblotskyi <[email protected]>
Co-authored-by: Kelvin Lau <[email protected]>
Co-authored-by: xAstralMars <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants