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
{{ message }}
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
when using generateContent, the value of output.candidates[0].content.parts[0].text is sometimes empty. See
Actual vs expected behavior:
async function expected() {
const genAI = new GoogleGenerativeAI(process.env.GEMINI);
const MODEL = "gemini-2.0-flash-001";
const { response: output } = await genAI.getGenerativeModel({
model: MODEL,
systemInstruction: "you are a helpful assistant.",
generationConfig: {
maxOutputTokens: 1000,
temperature: 0,
}
}).generateContent("what is the capital of france?");
console.log(output.candidates[0].content.parts[0].text); // expected The capital of France is Paris.
}
async function actual() {
const genAI = new GoogleGenerativeAI(process.env.GEMINI);
const MODEL = "gemini-2.0-flash-001";
const { response: output } = await genAI.getGenerativeModel({
model: MODEL,
systemInstruction: "you are a helpful assistant.",
generationConfig: {
maxOutputTokens: 1000,
temperature: 0,
}
}).generateContent("what is the capital of france?");
console.log(output.candidates[0].content.parts[0].text); // actual "".
}
Any other information you'd like to share?
I'm struggling to reproduce this error consistently. Sometimes it works on retries. There is no indication from logs that we hit an api rate limit
Description of the bug:
when using generateContent, the value of output.candidates[0].content.parts[0].text is sometimes empty. See
Actual vs expected behavior:
Any other information you'd like to share?
I'm struggling to reproduce this error consistently. Sometimes it works on retries. There is no indication from logs that we hit an api rate limit