This commit is contained in:
Lukian LEIZOUR 2023-03-02 16:26:41 +01:00
parent c997a4f034
commit 4afa276479
26 changed files with 1437 additions and 204 deletions

13
node_modules/openai/README.md generated vendored
View file

@ -23,7 +23,7 @@ const configuration = new Configuration({
const openai = new OpenAIApi(configuration);
const completion = await openai.createCompletion({
model: "text-davinci-002",
model: "text-davinci-003",
prompt: "Hello world",
});
console.log(completion.data.choices[0].text);
@ -39,7 +39,7 @@ All of the available API request functions additionally contain an optional fina
```javascript
const completion = await openai.createCompletion(
{
model: "text-davinci-002",
model: "text-davinci-003",
prompt: "Hello world",
},
{
@ -58,7 +58,7 @@ API requests can potentially return errors due to invalid inputs or other issues
```javascript
try {
const completion = await openai.createCompletion({
model: "text-davinci-002",
model: "text-davinci-003",
prompt: "Hello world",
});
console.log(completion.data.choices[0].text);
@ -72,13 +72,18 @@ try {
}
```
### Streaming completions
Streaming completions (`stream=true`) are not natively supported in this package yet, but [a workaround exists](https://github.com/openai/openai-node/issues/18#issuecomment-1369996933) if needed.
## 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, ... })`)
- 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-003", ... })`)
- Replace any `createCompletionFromModel(params)` calls with `createCompletion(params)`
## Thanks