Missing reference in Chat Completions API - content "type"/"image_url"/"detail": "high" property

Hi all,

I’m following this cookbook - h*tps://cookbook.openai.com/examples/data_extraction_transformation#:~:text=high%20level%20of%20detail

It refers to the image_url object having “detail”: “high” property, along with url.

However, this property doesn’t seem to be covered in the Competions API docs - h*tps://platform.openai.com/docs/api-reference/chat/create

Any help will be much appreciated!

Best,

1 Like

Hi,

Can you post a code snippet that gets this error?

1 Like

Welcome to the community!

It’s pretty well hidden:
https://platform.openai.com/docs/api-reference/chat/create

you need to click on these tiny chevrons and expand

2 Likes

This is one of my image functions that works fine

def analyze_image_with_openai(image, client, custom_prompt):
    base64_image = encode_image(image)
    chat_completion = client.chat.completions.create(
        messages=[
            {
                "role": "user",
                "content": [
                    {"type": "text", "text": custom_prompt},
                    {
                        "type": "image_url",
                        "image_url": {
                            "url": f"data:image/png;base64,{base64_image}",
                            "detail": "high"
                        }
                    }
                ]
            }
        ],
        seed=42,
        temperature=0,
        max_tokens=300,
        model="gpt-4-vision-preview",
    )

    return chat_completion.choices[0].message.content
2 Likes

Hi Diet,

thank you for your prompt reply. I confirm that I found the description of these parameters on the official documentation page once I had expanded all the sections/chevrons/accordeons. Apologies for my oversight!

Best,
Ilya