Skip to content

Commit 262e8e3

Browse files
Merge pull request #1237 from openai/alpha-next
feat: alpha release
2 parents 21c3ed6 + d4bdc93 commit 262e8e3

File tree

219 files changed

+8336
-9550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+8336
-9550
lines changed

.eslintrc.js

+19
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ module.exports = {
55
'no-unused-vars': 'off',
66
'prettier/prettier': 'error',
77
'unused-imports/no-unused-imports': 'error',
8+
'no-restricted-imports': [
9+
'error',
10+
{
11+
patterns: [
12+
{
13+
group: ['openai', 'openai/*'],
14+
message: 'Use a relative import, not a package import.',
15+
},
16+
],
17+
},
18+
],
819
},
20+
overrides: [
21+
{
22+
files: ['tests/**', 'examples/**', 'ecosystem-tests/**'],
23+
rules: {
24+
'no-restricted-imports': 'off',
25+
},
26+
},
27+
],
928
root: true,
1029
};

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
branches:
88
- master
99
- next
10+
- alpha
1011

1112
jobs:
1213
lint:

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "4.77.0"
2+
".": "5.0.0-alpha.0"
33
}

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 68
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-0d64ca9e45f51b4279f87b205eeb3a3576df98407698ce053f2e2302c1c08df1.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-a39aca84ed97ebafb707ebd5221e2787c5a42ff3d98f2ffaea8a0dcd84cbcbcb.yml

CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Setting up the environment
22

3-
This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable).
3+
This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install).
44
Other package managers may work but are not officially supported for development.
55

66
To set up the repository, run:
@@ -29,10 +29,10 @@ All files in the `examples/` directory are not modified by the generator and can
2929
3030
```
3131

32-
```
33-
chmod +x examples/<your-example>.ts
32+
```sh
33+
$ chmod +x examples/<your-example>.ts
3434
# run the example against your api
35-
yarn tsn -T examples/<your-example>.ts
35+
$ yarn tsn -T examples/<your-example>.ts
3636
```
3737

3838
## Using the repository from source

README.md

+15-12
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ Request parameters that correspond to file uploads can be passed in many differe
303303

304304
```ts
305305
import fs from 'fs';
306-
import fetch from 'node-fetch';
307306
import OpenAI, { toFile } from 'openai';
308307

309308
const client = new OpenAI();
@@ -560,21 +559,23 @@ validate or strip extra properties from the response from the API.
560559

561560
### Customizing the fetch client
562561

563-
By default, this library uses `node-fetch` in Node, and expects a global `fetch` function in other environments.
562+
By default, this library expects a global `fetch` function is defined.
564563

565-
If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment,
566-
(for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`),
567-
add the following import before your first import `from "OpenAI"`:
564+
If you want to use a different `fetch` function, you can either polyfill the global:
568565

569566
```ts
570-
// Tell TypeScript and the package to use the global web fetch instead of node-fetch.
571-
// Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
572-
import 'openai/shims/web';
573-
import OpenAI from 'openai';
567+
import fetch from 'my-fetch';
568+
569+
globalThis.fetch = fetch;
574570
```
575571

576-
To do the inverse, add `import "openai/shims/node"` (which does import polyfills).
577-
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/openai/openai-node/tree/master/src/_shims#readme)).
572+
Or pass it to the client:
573+
574+
```ts
575+
import fetch from 'my-fetch';
576+
577+
const client = new OpenAI({ fetch });
578+
```
578579

579580
### Logging and middleware
580581

@@ -620,6 +621,8 @@ await client.models.list({
620621
});
621622
```
622623

624+
## Frequently Asked Questions
625+
623626
## Semantic versioning
624627

625628
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
@@ -634,7 +637,7 @@ We are keen for your feedback; please open an [issue](https://github.com/ope
634637

635638
## Requirements
636639

637-
TypeScript >= 4.5 is supported.
640+
TypeScript >= 4.9 is supported.
638641

639642
The following runtimes are supported:
640643

api.md

+44-45
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules
2+
/dist

0 commit comments

Comments
 (0)