scrimba
Aside: How ChatGPT models work for chatbots
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

Aside: How ChatGPT models work for chatbots
AboutCommentsNotes
Aside: How ChatGPT models work for chatbots
Expand for more info
index.js
run
preview
console
import { Configuration, OpenAIApi } from 'openai';
import { process } from './env';

const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});

const openai = new OpenAIApi(configuration);

async function fetchFactAnswer() {
const response = await openai.createCompletion({
model: 'text-davinci-003',
prompt: ``,
max_tokens: 60
})
console.log(response.data.choices[0].text.trim())
}
Console
/index.html
-5:12