GPT-4-Vision-Preview fidelity/detail-parameter

The API documentation mentions a detail parameter (low or high) which controls the resolution in which the model views the image. But its not clear how to pass that parameter in a request. Im using python and the openai package. This is a code snippet from my ai-class. Where would I add the detail parameter?

    def askAboutImage(self,npImg,prompt):
        messages = [{"role":"user","content":[{"type":"text","text":prompt},
                                             {"type":"image_url","image_url":f"data:image/jpeg;base64,{np2base64(npImg)}"}]}]
        response = self.client.chat.completions.create(model=self.model,
                                                       messages = messages,
                                                       max_tokens=300)
        print(response.choices[0])
4 Likes

This is totally unclear on the documentation, I’m looking everywhere and can’t find the answer. I don’t see any argument called “detail” anywhere in the code

1 Like

You can add the parameter like:

image_url: {
    url: "https://your-image-url.com",
    detail: "low",
}
4 Likes

@WildRoot It works! Thank you!!

What’s the default if not specified low or high?

My guess would be low, if I get chance, I’ll take a look at the API library code on git.

I just ran the same prompt with the same image input twice.The first time I specified ‘low’, which cost me 230 tokens and without specification it cost 1700. So its save to assume that the default is ‘high’.

Have you tried to compare without specification to high? I think that’s the last test to confirm.

Yes, by now I ran all 3 options:
‘high’
‘low’
without specification

I can confirm that the default is high.

1 Like

The default is auto, which means if the image is of low resolution then it converts it into 512*512 and processes it using 65 tokens, else it sets to high and uses 130 tokens