Skip to content

Commit

Permalink
docs: declare Bun 1.0 officially supported (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Sep 15, 2023
1 parent 96bad31 commit a16e268
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 0 additions & 2 deletions ecosystem-tests/bun/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
14 changes: 7 additions & 7 deletions ecosystem-tests/bun/openai.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -87,7 +87,7 @@ const fineTune = `{"prompt": "<prompt text>", "completion": "<ideal generated te

// @ts-ignore avoid DOM lib for testing purposes
if (typeof Blob !== 'undefined') {
test.todo('toFile handles builtin Blob', async function () {
test('toFile handles builtin Blob', async function () {
const result = await client.files.create({
file: await toFile(
// @ts-ignore avoid DOM lib for testing purposes
Expand All @@ -99,7 +99,7 @@ if (typeof Blob !== 'undefined') {
expect(result.status).toEqual('uploaded');
});
}
test.todo('toFile handles Uint8Array', async function () {
test('toFile handles Uint8Array', async function () {
const result = await client.files.create({
file: await toFile(
// @ts-ignore avoid DOM lib for testing purposes
Expand All @@ -110,7 +110,7 @@ test.todo('toFile handles Uint8Array', async function () {
});
expect(result.status).toEqual('uploaded');
});
test.todo('toFile handles ArrayBuffer', async function () {
test('toFile handles ArrayBuffer', async function () {
const result = await client.files.create({
file: await toFile(
// @ts-ignore avoid DOM lib for testing purposes
Expand All @@ -121,7 +121,7 @@ test.todo('toFile handles ArrayBuffer', async function () {
});
expect(result.status).toEqual('uploaded');
});
test.todo('toFile handles DataView', async function () {
test('toFile handles DataView', async function () {
const result = await client.files.create({
file: await toFile(
// @ts-ignore avoid DOM lib for testing purposes
Expand Down
3 changes: 3 additions & 0 deletions ecosystem-tests/bun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "openai-bun-test",
"module": "index.ts",
"type": "module",
"engines": {
"bun": ">=1.0.0"
},
"scripts": {
"tsc": "tsc"
},
Expand Down
Binary file added ecosystem-tests/bun/sample1.mp3
Binary file not shown.
35 changes: 35 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit a16e268

Please sign in to comment.