EvanZhouDev / gemini-ai

The simpler JavaScript Gemini SDK
https://www.npmjs.com/package/gemini-ai
GNU General Public License v3.0
95 stars 16 forks source link

IMAGE Mime-Type error #3

Closed lynxionxs closed 6 months ago

lynxionxs commented 6 months ago

IMAGES ERROR: The API returns this error no matter what type of image i use

ERROR: .../node_modules/gemini-ai/index.js:87
        if (!response.ok) throw new Error("An error occurred when fetching Gemini: \n" + json.error.message);
                                ^
Error: An error occurred when fetching Gemini: 
* GenerateContentRequest.contents[0].parts[1].inline_data.mime_type: MIME type must be image/png, image/jpeg, image/webp, image/heic, or image/heif.
const imgBuffer = fs.readFileSync("./test.jpg");
const response = await gemini.ask("Explain in detail what's in this image.", {
    data: [imgBuffer],
});
console.log(response);
EvanZhouDev commented 6 months ago

Whoops my bad! Leftover code from a dependency that was removed broke it... should be fixed in gemini-ai@1.0.4—Please update!