Gpt-4-vision-preview not working - provided examples failing

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

Directly from the openai docs:

from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
  model="gpt-4-vision-preview",
  messages=[
    {
      "role": "user",
      "content": [
        {"type": "text", "text": "What’s in this image?"},
        {
          "type": "image_url",
          "image_url": {
            "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
            "detail": "high"
          },
        },
      ],
    }
  ],
  max_tokens=300,
)

print(response.choices[0].message.content)

Anyone else seeing this?

Works fine at low or high. That URL, or another.

from openai import OpenAI
client = OpenAI()

response = client.chat.completions.with_raw_response.create(
  model="gpt-4-vision-preview",
  messages=[
    {
      "role": "user",
      "content": [
        {"type": "text", "text": "What’s in this image?"},
        {
          "type": "image_url",
          "image_url": {
            "url": "https://i.imgur.com/oeYzasc.jpeg",
            "detail": "high"
          },
        },
      ],
    }
  ],
  max_tokens=300,
)

print(response.http_response.text)
print(f"time: {response.elapsed.total_seconds():.2f}s")

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’m getting the “server_error” message when using the same example as OP. “detail” does not work for me either.