-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_models.js
More file actions
27 lines (23 loc) · 947 Bytes
/
debug_models.js
File metadata and controls
27 lines (23 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const { GoogleGenerativeAI } = require("@google/generative-ai");
require('dotenv').config();
async function listModels() {
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);
try {
console.log("Testing gemini-1.5-flash...");
const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });
const result = await model.generateContent("Hello");
console.log("Success with gemini-1.5-flash");
console.log(result.response.text());
} catch (error) {
console.error("Error with gemini-1.5-flash:", error.message);
}
try {
console.log("\nTesting gemini-pro...");
const model2 = genAI.getGenerativeModel({ model: "gemini-pro" });
const result2 = await model2.generateContent("Hello");
console.log("Success with gemini-pro");
} catch (error) {
console.error("Error with gemini-pro:", error.message);
}
}
listModels();