scrimba
Aside: Stop Sequence
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: Stop Sequence
AboutCommentsNotes
Aside: Stop Sequence
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: `List some great books to read on the topic of coding.`,
max_tokens: 400,
})
console.log(response.data.choices[0].text)
}

// fetchFactAnswer()
Console
/index.html
-3:15