-
Notifications
You must be signed in to change notification settings - Fork 306
Closed
Labels
status:wontfixThis will not be worked onThis will not be worked on
Description
Actual Behavior
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async makeRequest (/Users/yubowen/Desktop/MyPrivate/node_modules/@google/generative-ai/dist/index.js:195:20)
at async generateContentStream (/Users/yubowen/Desktop/MyPrivate/node_modules/@google/generative-ai/dist/index.js:519:22)
Node.js v18.18.0

Steps to Reproduce the Problem
- npm install @google/generative-ai
const { GoogleGenerativeAI } = require("@google/generative-ai");
// Access your API key as an environment variable (see "Set up your API key" above)
const genAI = new GoogleGenerativeAI('xxxxxxxxxxxxxxxx');
async function run() {
// For text-only input, use the gemini-pro model
const model = genAI.getGenerativeModel({ model: "gemini-pro" });
const prompt = "Write a story about a magic backpack."
const chat = await model.startChat('');
const result = await chat.sendMessageStream(prompt);
let text = ''
for await (const chunk of result.stream) {
text += chunk.text();
}
console.log(text);
}
run();
- node index.js
Specifications
- Version: Node.js v18.18.0, "@google/generative-ai": "^0.1.3"
- Platform: macOS 12.6.5
Rocke1001feller, duke79, RageOfFire, pinakipatrapro, pashakbit and 3 more
Metadata
Metadata
Assignees
Labels
status:wontfixThis will not be worked onThis will not be worked on