Spaces:
Sleeping
Sleeping
File size: 580 Bytes
96f4037 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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 } |