Closed Genzan closed 8 months ago
Hi Genzan,
Are you using gemini-pro-vision
as the model
in your request? Could you also confirm that the MIME type of your image matches what you've provided in the request? You may want to try passing image/jpeg
as the mime_type
value (note the added e
in jpeg).
Looking into this further it seems like image/jpeg
is the only valid MIME type for jpeg images (reference). Let us know if changing that fixes the issue.
closing as no further response from user. feel free re-open if @sararob 's reply doesn't solve the problem
Getting same error. I'm using demo code attached with repo @sararob
Hi Iam using the @google-cloud/vertexai using the documentation provided, but Keep getting this error once I call the generateContentStream
Error: [VertexAI.GoogleGenerativeAIError]: exception posting request
I even used the Autogenerated code on https://console.cloud.google.com/vertex-ai/generative/multimodal/create/text, but is the same error again and again, I did the command gcloud auth application-default login
And validate that file exist, What else Iam doing wrong?
const vertex_ai = new VertexAI({project: process.env.PROJECT_ID, location: process.env.LOCATION});
const generativeModel = vertex_ai.preview.getGenerativeModel({ model: model, generation_config: { "max_output_tokens": process.env.MAX_OUTPUT_TOKENS, "temperature": process.env.TEMPERATURE, "top_p": process.env.TOP_P, "top_k": process.env.TOP_K } });
const message = { contents: [{role: 'user', parts: [{inline_data: {mime_type: 'image/jpg', data: dogImage1}}, {text: 'Que raza de Perro es?'}]}], };
try{ const streamingResp = await generativeModel.generateContentStream(message); console.log('streamingResp',streamingResp);
} catch (error) { console.error('Error:', error.message); }