I am using the sample tutorial from GCP Vertex AI API docs:
const {VertexAI} = require('@google-cloud/vertexai');
/**
* TODO(developer): Update these variables before running the sample.
*/
async function analyze_pdf(projectId = 'PROJECT_ID') {
const vertexAI = new VertexAI({project: projectId, location: 'us-central1'});
const generativeModel = vertexAI.getGenerativeModel({
model: 'gemini-1.5-flash-001',
});
const filePart = {
file_data: {
file_uri: 'gs://cloud-samples-data/generative-ai/pdf/2403.05530.pdf',
mime_type: 'application/pdf',
},
};
const textPart = {
text: `
You are a very professional document summarization specialist.
Please summarize the given document.`,
};
const request = {
contents: [{role: 'user', parts: [filePart, textPart]}],
};
const resp = await generativeModel.generateContent(request);
const contentResponse = await resp.response;
console.log(JSON.stringify(contentResponse));
}
When calling generativeModel.generateContent({…}) I am getting the error,
"Error: GoogleGenerativeAIError: [VertexAI.GoogleGenerativeAIError]: got status: 500 Internal Server Error. {"error":{"code":500,"message":"Internal error encountered.","status":"INTERNAL"}}"
Is there a way to receive a more descriptive reason for the error from the Client API, or is there a known troubleshoot available?
I am able to upload to successfully Google Cloud Storage before this logic using ADC authentication, so I don’t think authentication is the issue. I also temporarily allowed the storage bucket public access, so I don’t think the issue is permission related(?)
I have tried to remove the filePart from the request, so that the call is:
const request = {
contents: [{role: 'user', parts: [textPart]}],
};
This works, so it must have something to do with retrieving the file from Cloud Storage, but I can’t figure out what that might be since I have allowed public access and have checked to make sure I am below the 30mb file limit.
purple zebra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.