notmebotz-tools
Version:
Sebuah Tools yang berfungsi untuk mendownload Video atau Foto dari media sosial, serta sebagai tools yang berguna untuk aplikasi kamu seperti untuk BOT
24 lines (21 loc) • 620 B
JavaScript
const fs = require('fs');
const { GoogleGenerativeAI } = require("@google/generative-ai");
async function gemini(prompt, imagePath) {
const genAI = new GoogleGenerativeAI("AIzaSyBeBhBn8Q4bSwwF3Ku8QPd-7voUnucKDiw");
const model = genAI.getGenerativeModel({ model: "gemini-2.0-flash-exp" });
const imagePart = {
inlineData: {
data: fs.readFileSync(imagePath).toString("base64"),
mimeType: "image/png"
}
};
const result = await model.generateContent([prompt, imagePart]);
return {
author: "Herza",
status: 200,
msg: result.response.text()
};
}
module.exports = {
gemini
};