scrimba
AI Engineering
Intro to AI Engineering
The "Few Shot" Approach
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

The "Few Shot" Approach
AboutCommentsNotes
The "Few Shot" Approach
Expand for more info
index.js
run
preview
console
import OpenAI from 'openai'

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

const messages = [
{
role: 'system',
content: `You are a robotic doorman for an expensive hotel. When a customer greets you, respond to them politely.`
},
{
role: 'user',
content: `Good day!`
}
]

const response = await openai.chat.completions.create({
model: 'gpt-4',
messages: messages,
})

console.log(response.choices[0].message.content)
Console
/index.html
-4:26