Skip to content

Commit 61cd8e1

Browse files
committed
v4.0.0-beta.8
1 parent 347a227 commit 61cd8e1

40 files changed

+752
-699
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules
22
yarn-error.log
33
codegen.log
44
dist
5+
/deno
56
/*.tgz

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CHANGELOG.md
22
/ecosystem-tests
33
/node_modules
4+
/deno

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,15 @@ await openai.models.list({
230230
})
231231
```
232232

233-
## Status
233+
## Semantic Versioning
234234

235-
This package is in beta. Its internals and interfaces are not stable
236-
and subject to change without a major semver bump;
237-
please reach out if you rely on any undocumented behavior.
235+
This package generally attempts to follow [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
236+
237+
1. Changes that only affect static types, without breaking runtime behavior.
238+
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
239+
3. Changes that we do not expect to impact the vast majority of users in practice.
240+
241+
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
238242

239243
We are keen for your feedback; please open an [issue](https://www.github.com/openai/openai-node/issues) with questions, bugs, or suggestions.
240244

build

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ set -exuo pipefail
33

44
node scripts/check-version.cjs
55

6-
yarn tsc
7-
86
# Build into dist and will publish the package from there,
97
# so that src/resources/foo.ts becomes <package root>/resources/foo.js
108
# This way importing from `"openai/resources/foo"` works
119
# even with `"moduleResolution": "node"`
1210

13-
rm -rf dist
14-
mkdir dist
11+
rm -rf dist; mkdir dist
1512
# Copy src to dist/src and build from dist/src into dist, so that
1613
# the source map for index.js.map will refer to ./src/index.ts etc
1714
cp -rp src README.md dist
@@ -23,10 +20,10 @@ done
2320
node scripts/make-dist-package-json.cjs > dist/package.json
2421

2522
# build to .js/.mjs/.d.ts files
26-
tsc-multi
23+
npm exec tsc-multi
2724
# copy over handwritten .js/.mjs/.d.ts files
2825
cp src/_shims/*.{d.ts,js,mjs} dist/_shims
29-
tsc-alias -p tsconfig.build.json
26+
npm exec tsc-alias -- -p tsconfig.build.json
3027
# we need to add exports = module.exports = OpenAI Node to index.js;
3128
# No way to get that from index.ts because it would cause compile errors
3229
# when building .mjs
@@ -37,19 +34,22 @@ node scripts/fix-index-exports.cjs
3734
# the same export default statement)
3835
cp dist/index.d.ts dist/index.d.mts
3936

37+
SED=(sed -i)
38+
if [[ "$OSTYPE" == "darwin"* ]]; then SED=(sed -i ''); fi
39+
4040
# strip out lib="dom" and types="node" references; these are needed at build time,
4141
# but would pollute the user's TS environment
4242
REFERENCE_SUBS='s/^ *\/\/\/ *<reference *lib="dom".*//g;s/^ *\/\/\/ *<reference *types="node".*//g'
43-
if [[ "$OSTYPE" == "darwin"* ]]; then
44-
find dist -type f -exec sed -i '' "${REFERENCE_SUBS}" {} +
45-
else
46-
find dist -type f -exec sed -i "${REFERENCE_SUBS}" {} +
47-
fi
43+
find dist -type f -exec "${SED[@]}" "${REFERENCE_SUBS}" {} +
4844

49-
yarn prettier --loglevel=warn --write .
45+
npm exec prettier -- --loglevel=warn --write .
5046

5147
# make sure that nothing crashes when we require the output CJS or
5248
# import the output ESM
53-
cd dist
54-
node -e 'require("openai")'
55-
node -e 'import("openai")' --input-type=module
49+
(cd dist && node -e 'require("openai")')
50+
(cd dist && node -e 'import("openai")' --input-type=module)
51+
52+
if command -v deno &> /dev/null && [ -e ./build-deno ]
53+
then
54+
./build-deno
55+
fi

ecosystem-tests/ts-browser-webpack/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const model = 'whisper-1';
9393

9494
const params = new URLSearchParams(location.search);
9595

96-
const client = new OpenAI({ apiKey: params.get('apiKey') ?? undefined });
96+
const client = new OpenAI({ apiKey: params.get('apiKey') ?? undefined, dangerouslyAllowBrowser: true });
9797

9898
async function typeTests() {
9999
// @ts-expect-error this should error if the `Uploadable` type was resolved correctly

examples/azure.ts

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env yarn tsn -T
1+
#!/usr/bin/env -S npm run tsn -T
22

33
import OpenAI from 'openai';
44

examples/demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env yarn tsn -T
1+
#!/usr/bin/env -S npm run tsn -T
22

33
import OpenAI from 'openai';
44

examples/errors.ts

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env yarn tsn -T
1+
#!/usr/bin/env -S npm run tsn -T
22

33
import OpenAI, { NotFoundError } from 'openai';
44

examples/fine-tunes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env yarn tsn -T
1+
#!/usr/bin/env -S npm run tsn -T
22

33
/**
44
* Fine-tuning allows you to train models on your own data.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openai",
3-
"version": "4.0.0-beta.7",
3+
"version": "4.0.0-beta.8",
44
"description": "Client library for the OpenAI API",
55
"author": "OpenAI <[email protected]>",
66
"types": "dist/index.d.ts",
@@ -91,6 +91,7 @@
9191
"jest": "^29.4.0",
9292
"prettier": "rattrayalex/prettier#postfix-ternaries",
9393
"ts-jest": "^29.1.0",
94+
"ts-morph": "^19.0.0",
9495
"ts-node": "^10.5.0",
9596
"tsc-alias": "^1.8.6",
9697
"tsc-multi": "^1.1.0",

0 commit comments

Comments
 (0)