35 lines
No EOL
759 B
JavaScript
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; |