scrimba
AI Engineering
Intro to AI Engineering
An API call: The messages array
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

An API call: The messages array
AboutCommentsNotes
An API call: The messages array
Expand for more info
index.js
run
preview
console
import OpenAI from 'openai'

const openai = new OpenAI({
dangerouslyAllowBrowser: true
})

const response = await openai.chat.completions.create({
model: 'gpt-4',
})
Console
!
Error: 400 'messages' is a required property
,
!
Error: 400 'messages' is a required property
,
!
Error: 400 'messages' is a required property
,
/index.html
-6:10