openai 4.57.2 → 4.57.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/helpers/zod.d.ts +6 -6
- package/helpers/zod.d.ts.map +1 -1
- package/helpers/zod.js.map +1 -1
- package/helpers/zod.mjs.map +1 -1
- package/package.json +2 -2
- package/src/helpers/zod.ts +8 -8
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.57.3 (2024-09-04)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v4.57.2...v4.57.3](https://github.com/openai/openai-node/compare/v4.57.2...v4.57.3)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **helpers/zod:** avoid import issue in certain environments ([#1039](https://github.com/openai/openai-node/issues/1039)) ([e238daa](https://github.com/openai/openai-node/commit/e238daa7c12f3fb13369f58b9d405365f5efcc8f))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Chores
|
|
13
|
+
|
|
14
|
+
* **internal:** minor bump qs version ([#1037](https://github.com/openai/openai-node/issues/1037)) ([8ec218e](https://github.com/openai/openai-node/commit/8ec218e9efb657927b3c0346822a96872aeaf137))
|
|
15
|
+
|
|
3
16
|
## 4.57.2 (2024-09-04)
|
|
4
17
|
|
|
5
18
|
Full Changelog: [v4.57.1...v4.57.2](https://github.com/openai/openai-node/compare/v4.57.1...v4.57.2)
|
package/README.md
CHANGED
package/helpers/zod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ResponseFormatJSONSchema } from
|
|
2
|
-
import type
|
|
1
|
+
import { ResponseFormatJSONSchema } from "../resources/index.js";
|
|
2
|
+
import type { infer as zodInfer, ZodType } from 'zod';
|
|
3
3
|
import { AutoParseableResponseFormat, AutoParseableTool } from "../lib/parser.js";
|
|
4
4
|
/**
|
|
5
5
|
* Creates a chat completion `JSONSchema` response format object from
|
|
@@ -38,20 +38,20 @@ import { AutoParseableResponseFormat, AutoParseableTool } from "../lib/parser.js
|
|
|
38
38
|
* This can be passed directly to the `.create()` method but will not
|
|
39
39
|
* result in any automatic parsing, you'll have to parse the response yourself.
|
|
40
40
|
*/
|
|
41
|
-
export declare function zodResponseFormat<ZodInput extends
|
|
41
|
+
export declare function zodResponseFormat<ZodInput extends ZodType>(zodObject: ZodInput, name: string, props?: Omit<ResponseFormatJSONSchema.JSONSchema, 'schema' | 'strict' | 'name'>): AutoParseableResponseFormat<zodInfer<ZodInput>>;
|
|
42
42
|
/**
|
|
43
43
|
* Creates a chat completion `function` tool that can be invoked
|
|
44
44
|
* automatically by the chat completion `.runTools()` method or automatically
|
|
45
45
|
* parsed by `.parse()` / `.stream()`.
|
|
46
46
|
*/
|
|
47
|
-
export declare function zodFunction<Parameters extends
|
|
47
|
+
export declare function zodFunction<Parameters extends ZodType>(options: {
|
|
48
48
|
name: string;
|
|
49
49
|
parameters: Parameters;
|
|
50
|
-
function?: ((args:
|
|
50
|
+
function?: ((args: zodInfer<Parameters>) => unknown | Promise<unknown>) | undefined;
|
|
51
51
|
description?: string | undefined;
|
|
52
52
|
}): AutoParseableTool<{
|
|
53
53
|
arguments: Parameters;
|
|
54
54
|
name: string;
|
|
55
|
-
function: (args:
|
|
55
|
+
function: (args: zodInfer<Parameters>) => unknown;
|
|
56
56
|
}>;
|
|
57
57
|
//# sourceMappingURL=zod.d.ts.map
|
package/helpers/zod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../src/helpers/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../src/help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AC,SAAS,CAAC;SAC5E;KACF,EACD;QACE,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KAC7D,CACF,CAAC;AACJ,CAAC;AA1BD,kCA0BC"}
|
package/helpers/zod.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.mjs","sourceRoot":"","sources":["../src/helpers/zod.ts"],"names":[],"mappings":"OAEO,EAGL,2BAA2B,EAC3B,iBAAiB,GAClB;OACM,EAAE,eAAe,IAAI,gBAAgB,EAAE;AAE9C,SAAS,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"zod.mjs","sourceRoot":"","sources":["../src/helpers/zod.ts"],"names":[],"mappings":"OAEO,EAGL,2BAA2B,EAC3B,iBAAiB,GAClB;OACM,EAAE,eAAe,IAAI,gBAAgB,EAAE;AAE9C,SAAS,eAAe,CAAC,MAAe,EAAE,OAAyB;IACjE,OAAO,gBAAgB,CAAC,MAAM,EAAE;QAC9B,gBAAgB,EAAE,IAAI;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,YAAY,EAAE,eAAe;QAC7B,YAAY,EAAE,iBAAiB;QAC/B,gBAAgB,EAAE,UAAU;KAC7B,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAmB,EACnB,IAAY,EACZ,KAA+E;IAE/E,OAAO,2BAA2B,CAChC;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE;YACX,GAAG,KAAK;YACR,IAAI;YACJ,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,eAAe,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC;SAC7C;KACF,EACD,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAClD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAA6B,OAKvD;IAKC,wBAAwB;IACxB,OAAO,iBAAiB,CACtB;QACE,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACR,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;YACvE,MAAM,EAAE,IAAI;YACZ,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SAC5E;KACF,EACD;QACE,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KAC7D,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openai",
|
|
3
|
-
"version": "4.57.
|
|
3
|
+
"version": "4.57.3",
|
|
4
4
|
"description": "The official TypeScript library for the OpenAI API",
|
|
5
5
|
"author": "OpenAI <support@openai.com>",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@types/node": "^18.11.18",
|
|
26
26
|
"@types/node-fetch": "^2.6.4",
|
|
27
|
-
"@types/qs": "^6.9.
|
|
27
|
+
"@types/qs": "^6.9.15",
|
|
28
28
|
"abort-controller": "^3.0.0",
|
|
29
29
|
"agentkeepalive": "^4.2.1",
|
|
30
30
|
"form-data-encoder": "1.7.2",
|
package/src/helpers/zod.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ResponseFormatJSONSchema } from
|
|
2
|
-
import type
|
|
1
|
+
import { ResponseFormatJSONSchema } from '../resources/index';
|
|
2
|
+
import type { infer as zodInfer, ZodType } from 'zod';
|
|
3
3
|
import {
|
|
4
4
|
AutoParseableResponseFormat,
|
|
5
5
|
AutoParseableTool,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '../lib/parser';
|
|
9
9
|
import { zodToJsonSchema as _zodToJsonSchema } from '../_vendor/zod-to-json-schema';
|
|
10
10
|
|
|
11
|
-
function zodToJsonSchema(schema:
|
|
11
|
+
function zodToJsonSchema(schema: ZodType, options: { name: string }): Record<string, unknown> {
|
|
12
12
|
return _zodToJsonSchema(schema, {
|
|
13
13
|
openaiStrictMode: true,
|
|
14
14
|
name: options.name,
|
|
@@ -55,11 +55,11 @@ function zodToJsonSchema(schema: z.ZodType, options: { name: string }): Record<s
|
|
|
55
55
|
* This can be passed directly to the `.create()` method but will not
|
|
56
56
|
* result in any automatic parsing, you'll have to parse the response yourself.
|
|
57
57
|
*/
|
|
58
|
-
export function zodResponseFormat<ZodInput extends
|
|
58
|
+
export function zodResponseFormat<ZodInput extends ZodType>(
|
|
59
59
|
zodObject: ZodInput,
|
|
60
60
|
name: string,
|
|
61
61
|
props?: Omit<ResponseFormatJSONSchema.JSONSchema, 'schema' | 'strict' | 'name'>,
|
|
62
|
-
): AutoParseableResponseFormat<
|
|
62
|
+
): AutoParseableResponseFormat<zodInfer<ZodInput>> {
|
|
63
63
|
return makeParseableResponseFormat(
|
|
64
64
|
{
|
|
65
65
|
type: 'json_schema',
|
|
@@ -79,15 +79,15 @@ export function zodResponseFormat<ZodInput extends z.ZodType>(
|
|
|
79
79
|
* automatically by the chat completion `.runTools()` method or automatically
|
|
80
80
|
* parsed by `.parse()` / `.stream()`.
|
|
81
81
|
*/
|
|
82
|
-
export function zodFunction<Parameters extends
|
|
82
|
+
export function zodFunction<Parameters extends ZodType>(options: {
|
|
83
83
|
name: string;
|
|
84
84
|
parameters: Parameters;
|
|
85
|
-
function?: ((args:
|
|
85
|
+
function?: ((args: zodInfer<Parameters>) => unknown | Promise<unknown>) | undefined;
|
|
86
86
|
description?: string | undefined;
|
|
87
87
|
}): AutoParseableTool<{
|
|
88
88
|
arguments: Parameters;
|
|
89
89
|
name: string;
|
|
90
|
-
function: (args:
|
|
90
|
+
function: (args: zodInfer<Parameters>) => unknown;
|
|
91
91
|
}> {
|
|
92
92
|
// @ts-expect-error TODO
|
|
93
93
|
return makeParseableTool<any>(
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '4.57.
|
|
1
|
+
export const VERSION = '4.57.3'; // x-release-please-version
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.57.
|
|
1
|
+
export declare const VERSION = "4.57.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '4.57.
|
|
1
|
+
export const VERSION = '4.57.3'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|