openai-cookbook icon indicating copy to clipboard operation
openai-cookbook copied to clipboard

openAI API not supporting Image processing

Open AhzamHassan opened this issue 1 year ago • 1 comments
trafficstars

I am trying to upload an image to get response from the openAI using its API but the response says, i am unable to process images. my code:

const completion = await openai.chat.completions.create({
      model: "gpt-4o",
messages: [
        {
          role: "system",
          content: "You are a helpful assistant, i am sharing an image with you please give me the solution for this math problem.",
        },
        {
          role: "user",
          content: JSON.stringify({
            type: "image_url",
            image_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",
          }),
        },
      ],
    });

Response (Postman):

{
    "data": {
        "role": "assistant",
        "content": "I'm sorry, but as a text-based AI, I'm unable to view or interpret images. However, if you describe the math problem to me or type it out, I'd be more than happy to assist you in solving it.",
        "refusal": null
    },
    "message": "Success",
    "success": true
}

AhzamHassan avatar Nov 18 '24 10:11 AhzamHassan