hprasath's picture
Upload 8 files
96f4037 verified
raw
history blame contribute delete
580 Bytes
const Groq = require('groq-sdk');
const dotenv = require("dotenv");
dotenv.config({ path: "./.env" });
const groq = new Groq({
apiKey: process.env.GROQ_API_KEY
});
async function generate(text, prompt) {
var res = await groq.chat.completions.create({
messages: [
{ role: "system", content: prompt },
//{ role: "assistant", content: prompt },
{ role: "user", content: text }
],
model: "gemma2-9b-it"
}).then(a => a.choices[0].message);
return res;
}
module.exports = { generate }