-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.js
More file actions
25 lines (21 loc) · 754 Bytes
/
Copy pathmodel.js
File metadata and controls
25 lines (21 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const { GoogleGenAI } = require("@google/genai");
const dotenv = require('dotenv');
dotenv.config();
const GEMINI_API_KEY = process.env.GEMINI_API_KEY;
const ai = new GoogleGenAI({
apiKey: process.env.GEMINI_API_KEY
});
async function generateQuestions(career){
const prompt = `Generate 10 interview questions for the career: ${career}. Please provide the questions in a JSON array format.`;
const response = await ai.models.generateContent({
model: "gemini-2.5-flash",
contents: prompt,
});
const cleanText = response.text
.replace(/```json/g, "")
.replace(/```/g, "")
.trim();
const questions = JSON.parse(cleanText);
return questions;
}
module.exports = { generateQuestions : generateQuestions }