Skip to content

Commit c71e355

Browse files
authored
Merge pull request #175 from openai/dev/logan/update-readme-example
Update README.md to use Chat Completions
2 parents 032cec6 + eea4632 commit c71e355

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const configuration = new Configuration({
2222
});
2323
const openai = new OpenAIApi(configuration);
2424

25-
const completion = await openai.createCompletion({
26-
model: "text-davinci-003",
27-
prompt: "Hello world",
25+
const chatCompletion = await openai.createChatCompletion({
26+
model: "gpt-3.5-turbo",
27+
messages: [{role: "user", content: "Hello world"}],
2828
});
29-
console.log(completion.data.choices[0].text);
29+
console.log(chatCompletion.data.choices[0].message);
3030
```
3131

3232
Check out the [full API documentation](https://platform.openai.com/docs/api-reference?lang=node.js) for examples of all the available functions.

0 commit comments

Comments
 (0)