The provided examples for gpt-4-vision-preview are failing. It’s acting like there are no images attached at all(even saying there are no images to look at).
You can look at the prompt_tokens count of the failed call to see if an image was included.
Having OpenAI retrieve the images can be less reliable than your own image retrieval. Providers may block known OpenAI IP addresses, or OpenAI may respect a robots.txt file. You can download yourself and then call, resized to control costs, by the base64 format, and then see any URL errors before calling the API instead of merely having a confused AI.
Also check Python is 3.8-3.11, and OpenAI library is recent (1.12+).
I am using the official example, using get-4-vision to process an image, also has a error ‘openai.NotFoundError: Error code: 404 - {‘error’: {‘code’: ‘404’, ‘message’: ‘Resource not found’}}’
even if it works for text input.
Any insights?
response = client.chat.completions.create(
model=deployment_name, # model = “deployment_name”.
messages=[
{“role”: “system”, “content”: “Assistant is a large language model trained by OpenAI.”},
{“role”: “user”, “content”: “Who were the founders of Microsoft?”}
]
)
print(response)
print(response.model_dump_json(indent=2))
print(response.choices[0].message.content)
"
works well;
but with "
client = AzureOpenAI(
api_key=api_key,
api_version=api_version,
base_url=f"{api_base}openai/deployments/{deployment_name}/extensions",
)
response = client.chat.completions.create(
model=deployment_name,
messages=[
{ “role”: “system”, “content”: “You are a helpful assistant.” },
{ “role”: “user”, “content”: [
{
“type”: “text”,
“text”: “Describe this picture:”
},
{
“type”: “image_url”,
“image_url”: {
“url”: data_url
}
}
] }
],
max_tokens=2000
)
print(response.choices[0])
print(response.choices[0].message.content)
"
has the error 404.