openai 3.1.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/test.yml +25 -0
- package/.openapi-generator/VERSION +1 -1
- package/README.md +9 -4
- package/api.ts +581 -58
- package/base.ts +5 -4
- package/common.ts +6 -4
- package/configuration.ts +1 -1
- package/dist/api.d.ts +412 -53
- package/dist/api.js +306 -31
- package/dist/base.d.ts +3 -4
- package/dist/base.js +1 -3
- package/dist/common.d.ts +4 -4
- package/dist/common.js +3 -1
- package/dist/configuration.d.ts +1 -1
- package/dist/configuration.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/index.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Node.js CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ master ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
node-version: [16.x, 18.x]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v3
|
|
19
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
+
uses: actions/setup-node@v3
|
|
21
|
+
with:
|
|
22
|
+
node-version: ${{ matrix.node-version }}
|
|
23
|
+
cache: 'npm'
|
|
24
|
+
- run: npm ci
|
|
25
|
+
- run: npm run build
|
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.4.0
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ const configuration = new Configuration({
|
|
|
23
23
|
const openai = new OpenAIApi(configuration);
|
|
24
24
|
|
|
25
25
|
const completion = await openai.createCompletion({
|
|
26
|
-
model: "text-davinci-
|
|
26
|
+
model: "text-davinci-003",
|
|
27
27
|
prompt: "Hello world",
|
|
28
28
|
});
|
|
29
29
|
console.log(completion.data.choices[0].text);
|
|
@@ -39,7 +39,7 @@ All of the available API request functions additionally contain an optional fina
|
|
|
39
39
|
```javascript
|
|
40
40
|
const completion = await openai.createCompletion(
|
|
41
41
|
{
|
|
42
|
-
model: "text-davinci-
|
|
42
|
+
model: "text-davinci-003",
|
|
43
43
|
prompt: "Hello world",
|
|
44
44
|
},
|
|
45
45
|
{
|
|
@@ -58,7 +58,7 @@ API requests can potentially return errors due to invalid inputs or other issues
|
|
|
58
58
|
```javascript
|
|
59
59
|
try {
|
|
60
60
|
const completion = await openai.createCompletion({
|
|
61
|
-
model: "text-davinci-
|
|
61
|
+
model: "text-davinci-003",
|
|
62
62
|
prompt: "Hello world",
|
|
63
63
|
});
|
|
64
64
|
console.log(completion.data.choices[0].text);
|
|
@@ -72,13 +72,18 @@ try {
|
|
|
72
72
|
}
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
+
### Streaming completions
|
|
76
|
+
|
|
77
|
+
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.
|
|
78
|
+
|
|
75
79
|
## Upgrade guide
|
|
76
80
|
|
|
77
81
|
All breaking changes for major version releases are listed below.
|
|
78
82
|
|
|
79
83
|
### 3.0.0
|
|
80
84
|
|
|
81
|
-
- 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-
|
|
85
|
+
- 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", ... })`)
|
|
86
|
+
- Replace any `createCompletionFromModel(params)` calls with `createCompletion(params)`
|
|
82
87
|
|
|
83
88
|
## Thanks
|
|
84
89
|
|