diff --git a/README.md b/README.md index 3e66766ab..7172ff706 100644 --- a/README.md +++ b/README.md @@ -315,7 +315,7 @@ The following runtimes are supported: - Node.js 16 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions. - Deno v1.28.0 or higher, using `import OpenAI from "npm:openai"`. - Deno Deploy is not yet supported. +- Bun 1.0 or later. - Cloudflare Workers. - Vercel Edge Runtime. diff --git a/ecosystem-tests/bun/README.md b/ecosystem-tests/bun/README.md index d4885a50c..05f68e2ca 100644 --- a/ecosystem-tests/bun/README.md +++ b/ecosystem-tests/bun/README.md @@ -11,5 +11,3 @@ To run: ```bash bun run index.ts ``` - -This project was created using `bun init` in bun v0.6.3. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. diff --git a/ecosystem-tests/bun/openai.test.ts b/ecosystem-tests/bun/openai.test.ts index 399b40c84..f6642c7cf 100644 --- a/ecosystem-tests/bun/openai.test.ts +++ b/ecosystem-tests/bun/openai.test.ts @@ -57,7 +57,7 @@ test(`streaming works`, async function () { // @ts-ignore avoid DOM lib for testing purposes if (typeof File !== 'undefined') { - test.todo('handles builtinFile', async function () { + test('handles builtinFile', async function () { const file = await fetch(url) .then((x) => x.arrayBuffer()) // @ts-ignore avoid DOM lib for testing purposes @@ -68,14 +68,14 @@ if (typeof File !== 'undefined') { }); } -test.todo('handles Response', async function () { +test('handles Response', async function () { const file = await fetch(url); const result = await client.audio.transcriptions.create({ file, model }); expectSimilar(result.text, correctAnswer, 12); }); -test.todo('handles fs.ReadStream', async function () { +test('handles fs.ReadStream', async function () { const result = await client.audio.transcriptions.create({ file: fs.createReadStream('sample1.mp3'), model, @@ -87,7 +87,7 @@ const fineTune = `{"prompt": "", "completion": "=1.0.0" + }, "scripts": { "tsc": "tsc" }, diff --git a/ecosystem-tests/bun/sample1.mp3 b/ecosystem-tests/bun/sample1.mp3 new file mode 100644 index 000000000..1e787cd7c Binary files /dev/null and b/ecosystem-tests/bun/sample1.mp3 differ diff --git a/package.json b/package.json index 02a50b866..a6e400fec 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,41 @@ "license": "Apache-2.0", "private": false, "exports": { + "./_shims/node-readable": { + "deno": { + "types": "./dist/_shims/node-readable.d.ts", + "require": "./dist/_shims/node-readable.js", + "default": "./dist/_shims/node-readable.mjs" + }, + "bun": { + "types": "./dist/_shims/node-readable-node.d.ts", + "require": "./dist/_shims/node-readable-node.js", + "default": "./dist/_shims/node-readable-node.mjs" + }, + "browser": { + "types": "./dist/_shims/node-readable.d.ts", + "require": "./dist/_shims/node-readable.js", + "default": "./dist/_shims/node-readable.mjs" + }, + "worker": { + "types": "./dist/_shims/node-readable.d.ts", + "require": "./dist/_shims/node-readable.js", + "default": "./dist/_shims/node-readable.mjs" + }, + "workerd": { + "types": "./dist/_shims/node-readable.d.ts", + "require": "./dist/_shims/node-readable.js", + "default": "./dist/_shims/node-readable.mjs" + }, + "node": { + "types": "./dist/_shims/node-readable-node.d.ts", + "require": "./dist/_shims/node-readable-node.js", + "default": "./dist/_shims/node-readable-node.mjs" + }, + "types": "./dist/_shims/node-readable.d.ts", + "require": "./dist/_shims/node-readable.js", + "default": "./dist/_shims/node-readable.mjs" + }, "./_shims/*": { "deno": { "types": "./dist/_shims/*.d.ts",