Spaces:
Runtime error
Runtime error
| 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(); | |