GoogleGeminiAPITests_NodeJS/scripts/prompt.js
2025-05-08 03:19:46 +00:00

35 lines
No EOL
759 B
JavaScript

import { GoogleGenAI } from "@google/genai";
class Tests {
#key;
#toolkit;
constructor () {
this.#key = process.env.GoogleGenAIKey;
this.#toolkit = new GoogleGenAI({ apiKey: this.#key });
}
async generate (model, contents) {
const response = await this.#toolkit.models.generateContent({
"model": model,
"contents": contents
});
return response;
};
async analyzefile (model, message, files) {
const contents = [
{ text: message }, ...files
];
const response = await this.#toolkit.models.generateContent({
model: model,
contents: contents
});
return response;
}
}
export default Tests;