You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting a system instruction using a string input in the startChat function call does not convert the string into a system part as required by the API endpoint.
Steps and code to reproduce issue
Code
const vertexSDK = getVertexAI(app);const genModel = getGenerativeModel(vertexSDK, {
model: 'gemini-2.0-flash',
});
const chat = genModel.startChat({
systemInstruction: 'talk like a pirate'
});
const response = await chat.sendMessage('how are you today?');
console.log(response.response.text);
Error
error FirebaseError: VertexAI: Error fetching from https://firebasevertexai.googleapis.com/v1beta/projects/_/locations/us-central1/publishers/google/models/gemini-2.0-flash:generateContent: [400 ] Invalid value at 'system_instruction' (type.googleapis.com/google.cloud.aiplatform.v1beta1.Content), "talk like a pirate" [{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"system_instruction","description":"Invalid value at 'system_instruction' (type.googleapis.com/google.cloud.aiplatform.v1beta1.Content), \"talk like a pirate\""}]}] (vertexAI/fetch-error)
The text was updated successfully, but these errors were encountered:
Operating System
MacOS
Environment (if applicable)
node 22
Firebase SDK Version
11.1.0
Firebase SDK Product(s)
VertexAI
Project Tooling
Vite and NodeJS
Detailed Problem Description
Setting a system instruction using a string input in the startChat function call does not convert the string into a system part as required by the API endpoint.
Steps and code to reproduce issue
Code
Error
The text was updated successfully, but these errors were encountered: