Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevnayak committed Jun 7, 2022
1 parent 8e3b68e commit c732861
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const configuration = new Configuration({
});
const openai = new OpenAIApi(configuration);

const completion = await openai.createCompletion("text-davinci-001", {
const completion = await openai.createCompletion({
model: "text-davinci-002",
prompt: "Hello world",
});
console.log(completion.data.choices[0].text);
Expand All @@ -37,8 +38,8 @@ All of the available API request functions additionally contain an optional fina

```javascript
const completion = await openai.createCompletion(
"text-davinci-001",
{
model: "text-davinci-002",
prompt: "Hello world",
},
{
Expand All @@ -56,7 +57,8 @@ API requests can potentially return errors due to invalid inputs or other issues

```javascript
try {
const completion = await openai.createCompletion("text-davinci-001", {
const completion = await openai.createCompletion({
model: "text-davinci-002",
prompt: "Hello world",
});
console.log(completion.data.choices[0].text);
Expand All @@ -70,6 +72,14 @@ try {
}
```

## Upgrade guide

All breaking changes for major version releases are listed below.

### 3.0.0

- The function signature of `createCompletion(engineId, params)` changed to `createCompletion(params)`. The value previously passed in as the `engineId` argument should now be passed in as `model` in the params object (e.g. `createCompletion({ model: "text-davinci-002, ... })`)

## Thanks

Thank you to [ceifa](https://github.com/ceifa) for creating and maintaining the original unofficial `openai` npm package before we released this official library! ceifa's original package has been renamed to [gpt-x](https://www.npmjs.com/package/gpt-x).

0 comments on commit c732861

Please sign in to comment.