Create NodeJS package
This commit is contained in:
parent
483c5bf4fd
commit
b6f1af0bb4
3 changed files with 65 additions and 0 deletions
22
scripts/prompt.js
Normal file
22
scripts/prompt.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
export default Tests;
|
Loading…
Add table
Add a link
Reference in a new issue