Skip to content

Commit 72e4495

Browse files
authored
Merge pull request #369 from openai/release-please--branches--master--changes--next--components--openai
release: 4.12.2
2 parents 6484039 + 09e10b3 commit 72e4495

35 files changed

+321
-127
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "4.12.1"
2+
".": "4.12.2"
33
}

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Changelog
22

3+
## 4.12.2 (2023-10-16)
4+
5+
Full Changelog: [v4.12.1...v4.12.2](https://github.com/openai/openai-node/compare/v4.12.1...v4.12.2)
6+
7+
### Bug Fixes
8+
9+
* **client:** correctly handle errors during streaming ([#377](https://github.com/openai/openai-node/issues/377)) ([09233b1](https://github.com/openai/openai-node/commit/09233b1ccc80ee900be19050f438cc8aa9dbb513))
10+
* **client:** correctly handle errors during streaming ([#379](https://github.com/openai/openai-node/issues/379)) ([9ced580](https://github.com/openai/openai-node/commit/9ced5804777a5857d6775a49ddf30ed9cc016fab))
11+
* improve status code in error messages ([#381](https://github.com/openai/openai-node/issues/381)) ([68dfb17](https://github.com/openai/openai-node/commit/68dfb17cce300ade8d29afc854d616833b3283ca))
12+
13+
14+
### Chores
15+
16+
* add case insensitive get header function ([#373](https://github.com/openai/openai-node/issues/373)) ([b088998](https://github.com/openai/openai-node/commit/b088998ae610de54bb8700eefd6b664eb9a2fcc3))
17+
* **internal:** add debug logs for stream responses ([#380](https://github.com/openai/openai-node/issues/380)) ([689db0b](https://github.com/openai/openai-node/commit/689db0b8058527ae5c3af5e457c962d8a6635297))
18+
* show deprecation notice on re-export ([#368](https://github.com/openai/openai-node/issues/368)) ([b176703](https://github.com/openai/openai-node/commit/b176703102998f0e9d8ca2ed93ccd495fd10a6ee))
19+
* update comment ([#376](https://github.com/openai/openai-node/issues/376)) ([a06c685](https://github.com/openai/openai-node/commit/a06c6850bfdd756dc8f07dd1f70218be610faa30))
20+
* update comment ([#378](https://github.com/openai/openai-node/issues/378)) ([b04031d](https://github.com/openai/openai-node/commit/b04031d19210a66f82c7d233a50f7bc427a1bf92))
21+
22+
23+
### Refactors
24+
25+
* **streaming:** change Stream constructor signature ([#370](https://github.com/openai/openai-node/issues/370)) ([71984ed](https://github.com/openai/openai-node/commit/71984edc3141ba99ffa1327bab6a182b4452209f))
26+
* **test:** refactor authentication tests ([#371](https://github.com/openai/openai-node/issues/371)) ([e0d459f](https://github.com/openai/openai-node/commit/e0d459f958451a99e15a11a0e5ea6471abbe1ac1))
27+
328
## 4.12.1 (2023-10-11)
429

530
Full Changelog: [v4.12.0...v4.12.1](https://github.com/openai/openai-node/compare/v4.12.0...v4.12.1)

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The full API of this library can be found in [api.md file](https://github.com/op
2424
import OpenAI from 'openai';
2525

2626
const openai = new OpenAI({
27-
apiKey: 'my api key', // defaults to process.env["OPENAI_API_KEY"]
27+
apiKey: 'My API Key', // defaults to process.env["OPENAI_API_KEY"]
2828
});
2929

3030
async function main() {
@@ -73,7 +73,7 @@ This library includes TypeScript definitions for all request params and response
7373
import OpenAI from 'openai';
7474

7575
const openai = new OpenAI({
76-
apiKey: 'my api key', // defaults to process.env["OPENAI_API_KEY"]
76+
apiKey: 'My API Key', // defaults to process.env["OPENAI_API_KEY"]
7777
});
7878

7979
async function main() {
@@ -297,7 +297,7 @@ await openai.models.list({
297297

298298
## Semantic Versioning
299299

300-
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:
300+
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:
301301

302302
1. Changes that only affect static types, without breaking runtime behavior.
303303
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)_.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openai",
3-
"version": "4.12.1",
3+
"version": "4.12.2",
44
"description": "Client library for the OpenAI API",
55
"author": "OpenAI <[email protected]>",
66
"types": "dist/index.d.ts",
@@ -93,7 +93,8 @@
9393
"digest-fetch": "^1.3.0",
9494
"form-data-encoder": "1.7.2",
9595
"formdata-node": "^4.3.2",
96-
"node-fetch": "^2.6.7"
96+
"node-fetch": "^2.6.7",
97+
"web-streams-polyfill": "^3.2.1"
9798
},
9899
"devDependencies": {
99100
"@types/jest": "^29.4.0",

release-please-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"include-v-in-tag": true,
77
"include-component-in-tag": false,
88
"bump-minor-pre-major": true,
9-
"bump-patch-for-minor-pre-major": true,
9+
"bump-patch-for-minor-pre-major": false,
1010
"pull-request-header": "Automated Release PR",
1111
"pull-request-title-pattern": "release: ${version}",
1212
"changelog-sections": [

src/_shims/auto/types.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,6 @@ export declare class FsReadStream extends Readable {
9696

9797
// @ts-ignore
9898
type _ReadableStream<R = any> = unknown extends ReadableStream<R> ? never : ReadableStream<R>;
99-
export { type _ReadableStream as ReadableStream };
99+
// @ts-ignore
100+
declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream;
101+
export { _ReadableStream as ReadableStream };

src/_shims/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ export type Readable = SelectType<manual.Readable, auto.Readable>;
6262
export type FsReadStream = SelectType<manual.FsReadStream, auto.FsReadStream>;
6363
// @ts-ignore
6464
export type ReadableStream = SelectType<manual.ReadableStream, auto.ReadableStream>;
65+
// @ts-ignore
66+
export const ReadableStream: SelectType<typeof manual.ReadableStream, typeof auto.ReadableStream>;
6567

6668
export function getMultipartRequestOptions<T extends {} = Record<string, unknown>>(
6769
form: FormData,

src/_shims/node-runtime.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { Readable } from 'node:stream';
1313
import { type RequestOptions } from '../core';
1414
import { MultipartBody } from './MultipartBody';
1515
import { type Shims } from './registry';
16+
import { ReadableStream } from 'web-streams-polyfill';
1617

1718
type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
1819

@@ -71,6 +72,7 @@ export function getRuntime(): Shims {
7172
FormData: fd.FormData,
7273
Blob: fd.Blob,
7374
File: fd.File,
75+
ReadableStream,
7476
getMultipartRequestOptions,
7577
getDefaultAgent: (url: string): Agent => (url.startsWith('https') ? defaultHttpsAgent : defaultHttpAgent),
7678
fileFromPath,

src/_shims/node-types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as fd from 'formdata-node';
77
export { type Agent } from 'node:http';
88
export { type Readable } from 'node:stream';
99
export { type ReadStream as FsReadStream } from 'node:fs';
10-
export { type ReadableStream } from 'web-streams-polyfill';
10+
export { ReadableStream } from 'web-streams-polyfill';
1111

1212
export const fetch: typeof nf.default;
1313

src/_shims/registry.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface Shims {
1212
FormData: any;
1313
Blob: any;
1414
File: any;
15+
ReadableStream: any;
1516
getMultipartRequestOptions: <T extends {} = Record<string, unknown>>(
1617
form: Shims['FormData'],
1718
opts: RequestOptions<T>,
@@ -32,6 +33,7 @@ export let Headers: Shims['Headers'] | undefined = undefined;
3233
export let FormData: Shims['FormData'] | undefined = undefined;
3334
export let Blob: Shims['Blob'] | undefined = undefined;
3435
export let File: Shims['File'] | undefined = undefined;
36+
export let ReadableStream: Shims['ReadableStream'] | undefined = undefined;
3537
export let getMultipartRequestOptions: Shims['getMultipartRequestOptions'] | undefined = undefined;
3638
export let getDefaultAgent: Shims['getDefaultAgent'] | undefined = undefined;
3739
export let fileFromPath: Shims['fileFromPath'] | undefined = undefined;
@@ -55,6 +57,7 @@ export function setShims(shims: Shims, options: { auto: boolean } = { auto: fals
5557
FormData = shims.FormData;
5658
Blob = shims.Blob;
5759
File = shims.File;
60+
ReadableStream = shims.ReadableStream;
5861
getMultipartRequestOptions = shims.getMultipartRequestOptions;
5962
getDefaultAgent = shims.getDefaultAgent;
6063
fileFromPath = shims.fileFromPath;

0 commit comments

Comments
 (0)