I ran the exact code given in the documentation for vision api.
But I got the below error. Same applies to gpt-4-turbo model. Am I missing something?
openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid type for 'messages[0].content[1].image_url': expected an object, but got a string instead.", 'type': 'invalid_request_error', 'param': 'messages[0].content[1].image_url', 'code': 'invalid_type'}}
Hi @ebobr , For me, the problem got solved when I did not include max_tokens in the request. But this is not an actual solution. Its a workaround we found. The problem with S3 bucket URLs still exist.
Le format des données renvoyé ne correspond plus à du json, voici un autre extrait de la documentation openai:
from openai import OpenAI
client = OpenAI()
audio_file = open(“speech.mp3”, “rb”)
transcript = client.audio.transcriptions.create(
model=“whisper-1”,
file=audio_file
)
{
“text”: “Imagine the wildest idea that you’ve ever had, and you’re curious about how it might scale to something that’s a 100, a 1,000 times bigger. This is a place where you can get to do that.”
}
Pour accéder à la réponse, auparavant on écrivait transcript[‘text’] (comme pour un dictionnaire) mais maintenant il faut écrire transcript.text : cela correspond plutot à l’attribut d’un objet d’une classe, bref on a récupère un objet et non du json …
J’ai l’impression que lors de la dernière grosse mise à jour d’openai l’année dernière , avec le passage de l’écriture du style openai.Audio.translate à client.audio.transcriptions.create , la mise à jour de la documentation n’a pas suivie et a fait un mixte des deux …
There are multiple methods to pass images to vision models, some support depending on which model you are using, and no grid of which model has which API message methods.
It should have been stated that there needs to be a ‘url’ key within the object corresponding to the ‘image_url’ key, and this ‘url’ key should contain the actual URL.