File size: 596 Bytes
ceb943f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const { GoogleGenerativeAI } = require("@google/generative-ai");

const genAI = new GoogleGenerativeAI(process.env.GOOGLE_GENERATIVE_AI_API_KEY);

async function listModels() {
    try {
        const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });
        // There isn't a direct "list models" in the easy SDK, but we can try to run a simple prompt
        const result = await model.generateContent("Hello");
        console.log("Response success:", result.response.text());
    } catch (e) {
        console.log("Error generating content:", e.message);
    }
}

listModels();