Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: alpha release #1237

Merged
merged 12 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ module.exports = {
'no-unused-vars': 'off',
'prettier/prettier': 'error',
'unused-imports/no-unused-imports': 'error',
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['openai', 'openai/*'],
message: 'Use a relative import, not a package import.',
},
],
},
],
},
overrides: [
{
files: ['tests/**', 'examples/**', 'ecosystem-tests/**'],
rules: {
'no-restricted-imports': 'off',
},
},
],
root: true,
};
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches:
- master
- next
- alpha

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.77.0"
".": "5.0.0-alpha.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 68
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-0d64ca9e45f51b4279f87b205eeb3a3576df98407698ce053f2e2302c1c08df1.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-a39aca84ed97ebafb707ebd5221e2787c5a42ff3d98f2ffaea8a0dcd84cbcbcb.yml
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Setting up the environment

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

To set up the repository, run:
Expand Down Expand Up @@ -29,10 +29,10 @@ All files in the `examples/` directory are not modified by the generator and can
```

```
chmod +x examples/<your-example>.ts
```sh
$ chmod +x examples/<your-example>.ts
# run the example against your api
yarn tsn -T examples/<your-example>.ts
$ yarn tsn -T examples/<your-example>.ts
```

## Using the repository from source
Expand Down
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ Request parameters that correspond to file uploads can be passed in many differe

```ts
import fs from 'fs';
import fetch from 'node-fetch';
import OpenAI, { toFile } from 'openai';

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

### Customizing the fetch client

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

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

```ts
// Tell TypeScript and the package to use the global web fetch instead of node-fetch.
// Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
import 'openai/shims/web';
import OpenAI from 'openai';
import fetch from 'my-fetch';

globalThis.fetch = fetch;
```

To do the inverse, add `import "openai/shims/node"` (which does import polyfills).
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)).
Or pass it to the client:

```ts
import fetch from 'my-fetch';

const client = new OpenAI({ fetch });
```

### Logging and middleware

Expand Down Expand Up @@ -620,6 +621,8 @@ await client.models.list({
});
```

## Frequently Asked Questions

## Semantic versioning

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:
Expand All @@ -634,7 +637,7 @@ We are keen for your feedback; please open an [issue](https://www.github.com/ope

## Requirements

TypeScript >= 4.5 is supported.
TypeScript >= 4.9 is supported.

The following runtimes are supported:

Expand Down
89 changes: 44 additions & 45 deletions api.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions ecosystem-tests/browser-direct-import/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/dist
Loading
Loading