Wrong type on image_url in chat completation api documentation

There are multiple methods to pass images, and also methods exclusive within Assistants.

Take for example this Python code, which gives alternating strings or base64 image (with size and capability under your control) as user message contents, without JSON-like “type”:

image_paths = ["./img1.png", "./img2.png"]
file_names = [os.path.basename(path) for path in image_paths]

base64_images = []
for path in image_paths:
    with open(path, "rb") as image_file:
        base64_image = base64.b64encode(image_file.read()).decode('utf-8')
        base64_images.append(base64_image)

# Construct the content to alternate between file names and images
picture_list = []
for file_name, base64_image in zip(file_names, base64_images):
    picture_list.append(file_name)
    picture_list.append({"image": base64_image})

user = [{
    "role": "user",
    "content": ["Briefly describe image contents. Images:\n\n"] + picture_list
}]

Therefore, one must actually identify what actually produces an error when sent directly to the API endpoint before calling something “wrong”.

The incorrect non-existent model name has gone a long time without correction. The phrase should be “an AI model supporting computer vision”.