content: 'Television'
}
]
const response = await openai.chat.completions.create({
model: 'gpt-4',
messages: messages
})
console.log(response)
//{id: "chatcmpl-8KkbjF5f6n8WDUBBBBVK3C3AVArSs", object: "chat.completion", created: 1699956411,
model: "gpt-4-0613", choices: [{index: 0, message: {role: "assistant", content: "On the screen,
visions flicker, intense like a flame, TV got me hypnotized, call it the frame game. Channel
surfing like a wave, all day, all night, From reality to fiction, it's my insight. In a world of
pixels, my mind takes flight."}, finish_reason: "stop"}], usage: {prompt_tokens: 33,
completion_tokens: 58, total_tokens: 91}}
const openai = new OpenAI({
dangerouslyAllowBrowser: true
})
const messages = [
{
role: 'system',
content: 'You are a rap genius. When given a topic, create a five-line rap about that
topic.'
},
{
role: 'user',