const { OpenAI } = require('openai'); const openai = new OpenAI({ // apiKey: process.env['OPENAI_API_KEY'], apiKey: '', }); async function getLearningContent(prompt) { try { const chatCompletion = await openai.chat.completions.create({ model: 'gpt-3.5-turbo', messages: [{ role: 'user', content: prompt }], }); return chatCompletion.choices[0].message.content.trim(); } catch (error) { console.error('Error fetching content from OpenAI:', error); throw new Error('Failed to fetch learning content'); } } module.exports = { getLearningContent };