openai 7.10.0 → 7.12.1
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 +196 -0
- package/README.md +7 -5
- package/_vendor/partial-json-parser/parser.d.mts.map +1 -1
- package/_vendor/partial-json-parser/parser.d.ts.map +1 -1
- package/_vendor/partial-json-parser/parser.js +4 -3
- package/_vendor/partial-json-parser/parser.js.map +1 -1
- package/_vendor/partial-json-parser/parser.mjs +4 -3
- package/_vendor/partial-json-parser/parser.mjs.map +1 -1
- package/_vendor/zod-to-json-schema/parsers/string.js +1 -1
- package/_vendor/zod-to-json-schema/parsers/string.js.map +1 -1
- package/_vendor/zod-to-json-schema/parsers/string.mjs +1 -1
- package/_vendor/zod-to-json-schema/parsers/string.mjs.map +1 -1
- package/_vendor/zod-to-json-schema/parsers/tuple.d.mts.map +1 -1
- package/_vendor/zod-to-json-schema/parsers/tuple.d.ts.map +1 -1
- package/_vendor/zod-to-json-schema/parsers/tuple.js +19 -12
- package/_vendor/zod-to-json-schema/parsers/tuple.js.map +1 -1
- package/_vendor/zod-to-json-schema/parsers/tuple.mjs +19 -12
- package/_vendor/zod-to-json-schema/parsers/tuple.mjs.map +1 -1
- package/_vendor/zod-to-json-schema/zodToJsonSchema.d.mts.map +1 -1
- package/_vendor/zod-to-json-schema/zodToJsonSchema.d.ts.map +1 -1
- package/_vendor/zod-to-json-schema/zodToJsonSchema.js +6 -2
- package/_vendor/zod-to-json-schema/zodToJsonSchema.js.map +1 -1
- package/_vendor/zod-to-json-schema/zodToJsonSchema.mjs +6 -2
- package/_vendor/zod-to-json-schema/zodToJsonSchema.mjs.map +1 -1
- package/auth/subject-token-providers.d.mts.map +1 -1
- package/auth/subject-token-providers.d.ts.map +1 -1
- package/auth/subject-token-providers.js +10 -5
- package/auth/subject-token-providers.js.map +1 -1
- package/auth/subject-token-providers.mjs +10 -5
- package/auth/subject-token-providers.mjs.map +1 -1
- package/auth/workload-identity-auth.d.mts.map +1 -1
- package/auth/workload-identity-auth.d.ts.map +1 -1
- package/auth/workload-identity-auth.js +21 -11
- package/auth/workload-identity-auth.js.map +1 -1
- package/auth/workload-identity-auth.mjs +21 -11
- package/auth/workload-identity-auth.mjs.map +1 -1
- package/azure.d.mts.map +1 -1
- package/azure.d.ts.map +1 -1
- package/azure.js +31 -2
- package/azure.js.map +1 -1
- package/azure.mjs +32 -3
- package/azure.mjs.map +1 -1
- package/beta/realtime/internal-base.d.mts.map +1 -1
- package/beta/realtime/internal-base.d.ts.map +1 -1
- package/beta/realtime/internal-base.js +3 -2
- package/beta/realtime/internal-base.js.map +1 -1
- package/beta/realtime/internal-base.mjs +3 -2
- package/beta/realtime/internal-base.mjs.map +1 -1
- package/beta/realtime/websocket.d.mts +2 -0
- package/beta/realtime/websocket.d.mts.map +1 -1
- package/beta/realtime/websocket.d.ts +2 -0
- package/beta/realtime/websocket.d.ts.map +1 -1
- package/beta/realtime/websocket.js +12 -7
- package/beta/realtime/websocket.js.map +1 -1
- package/beta/realtime/websocket.mjs +12 -7
- package/beta/realtime/websocket.mjs.map +1 -1
- package/beta/realtime/ws.d.mts +2 -0
- package/beta/realtime/ws.d.mts.map +1 -1
- package/beta/realtime/ws.d.ts +2 -0
- package/beta/realtime/ws.d.ts.map +1 -1
- package/beta/realtime/ws.js +7 -5
- package/beta/realtime/ws.js.map +1 -1
- package/beta/realtime/ws.mjs +7 -5
- package/beta/realtime/ws.mjs.map +1 -1
- package/client.d.mts +9 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +9 -1
- package/client.d.ts.map +1 -1
- package/client.js +17 -4
- package/client.js.map +1 -1
- package/client.mjs +17 -4
- package/client.mjs.map +1 -1
- package/core/EventEmitter.d.mts +2 -1
- package/core/EventEmitter.d.mts.map +1 -1
- package/core/EventEmitter.d.ts +2 -1
- package/core/EventEmitter.d.ts.map +1 -1
- package/core/EventEmitter.js +2 -1
- package/core/EventEmitter.js.map +1 -1
- package/core/EventEmitter.mjs +2 -1
- package/core/EventEmitter.mjs.map +1 -1
- package/core/pagination.js +1 -1
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs +1 -1
- package/core/pagination.mjs.map +1 -1
- package/core/streaming.d.mts +8 -0
- package/core/streaming.d.mts.map +1 -1
- package/core/streaming.d.ts +8 -0
- package/core/streaming.d.ts.map +1 -1
- package/core/streaming.js +68 -15
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs +68 -15
- package/core/streaming.mjs.map +1 -1
- package/helpers/audio.d.mts +1 -1
- package/helpers/audio.d.mts.map +1 -1
- package/helpers/audio.d.ts +1 -1
- package/helpers/audio.d.ts.map +1 -1
- package/helpers/audio.js +25 -5
- package/helpers/audio.js.map +1 -1
- package/helpers/audio.mjs +25 -5
- package/helpers/audio.mjs.map +1 -1
- package/helpers/zod.d.mts +28 -15
- package/helpers/zod.d.mts.map +1 -1
- package/helpers/zod.d.ts +28 -15
- package/helpers/zod.d.ts.map +1 -1
- package/helpers/zod.js +30 -23
- package/helpers/zod.js.map +1 -1
- package/helpers/zod.mjs +30 -23
- package/helpers/zod.mjs.map +1 -1
- package/index.js +4 -5
- package/internal/bedrock.d.mts +11 -0
- package/internal/bedrock.d.mts.map +1 -1
- package/internal/bedrock.d.ts +11 -0
- package/internal/bedrock.d.ts.map +1 -1
- package/internal/bedrock.js +71 -55
- package/internal/bedrock.js.map +1 -1
- package/internal/bedrock.mjs +70 -55
- package/internal/bedrock.mjs.map +1 -1
- package/internal/detect-platform.js +2 -2
- package/internal/detect-platform.js.map +1 -1
- package/internal/detect-platform.mjs +2 -2
- package/internal/detect-platform.mjs.map +1 -1
- package/internal/errors.d.mts.map +1 -1
- package/internal/errors.d.ts.map +1 -1
- package/internal/errors.js +3 -2
- package/internal/errors.js.map +1 -1
- package/internal/errors.mjs +3 -2
- package/internal/errors.mjs.map +1 -1
- package/internal/headers.d.mts.map +1 -1
- package/internal/headers.d.ts.map +1 -1
- package/internal/headers.js +4 -5
- package/internal/headers.js.map +1 -1
- package/internal/headers.mjs +4 -5
- package/internal/headers.mjs.map +1 -1
- package/internal/parse.js +1 -1
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +1 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/realtime-credentials.d.mts +15 -0
- package/internal/realtime-credentials.d.mts.map +1 -0
- package/internal/realtime-credentials.d.ts +15 -0
- package/internal/realtime-credentials.d.ts.map +1 -0
- package/internal/realtime-credentials.js +23 -0
- package/internal/realtime-credentials.js.map +1 -0
- package/internal/realtime-credentials.mjs +19 -0
- package/internal/realtime-credentials.mjs.map +1 -0
- package/internal/responses/response-accumulator.d.mts.map +1 -1
- package/internal/responses/response-accumulator.d.ts.map +1 -1
- package/internal/responses/response-accumulator.js +2 -1
- package/internal/responses/response-accumulator.js.map +1 -1
- package/internal/responses/response-accumulator.mjs +2 -1
- package/internal/responses/response-accumulator.mjs.map +1 -1
- package/internal/to-file.d.mts +2 -1
- package/internal/to-file.d.mts.map +1 -1
- package/internal/to-file.d.ts +2 -1
- package/internal/to-file.d.ts.map +1 -1
- package/internal/to-file.js +5 -4
- package/internal/to-file.js.map +1 -1
- package/internal/to-file.mjs +6 -5
- package/internal/to-file.mjs.map +1 -1
- package/internal/types.d.mts +3 -3
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +3 -3
- package/internal/types.d.ts.map +1 -1
- package/internal/uploads.d.mts +2 -0
- package/internal/uploads.d.mts.map +1 -1
- package/internal/uploads.d.ts +2 -0
- package/internal/uploads.d.ts.map +1 -1
- package/internal/uploads.js +12 -1
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs +11 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/base64.d.mts.map +1 -1
- package/internal/utils/base64.d.ts.map +1 -1
- package/internal/utils/base64.js +3 -0
- package/internal/utils/base64.js.map +1 -1
- package/internal/utils/base64.mjs +3 -0
- package/internal/utils/base64.mjs.map +1 -1
- package/lib/AbstractChatCompletionRunner.d.mts +1 -1
- package/lib/AbstractChatCompletionRunner.d.mts.map +1 -1
- package/lib/AbstractChatCompletionRunner.d.ts +1 -1
- package/lib/AbstractChatCompletionRunner.d.ts.map +1 -1
- package/lib/AbstractChatCompletionRunner.js +31 -9
- package/lib/AbstractChatCompletionRunner.js.map +1 -1
- package/lib/AbstractChatCompletionRunner.mjs +31 -9
- package/lib/AbstractChatCompletionRunner.mjs.map +1 -1
- package/lib/AssistantStream.d.mts +4 -1
- package/lib/AssistantStream.d.mts.map +1 -1
- package/lib/AssistantStream.d.ts +4 -1
- package/lib/AssistantStream.d.ts.map +1 -1
- package/lib/AssistantStream.js +23 -8
- package/lib/AssistantStream.js.map +1 -1
- package/lib/AssistantStream.mjs +24 -9
- package/lib/AssistantStream.mjs.map +1 -1
- package/lib/ChatCompletionRunner.d.mts +6 -3
- package/lib/ChatCompletionRunner.d.mts.map +1 -1
- package/lib/ChatCompletionRunner.d.ts +6 -3
- package/lib/ChatCompletionRunner.d.ts.map +1 -1
- package/lib/ChatCompletionRunner.js +7 -4
- package/lib/ChatCompletionRunner.js.map +1 -1
- package/lib/ChatCompletionRunner.mjs +7 -4
- package/lib/ChatCompletionRunner.mjs.map +1 -1
- package/lib/ChatCompletionStream.d.mts.map +1 -1
- package/lib/ChatCompletionStream.d.ts.map +1 -1
- package/lib/ChatCompletionStream.js +6 -0
- package/lib/ChatCompletionStream.js.map +1 -1
- package/lib/ChatCompletionStream.mjs +7 -1
- package/lib/ChatCompletionStream.mjs.map +1 -1
- package/lib/ChatCompletionStreamingRunner.d.mts.map +1 -1
- package/lib/ChatCompletionStreamingRunner.d.ts.map +1 -1
- package/lib/ChatCompletionStreamingRunner.js +1 -0
- package/lib/ChatCompletionStreamingRunner.js.map +1 -1
- package/lib/ChatCompletionStreamingRunner.mjs +1 -0
- package/lib/ChatCompletionStreamingRunner.mjs.map +1 -1
- package/lib/EventEmitter.d.mts +3 -1
- package/lib/EventEmitter.d.mts.map +1 -1
- package/lib/EventEmitter.d.ts +3 -1
- package/lib/EventEmitter.d.ts.map +1 -1
- package/lib/EventEmitter.js +2 -1
- package/lib/EventEmitter.js.map +1 -1
- package/lib/EventEmitter.mjs +2 -1
- package/lib/EventEmitter.mjs.map +1 -1
- package/lib/EventStream.d.mts +2 -1
- package/lib/EventStream.d.mts.map +1 -1
- package/lib/EventStream.d.ts +2 -1
- package/lib/EventStream.d.ts.map +1 -1
- package/lib/EventStream.js +99 -46
- package/lib/EventStream.js.map +1 -1
- package/lib/EventStream.mjs +99 -46
- package/lib/EventStream.mjs.map +1 -1
- package/lib/ResponsesParser.d.mts +5 -4
- package/lib/ResponsesParser.d.mts.map +1 -1
- package/lib/ResponsesParser.d.ts +5 -4
- package/lib/ResponsesParser.d.ts.map +1 -1
- package/lib/ResponsesParser.js +21 -7
- package/lib/ResponsesParser.js.map +1 -1
- package/lib/ResponsesParser.mjs +21 -7
- package/lib/ResponsesParser.mjs.map +1 -1
- package/lib/RunnableFunction.d.mts +2 -2
- package/lib/RunnableFunction.d.mts.map +1 -1
- package/lib/RunnableFunction.d.ts +2 -2
- package/lib/RunnableFunction.d.ts.map +1 -1
- package/lib/embeddings.d.mts.map +1 -1
- package/lib/embeddings.d.ts.map +1 -1
- package/lib/embeddings.js +18 -12
- package/lib/embeddings.js.map +1 -1
- package/lib/embeddings.mjs +18 -12
- package/lib/embeddings.mjs.map +1 -1
- package/lib/file-processing.d.mts +3 -2
- package/lib/file-processing.d.mts.map +1 -1
- package/lib/file-processing.d.ts +3 -2
- package/lib/file-processing.d.ts.map +1 -1
- package/lib/file-processing.js +5 -4
- package/lib/file-processing.js.map +1 -1
- package/lib/file-processing.mjs +5 -4
- package/lib/file-processing.mjs.map +1 -1
- package/lib/parser.d.mts +16 -4
- package/lib/parser.d.mts.map +1 -1
- package/lib/parser.d.ts +16 -4
- package/lib/parser.d.ts.map +1 -1
- package/lib/parser.js +1 -1
- package/lib/parser.js.map +1 -1
- package/lib/parser.mjs +1 -1
- package/lib/parser.mjs.map +1 -1
- package/lib/polling.d.mts +2 -2
- package/lib/polling.d.mts.map +1 -1
- package/lib/polling.d.ts +2 -2
- package/lib/polling.d.ts.map +1 -1
- package/lib/polling.js +5 -4
- package/lib/polling.js.map +1 -1
- package/lib/polling.mjs +5 -4
- package/lib/polling.mjs.map +1 -1
- package/lib/responses/EventTypes.d.mts +2 -2
- package/lib/responses/EventTypes.d.mts.map +1 -1
- package/lib/responses/EventTypes.d.ts +2 -2
- package/lib/responses/EventTypes.d.ts.map +1 -1
- package/lib/responses/ResponseInputItems.d.mts +3 -2
- package/lib/responses/ResponseInputItems.d.mts.map +1 -1
- package/lib/responses/ResponseInputItems.d.ts +3 -2
- package/lib/responses/ResponseInputItems.d.ts.map +1 -1
- package/lib/responses/ResponseInputItems.js +27 -4
- package/lib/responses/ResponseInputItems.js.map +1 -1
- package/lib/responses/ResponseInputItems.mjs +27 -4
- package/lib/responses/ResponseInputItems.mjs.map +1 -1
- package/lib/transform.d.mts.map +1 -1
- package/lib/transform.d.ts.map +1 -1
- package/lib/transform.js +1 -0
- package/lib/transform.js.map +1 -1
- package/lib/transform.mjs +1 -0
- package/lib/transform.mjs.map +1 -1
- package/lib/vector-store-polling.d.mts +2 -2
- package/lib/vector-store-polling.d.ts +2 -2
- package/lib/vector-store-polling.js +3 -3
- package/lib/vector-store-polling.js.map +1 -1
- package/lib/vector-store-polling.mjs +3 -3
- package/lib/vector-store-polling.mjs.map +1 -1
- package/lib/vector-store-upload.d.mts +2 -1
- package/lib/vector-store-upload.d.mts.map +1 -1
- package/lib/vector-store-upload.d.ts +2 -1
- package/lib/vector-store-upload.d.ts.map +1 -1
- package/lib/vector-store-upload.js +5 -1
- package/lib/vector-store-upload.js.map +1 -1
- package/lib/vector-store-upload.mjs +5 -1
- package/lib/vector-store-upload.mjs.map +1 -1
- package/package.json +1 -1
- package/providers/bedrock/aws.d.mts.map +1 -1
- package/providers/bedrock/aws.d.ts.map +1 -1
- package/providers/bedrock/aws.js +14 -16
- package/providers/bedrock/aws.js.map +1 -1
- package/providers/bedrock/aws.mjs +15 -17
- package/providers/bedrock/aws.mjs.map +1 -1
- package/realtime/internal-base.d.mts.map +1 -1
- package/realtime/internal-base.d.ts.map +1 -1
- package/realtime/internal-base.js +3 -5
- package/realtime/internal-base.js.map +1 -1
- package/realtime/internal-base.mjs +3 -5
- package/realtime/internal-base.mjs.map +1 -1
- package/realtime/websocket.d.mts +2 -0
- package/realtime/websocket.d.mts.map +1 -1
- package/realtime/websocket.d.ts +2 -0
- package/realtime/websocket.d.ts.map +1 -1
- package/realtime/websocket.js +12 -6
- package/realtime/websocket.js.map +1 -1
- package/realtime/websocket.mjs +12 -6
- package/realtime/websocket.mjs.map +1 -1
- package/realtime/ws.d.mts +2 -0
- package/realtime/ws.d.mts.map +1 -1
- package/realtime/ws.d.ts +2 -0
- package/realtime/ws.d.ts.map +1 -1
- package/realtime/ws.js +7 -4
- package/realtime/ws.js.map +1 -1
- package/realtime/ws.mjs +7 -4
- package/realtime/ws.mjs.map +1 -1
- package/resources/admin/organization/projects/service-accounts/api-keys.d.mts +9 -0
- package/resources/admin/organization/projects/service-accounts/api-keys.d.mts.map +1 -1
- package/resources/admin/organization/projects/service-accounts/api-keys.d.ts +9 -0
- package/resources/admin/organization/projects/service-accounts/api-keys.d.ts.map +1 -1
- package/resources/beta/responses/responses.d.mts +112 -33
- package/resources/beta/responses/responses.d.mts.map +1 -1
- package/resources/beta/responses/responses.d.ts +112 -33
- package/resources/beta/responses/responses.d.ts.map +1 -1
- package/resources/beta/responses/responses.js.map +1 -1
- package/resources/beta/responses/responses.mjs.map +1 -1
- package/resources/conversations/items.d.mts +9 -0
- package/resources/conversations/items.d.mts.map +1 -1
- package/resources/conversations/items.d.ts +9 -0
- package/resources/conversations/items.d.ts.map +1 -1
- package/resources/images.d.mts +73 -58
- package/resources/images.d.mts.map +1 -1
- package/resources/images.d.ts +73 -58
- package/resources/images.d.ts.map +1 -1
- package/resources/images.js.map +1 -1
- package/resources/images.mjs.map +1 -1
- package/resources/responses/responses.d.mts +112 -32
- package/resources/responses/responses.d.mts.map +1 -1
- package/resources/responses/responses.d.ts +112 -32
- package/resources/responses/responses.d.ts.map +1 -1
- package/resources/responses/responses.js.map +1 -1
- package/resources/responses/responses.mjs.map +1 -1
- package/resources/webhooks/webhooks.d.mts +6 -4
- package/resources/webhooks/webhooks.d.mts.map +1 -1
- package/resources/webhooks/webhooks.d.ts +6 -4
- package/resources/webhooks/webhooks.d.ts.map +1 -1
- package/src/_vendor/partial-json-parser/parser.ts +4 -3
- package/src/_vendor/zod-to-json-schema/parsers/string.ts +1 -1
- package/src/_vendor/zod-to-json-schema/parsers/tuple.ts +23 -16
- package/src/_vendor/zod-to-json-schema/zodToJsonSchema.ts +11 -6
- package/src/auth/subject-token-providers.ts +12 -7
- package/src/auth/workload-identity-auth.ts +27 -12
- package/src/azure.ts +34 -3
- package/src/beta/realtime/internal-base.ts +3 -2
- package/src/beta/realtime/websocket.ts +17 -7
- package/src/beta/realtime/ws.ts +9 -5
- package/src/client.ts +19 -4
- package/src/core/EventEmitter.ts +5 -8
- package/src/core/pagination.ts +1 -1
- package/src/core/streaming.ts +69 -13
- package/src/helpers/audio.ts +27 -6
- package/src/helpers/zod.ts +78 -29
- package/src/internal/bedrock.ts +84 -58
- package/src/internal/detect-platform.ts +2 -2
- package/src/internal/errors.ts +3 -2
- package/src/internal/headers.ts +7 -5
- package/src/internal/parse.ts +1 -1
- package/src/internal/realtime-credentials.ts +27 -0
- package/src/internal/responses/response-accumulator.ts +1 -0
- package/src/internal/to-file.ts +6 -5
- package/src/internal/uploads.ts +12 -1
- package/src/internal/utils/base64.ts +3 -0
- package/src/lib/AbstractChatCompletionRunner.ts +31 -6
- package/src/lib/AssistantStream.ts +25 -11
- package/src/lib/ChatCompletionRunner.ts +8 -4
- package/src/lib/ChatCompletionStream.ts +8 -0
- package/src/lib/ChatCompletionStreamingRunner.ts +1 -0
- package/src/lib/EventEmitter.ts +17 -8
- package/src/lib/EventStream.ts +105 -52
- package/src/lib/ResponsesParser.ts +33 -12
- package/src/lib/RunnableFunction.ts +2 -2
- package/src/lib/embeddings.ts +18 -12
- package/src/lib/file-processing.ts +5 -4
- package/src/lib/parser.ts +35 -11
- package/src/lib/polling.ts +5 -4
- package/src/lib/responses/EventTypes.ts +3 -69
- package/src/lib/responses/ResponseInputItems.ts +29 -4
- package/src/lib/transform.ts +1 -0
- package/src/lib/vector-store-polling.ts +3 -3
- package/src/lib/vector-store-upload.ts +5 -1
- package/src/providers/bedrock/aws.ts +23 -24
- package/src/realtime/internal-base.ts +3 -5
- package/src/realtime/websocket.ts +14 -6
- package/src/realtime/ws.ts +9 -4
- package/src/resources/admin/organization/projects/service-accounts/api-keys.ts +11 -0
- package/src/resources/beta/responses/responses.ts +143 -31
- package/src/resources/conversations/items.ts +11 -0
- package/src/resources/images.ts +76 -57
- package/src/resources/responses/responses.ts +143 -30
- package/src/resources/webhooks/webhooks.ts +6 -4
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/lib/transform.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { pollWithResponse } from './polling';
|
|
|
6
6
|
type PollOptions = RequestOptions & { pollIntervalMs?: number };
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Polls an attached file through the resource's retrieve method
|
|
10
|
-
*
|
|
9
|
+
* Polls an attached file through the resource's retrieve method until it completes,
|
|
10
|
+
* fails, or is cancelled. Retrieval errors are propagated unchanged.
|
|
11
11
|
*
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
@@ -20,7 +20,7 @@ export function pollVectorStoreFile(
|
|
|
20
20
|
return pollWithResponse(
|
|
21
21
|
(headers) => resource.retrieve(fileID, { vector_store_id: vectorStoreID }, { ...options, headers }),
|
|
22
22
|
['in_progress'],
|
|
23
|
-
['failed', 'completed'],
|
|
23
|
+
['failed', 'cancelled', 'completed'],
|
|
24
24
|
options,
|
|
25
25
|
);
|
|
26
26
|
}
|
|
@@ -8,7 +8,8 @@ type UploadOptions = RequestOptions & { pollIntervalMs?: number; maxConcurrency?
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Uploads files with a shared iterator, then creates and polls the batch. Every
|
|
11
|
-
* worker settles before upload failures are propagated.
|
|
11
|
+
* worker settles before upload failures are propagated. Zero concurrency is
|
|
12
|
+
* rejected before any upload or batch-creation request.
|
|
12
13
|
*
|
|
13
14
|
* @internal
|
|
14
15
|
*/
|
|
@@ -28,6 +29,9 @@ export async function uploadAndPollVectorStoreFileBatch(
|
|
|
28
29
|
|
|
29
30
|
const configuredConcurrency = options?.maxConcurrency ?? 5;
|
|
30
31
|
const concurrencyLimit = Math.min(configuredConcurrency, files.length);
|
|
32
|
+
if (concurrencyLimit === 0) {
|
|
33
|
+
throw new RangeError('maxConcurrency must be greater than 0');
|
|
34
|
+
}
|
|
31
35
|
const fileIterator = files.values();
|
|
32
36
|
const allFileIds = [...fileIds];
|
|
33
37
|
|
|
@@ -7,9 +7,9 @@ import type { BodyInit } from '../../internal/builtin-types';
|
|
|
7
7
|
import {
|
|
8
8
|
assertBedrockRequestOrigin,
|
|
9
9
|
assertProviderOwnsAuthorization,
|
|
10
|
-
errorWithCause,
|
|
11
10
|
normalizeOptionalString,
|
|
12
11
|
parseBedrockEndpointHostname,
|
|
12
|
+
prepareBedrockAuth,
|
|
13
13
|
resolveBedrockBearerAuth,
|
|
14
14
|
resolveBedrockEndpoint,
|
|
15
15
|
} from '../../internal/bedrock';
|
|
@@ -115,7 +115,7 @@ function requestTarget(parsedURL: URL): { path: string; query: Record<string, st
|
|
|
115
115
|
} else if (typeof existing === 'string') {
|
|
116
116
|
query[name] = [existing, value];
|
|
117
117
|
} else {
|
|
118
|
-
|
|
118
|
+
existing.push(value);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
return { path: parsedURL.pathname, query };
|
|
@@ -194,14 +194,14 @@ class BedrockSigV4Auth implements BedrockRequestAuth {
|
|
|
194
194
|
}));
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
async prepareRequest(request: FinalizedRequestInit,
|
|
197
|
+
async prepareRequest(request: FinalizedRequestInit, context: ProviderRequestContext): Promise<void> {
|
|
198
198
|
if (Object.prototype.toString.call((globalThis as any).process) !== '[object process]') {
|
|
199
199
|
throw new Errors.OpenAIError(
|
|
200
200
|
'Bedrock AWS credential authentication is only supported in Node.js and compatible server runtimes. Use bearer authentication in this runtime.',
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
const parsedURL = new URL(url);
|
|
204
|
+
const parsedURL = new URL(context.url);
|
|
205
205
|
const canonicalEndpoint = parseBedrockEndpointHostname(parsedURL.hostname);
|
|
206
206
|
if (canonicalEndpoint && canonicalEndpoint.endpoint !== this.options.endpoint) {
|
|
207
207
|
throw new Errors.OpenAIError(
|
|
@@ -225,27 +225,26 @@ class BedrockSigV4Auth implements BedrockRequestAuth {
|
|
|
225
225
|
const body = signableBody(request.body);
|
|
226
226
|
const target = requestTarget(parsedURL);
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const message = this.options.usesDefaultChain
|
|
228
|
+
await prepareBedrockAuth(request, context, {
|
|
229
|
+
resolve: () =>
|
|
230
|
+
this.signatureV4().sign({
|
|
231
|
+
protocol: parsedURL.protocol,
|
|
232
|
+
hostname: parsedURL.hostname,
|
|
233
|
+
...(parsedURL.port ? { port: Number(parsedURL.port) } : {}),
|
|
234
|
+
method,
|
|
235
|
+
...target,
|
|
236
|
+
headers: Object.fromEntries(headers.entries()),
|
|
237
|
+
...(body === undefined ? {} : { body }),
|
|
238
|
+
}),
|
|
239
|
+
failureMessage: this.options.usesDefaultChain
|
|
241
240
|
? 'Could not find credentials for Bedrock. Pass AWS credentials to `bedrock(...)` or configure the default AWS credential chain.'
|
|
242
|
-
: 'Failed to resolve AWS credentials for Bedrock. Verify your AWS profile, environment variables, or runtime identity configuration and try again.'
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
241
|
+
: 'Failed to resolve AWS credentials for Bedrock. Verify your AWS profile, environment variables, or runtime identity configuration and try again.',
|
|
242
|
+
apply: (signed) => {
|
|
243
|
+
request.method = method;
|
|
244
|
+
request.redirect = 'manual';
|
|
245
|
+
request.headers = new Headers(signed.headers);
|
|
246
|
+
},
|
|
247
|
+
});
|
|
249
248
|
}
|
|
250
249
|
}
|
|
251
250
|
|
|
@@ -281,19 +281,17 @@ export function buildRealtimeURL(
|
|
|
281
281
|
return url;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
|
|
284
|
+
const url = new URL(baseURL);
|
|
285
285
|
if (azure) {
|
|
286
|
-
url = new URL(baseURL);
|
|
287
286
|
const basePath = url.pathname.replace(/\/+/g, '/').replace(/\/+$/, '');
|
|
288
287
|
const versionedPath = basePath.endsWith('/v1') ? basePath : `${basePath}/v1`;
|
|
289
288
|
url.pathname = `${versionedPath}/realtime`;
|
|
290
289
|
url.search = '';
|
|
291
|
-
url.hash = '';
|
|
292
290
|
} else {
|
|
293
|
-
|
|
294
|
-
url = new URL(baseURL + (baseURL.endsWith('/') ? path.slice(1) : path));
|
|
291
|
+
url.pathname += url.pathname.endsWith('/') ? 'realtime' : '/realtime';
|
|
295
292
|
}
|
|
296
293
|
|
|
294
|
+
url.hash = '';
|
|
297
295
|
url.protocol = 'wss';
|
|
298
296
|
// Sideband control connections attach to an existing call via `call_id`.
|
|
299
297
|
if (hasCallID) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getRealtimeAPIKey, resolveRealtimeAPIKey } from '../internal/realtime-credentials';
|
|
1
2
|
import type { AzureOpenAI } from '../index';
|
|
2
3
|
import { assertBedrockWebSocketOrigin } from '../internal/bedrock';
|
|
3
4
|
import { OpenAI } from '../index';
|
|
@@ -175,15 +176,18 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
175
176
|
onURL?: (url: URL) => void;
|
|
176
177
|
/** Indicates the token was resolved by the factory just before connecting. @internal */
|
|
177
178
|
__resolvedApiKey?: boolean;
|
|
179
|
+
/** Credential captured by an async factory for this connection. @internal */
|
|
180
|
+
__apiKey?: string | null;
|
|
178
181
|
},
|
|
179
182
|
client?: Pick<OpenAI, 'apiKey' | 'baseURL'>,
|
|
180
183
|
) {
|
|
181
184
|
super();
|
|
185
|
+
let apiKey = getRealtimeAPIKey(client, props.__apiKey);
|
|
182
186
|
const hasProvider = typeof (client as any)?._options?.apiKey === 'function';
|
|
183
187
|
const dangerouslyAllowBrowser =
|
|
184
188
|
props.dangerouslyAllowBrowser ??
|
|
185
189
|
(client as any)?._options?.dangerouslyAllowBrowser ??
|
|
186
|
-
(
|
|
190
|
+
(apiKey?.startsWith('ek_') ? true : null);
|
|
187
191
|
if (!dangerouslyAllowBrowser && isRunningInBrowserOrBrowserWorker()) {
|
|
188
192
|
throw new OpenAIError(
|
|
189
193
|
"It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\n\nYou can avoid this error by creating an ephemeral session token:\nhttps://platform.openai.com/docs/api-reference/realtime-sessions\n",
|
|
@@ -191,6 +195,9 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
client ??= new OpenAI({ dangerouslyAllowBrowser });
|
|
198
|
+
if (apiKey === undefined) {
|
|
199
|
+
apiKey = client.apiKey;
|
|
200
|
+
}
|
|
194
201
|
|
|
195
202
|
if (hasProvider && !props?.__resolvedApiKey) {
|
|
196
203
|
throw new Error(
|
|
@@ -209,10 +216,10 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
209
216
|
assertBedrockWebSocketOrigin(client, this.url);
|
|
210
217
|
|
|
211
218
|
const azure = isAzure(client);
|
|
212
|
-
const protocols = ['realtime', ...(azure ? [] : [`openai-insecure-api-key.${
|
|
219
|
+
const protocols = ['realtime', ...(azure ? [] : [`openai-insecure-api-key.${apiKey}`])];
|
|
213
220
|
|
|
214
221
|
this.socket = azure
|
|
215
|
-
? createAzureWebSocket(this.url,
|
|
222
|
+
? createAzureWebSocket(this.url, apiKey, props.__resolvedApiKey === true, protocols)
|
|
216
223
|
: new WebSocket(this.url.toString(), protocols);
|
|
217
224
|
|
|
218
225
|
this.socket.addEventListener('message', (websocketEvent: MessageEvent) => {
|
|
@@ -269,7 +276,7 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
269
276
|
dangerouslyAllowBrowser?: boolean;
|
|
270
277
|
},
|
|
271
278
|
): Promise<OpenAIRealtimeWebSocket> {
|
|
272
|
-
const resolvedApiKey = await client
|
|
279
|
+
const { apiKey, isProvider: resolvedApiKey } = await resolveRealtimeAPIKey(client);
|
|
273
280
|
const url = buildRealtimeURL(client, props);
|
|
274
281
|
assertBedrockWebSocketOrigin(client, url);
|
|
275
282
|
return new OpenAIRealtimeWebSocket(
|
|
@@ -277,6 +284,7 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
277
284
|
...props,
|
|
278
285
|
buildRealtimeURL: () => url,
|
|
279
286
|
__resolvedApiKey: resolvedApiKey,
|
|
287
|
+
__apiKey: apiKey,
|
|
280
288
|
},
|
|
281
289
|
client,
|
|
282
290
|
);
|
|
@@ -301,8 +309,7 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
301
309
|
} = {},
|
|
302
310
|
): Promise<OpenAIRealtimeWebSocket> {
|
|
303
311
|
const connection = getAzureRealtimeConnection(client, options);
|
|
304
|
-
const isApiKeyProvider = await client
|
|
305
|
-
const apiKey = client.apiKey;
|
|
312
|
+
const { apiKey, isProvider: isApiKeyProvider } = await resolveRealtimeAPIKey(client);
|
|
306
313
|
if (!apiKey) {
|
|
307
314
|
throw new Error('Azure OpenAI Realtime requires an API key');
|
|
308
315
|
}
|
|
@@ -312,6 +319,7 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
312
319
|
...connection,
|
|
313
320
|
...(dangerouslyAllowBrowser === undefined ? {} : { dangerouslyAllowBrowser }),
|
|
314
321
|
__resolvedApiKey: isApiKeyProvider,
|
|
322
|
+
__apiKey: apiKey,
|
|
315
323
|
},
|
|
316
324
|
client,
|
|
317
325
|
);
|
package/src/realtime/ws.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveRealtimeAPIKey } from '../internal/realtime-credentials';
|
|
1
2
|
import * as WS from 'ws';
|
|
2
3
|
import { assertBedrockWebSocketOrigin } from '../internal/bedrock';
|
|
3
4
|
import { protectWebSocketOptionsFromCredentialRedirects } from '../internal/ws';
|
|
@@ -46,11 +47,14 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter {
|
|
|
46
47
|
|
|
47
48
|
/** Indicates that a function-based credential was resolved by an async factory. @internal */
|
|
48
49
|
__resolvedApiKey?: boolean;
|
|
50
|
+
/** Credential captured by an async factory for this connection. @internal */
|
|
51
|
+
__apiKey?: string | null;
|
|
49
52
|
},
|
|
50
53
|
client?: Pick<OpenAI, 'apiKey' | 'baseURL'>,
|
|
51
54
|
) {
|
|
52
55
|
super();
|
|
53
56
|
client ??= new OpenAI();
|
|
57
|
+
const apiKey = props.__apiKey === undefined ? client.apiKey : props.__apiKey;
|
|
54
58
|
const hasProvider = typeof (client as any)?._options?.apiKey === 'function';
|
|
55
59
|
if (hasProvider && !props.__resolvedApiKey) {
|
|
56
60
|
throw new Error(
|
|
@@ -65,7 +69,7 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter {
|
|
|
65
69
|
const headers = {
|
|
66
70
|
'User-Agent': `${client.constructor.name}/JS ${VERSION}`,
|
|
67
71
|
...props.options?.headers,
|
|
68
|
-
...(isAzure(client) && !props.__resolvedApiKey ? {} : { Authorization: `Bearer ${
|
|
72
|
+
...(isAzure(client) && !props.__resolvedApiKey ? {} : { Authorization: `Bearer ${apiKey}` }),
|
|
69
73
|
};
|
|
70
74
|
|
|
71
75
|
this.socket = new WS.WebSocket(
|
|
@@ -130,7 +134,7 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter {
|
|
|
130
134
|
options?: WS.ClientOptions | undefined;
|
|
131
135
|
},
|
|
132
136
|
): Promise<OpenAIRealtimeWS> {
|
|
133
|
-
const resolvedApiKey = await client
|
|
137
|
+
const { apiKey, isProvider: resolvedApiKey } = await resolveRealtimeAPIKey(client);
|
|
134
138
|
const url = buildRealtimeURL(client, props);
|
|
135
139
|
assertBedrockWebSocketOrigin(client, url);
|
|
136
140
|
return new OpenAIRealtimeWS(
|
|
@@ -138,6 +142,7 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter {
|
|
|
138
142
|
...props,
|
|
139
143
|
buildRealtimeURL: () => url,
|
|
140
144
|
__resolvedApiKey: resolvedApiKey,
|
|
145
|
+
__apiKey: apiKey,
|
|
141
146
|
},
|
|
142
147
|
client,
|
|
143
148
|
);
|
|
@@ -162,8 +167,7 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter {
|
|
|
162
167
|
} = {},
|
|
163
168
|
): Promise<OpenAIRealtimeWS> {
|
|
164
169
|
const connection = getAzureRealtimeConnection(client, props);
|
|
165
|
-
const isApiKeyProvider = await client
|
|
166
|
-
const apiKey = client.apiKey;
|
|
170
|
+
const { apiKey, isProvider: isApiKeyProvider } = await resolveRealtimeAPIKey(client);
|
|
167
171
|
if (!apiKey) {
|
|
168
172
|
throw new Error('Azure OpenAI Realtime requires an API key');
|
|
169
173
|
}
|
|
@@ -178,6 +182,7 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter {
|
|
|
178
182
|
},
|
|
179
183
|
},
|
|
180
184
|
__resolvedApiKey: isApiKeyProvider,
|
|
185
|
+
__apiKey: apiKey,
|
|
181
186
|
},
|
|
182
187
|
client,
|
|
183
188
|
);
|
|
@@ -56,6 +56,12 @@ export interface APIKeyCreateResponse {
|
|
|
56
56
|
* The unredacted API key value.
|
|
57
57
|
*/
|
|
58
58
|
value: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The Unix timestamp (in seconds) when the API key expires, or null if it does not
|
|
62
|
+
* expire.
|
|
63
|
+
*/
|
|
64
|
+
expires_at?: number | null;
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
export interface APIKeyCreateParams {
|
|
@@ -64,6 +70,11 @@ export interface APIKeyCreateParams {
|
|
|
64
70
|
*/
|
|
65
71
|
project_id: string;
|
|
66
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Body param: Number of seconds until the API key expires.
|
|
75
|
+
*/
|
|
76
|
+
expires_in_seconds?: number | null;
|
|
77
|
+
|
|
67
78
|
/**
|
|
68
79
|
* Body param: API key name.
|
|
69
80
|
*/
|
|
@@ -1378,6 +1378,15 @@ export interface BetaResponse {
|
|
|
1378
1378
|
*/
|
|
1379
1379
|
prompt?: BetaResponsePrompt | null;
|
|
1380
1380
|
|
|
1381
|
+
/**
|
|
1382
|
+
* Prompt cache diagnostics requested for this response.
|
|
1383
|
+
*/
|
|
1384
|
+
prompt_cache_diagnostics?:
|
|
1385
|
+
| BetaResponse.CacheMiss
|
|
1386
|
+
| BetaResponse.CacheHit
|
|
1387
|
+
| BetaResponse.ComparisonResponseNotFound
|
|
1388
|
+
| BetaResponse.Unavailable;
|
|
1389
|
+
|
|
1381
1390
|
/**
|
|
1382
1391
|
* Used by OpenAI to cache responses for similar requests to optimize your cache
|
|
1383
1392
|
* hit rates. Replaces the `user` field.
|
|
@@ -1669,6 +1678,47 @@ export namespace BetaResponse {
|
|
|
1669
1678
|
}
|
|
1670
1679
|
}
|
|
1671
1680
|
|
|
1681
|
+
export interface CacheMiss {
|
|
1682
|
+
/**
|
|
1683
|
+
* The estimated number of input tokens affected after the first detected
|
|
1684
|
+
* divergence.
|
|
1685
|
+
*/
|
|
1686
|
+
cache_missed_tokens: number;
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* The reason prompt cache reuse did not occur.
|
|
1690
|
+
*/
|
|
1691
|
+
reason:
|
|
1692
|
+
| 'model_changed'
|
|
1693
|
+
| 'prompt_cache_key_changed'
|
|
1694
|
+
| 'tools_changed'
|
|
1695
|
+
| 'text_format_changed'
|
|
1696
|
+
| 'reasoning_effort_changed'
|
|
1697
|
+
| 'verbosity_changed'
|
|
1698
|
+
| 'context_compacted'
|
|
1699
|
+
| 'input_changed'
|
|
1700
|
+
| 'service_tier_changed';
|
|
1701
|
+
|
|
1702
|
+
type: 'cache_miss';
|
|
1703
|
+
|
|
1704
|
+
/**
|
|
1705
|
+
* The raw token count of the reusable prefix in the compared response.
|
|
1706
|
+
*/
|
|
1707
|
+
comparison_reusable_tokens?: number;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
export interface CacheHit {
|
|
1711
|
+
type: 'cache_hit';
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
export interface ComparisonResponseNotFound {
|
|
1715
|
+
type: 'comparison_response_not_found';
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
export interface Unavailable {
|
|
1719
|
+
type: 'unavailable';
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1672
1722
|
/**
|
|
1673
1723
|
* The prompt-caching options that were applied to the response. Supported for
|
|
1674
1724
|
* `gpt-5.6` and later models.
|
|
@@ -1683,6 +1733,11 @@ export namespace BetaResponse {
|
|
|
1683
1733
|
* The minimum lifetime applied to each cache breakpoint.
|
|
1684
1734
|
*/
|
|
1685
1735
|
ttl: '30m';
|
|
1736
|
+
|
|
1737
|
+
/**
|
|
1738
|
+
* The response ID supplied as the prompt cache diagnostics comparison.
|
|
1739
|
+
*/
|
|
1740
|
+
comparison_response_id?: string | null;
|
|
1686
1741
|
}
|
|
1687
1742
|
|
|
1688
1743
|
/**
|
|
@@ -3788,11 +3843,6 @@ export interface BetaResponseFunctionCallArgumentsDoneEvent {
|
|
|
3788
3843
|
*/
|
|
3789
3844
|
item_id: string;
|
|
3790
3845
|
|
|
3791
|
-
/**
|
|
3792
|
-
* The name of the function that was called.
|
|
3793
|
-
*/
|
|
3794
|
-
name: string;
|
|
3795
|
-
|
|
3796
3846
|
/**
|
|
3797
3847
|
* The index of the output item.
|
|
3798
3848
|
*/
|
|
@@ -4330,7 +4380,7 @@ export interface BetaResponseFunctionWebSearch {
|
|
|
4330
4380
|
/**
|
|
4331
4381
|
* The status of the web search tool call.
|
|
4332
4382
|
*/
|
|
4333
|
-
status: 'in_progress' | 'searching' | 'completed' | 'failed';
|
|
4383
|
+
status: 'in_progress' | 'searching' | 'completed' | 'failed' | 'incomplete';
|
|
4334
4384
|
|
|
4335
4385
|
/**
|
|
4336
4386
|
* The type of the web search tool call. Always `web_search_call`.
|
|
@@ -5734,6 +5784,17 @@ export namespace BetaResponseInputItem {
|
|
|
5734
5784
|
* The agent that produced this item.
|
|
5735
5785
|
*/
|
|
5736
5786
|
agent?: ImageGenerationCall.Agent | null;
|
|
5787
|
+
|
|
5788
|
+
/**
|
|
5789
|
+
* The quality of the image generated by the image generation tool call. One of
|
|
5790
|
+
* `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
|
|
5791
|
+
*/
|
|
5792
|
+
quality?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'auto' | null;
|
|
5793
|
+
|
|
5794
|
+
/**
|
|
5795
|
+
* The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
5796
|
+
*/
|
|
5797
|
+
size?: (string & {}) | '1024x1024' | '1024x1536' | '1536x1024' | null;
|
|
5737
5798
|
}
|
|
5738
5799
|
|
|
5739
5800
|
export namespace ImageGenerationCall {
|
|
@@ -7212,6 +7273,17 @@ export namespace BetaResponseItem {
|
|
|
7212
7273
|
* The agent that produced this item.
|
|
7213
7274
|
*/
|
|
7214
7275
|
agent?: ImageGenerationCall.Agent | null;
|
|
7276
|
+
|
|
7277
|
+
/**
|
|
7278
|
+
* The quality of the image generated by the image generation tool call. One of
|
|
7279
|
+
* `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
|
|
7280
|
+
*/
|
|
7281
|
+
quality?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'auto' | null;
|
|
7282
|
+
|
|
7283
|
+
/**
|
|
7284
|
+
* The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
7285
|
+
*/
|
|
7286
|
+
size?: (string & {}) | '1024x1024' | '1024x1536' | '1536x1024' | null;
|
|
7215
7287
|
}
|
|
7216
7288
|
|
|
7217
7289
|
export namespace ImageGenerationCall {
|
|
@@ -8416,6 +8488,17 @@ export namespace BetaResponseOutputItem {
|
|
|
8416
8488
|
* The agent that produced this item.
|
|
8417
8489
|
*/
|
|
8418
8490
|
agent?: ImageGenerationCall.Agent | null;
|
|
8491
|
+
|
|
8492
|
+
/**
|
|
8493
|
+
* The quality of the image generated by the image generation tool call. One of
|
|
8494
|
+
* `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
|
|
8495
|
+
*/
|
|
8496
|
+
quality?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'auto' | null;
|
|
8497
|
+
|
|
8498
|
+
/**
|
|
8499
|
+
* The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
8500
|
+
*/
|
|
8501
|
+
size?: (string & {}) | '1024x1024' | '1024x1536' | '1536x1024' | null;
|
|
8419
8502
|
}
|
|
8420
8503
|
|
|
8421
8504
|
export namespace ImageGenerationCall {
|
|
@@ -11751,6 +11834,9 @@ export namespace BetaResponsesClientEvent {
|
|
|
11751
11834
|
|
|
11752
11835
|
/**
|
|
11753
11836
|
* Whether to store the generated model response for later retrieval via API.
|
|
11837
|
+
* Defaults to true when omitted. If set to true, response data will be stored for
|
|
11838
|
+
* at least 30 days, subject to the
|
|
11839
|
+
* [data retention exceptions](/api/docs/guides/your-data#v1responses).
|
|
11754
11840
|
*/
|
|
11755
11841
|
store?: boolean | null;
|
|
11756
11842
|
|
|
@@ -11966,6 +12052,12 @@ export namespace BetaResponsesClientEvent {
|
|
|
11966
12052
|
* for current details.
|
|
11967
12053
|
*/
|
|
11968
12054
|
export interface PromptCacheOptions {
|
|
12055
|
+
/**
|
|
12056
|
+
* The ID of a response to compare when diagnosing prompt cache reuse. Supplying
|
|
12057
|
+
* this field requests prompt cache diagnostics when the feature is enabled.
|
|
12058
|
+
*/
|
|
12059
|
+
comparison_response_id?: string | null;
|
|
12060
|
+
|
|
11969
12061
|
/**
|
|
11970
12062
|
* Controls whether OpenAI automatically creates an implicit cache breakpoint.
|
|
11971
12063
|
* Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
|
|
@@ -13214,9 +13306,11 @@ export namespace BetaTool {
|
|
|
13214
13306
|
* one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
|
|
13215
13307
|
* the model will automatically determine the best background for the image.
|
|
13216
13308
|
*
|
|
13217
|
-
*
|
|
13218
|
-
* `
|
|
13219
|
-
*
|
|
13309
|
+
* `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
|
|
13310
|
+
* snapshots, support `opaque` and `transparent` backgrounds. Transparent
|
|
13311
|
+
* backgrounds are available for supported GPT Image models. For `gpt-image-2` and
|
|
13312
|
+
* `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
|
|
13313
|
+
* set the output format to `png` or `webp`.
|
|
13220
13314
|
*/
|
|
13221
13315
|
background?: 'transparent' | 'opaque' | 'auto';
|
|
13222
13316
|
|
|
@@ -13236,7 +13330,9 @@ export namespace BetaTool {
|
|
|
13236
13330
|
|
|
13237
13331
|
/**
|
|
13238
13332
|
* The image generation model to use. One of `gpt-image-1`, `gpt-image-1-mini`,
|
|
13239
|
-
* `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
|
|
13333
|
+
* `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
|
|
13334
|
+
* `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
|
|
13335
|
+
* `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
|
|
13240
13336
|
* `chatgpt-image-latest`. Default: `gpt-image-1`.
|
|
13241
13337
|
*/
|
|
13242
13338
|
model?:
|
|
@@ -13245,6 +13341,10 @@ export namespace BetaTool {
|
|
|
13245
13341
|
| 'gpt-image-1-mini'
|
|
13246
13342
|
| 'gpt-image-2'
|
|
13247
13343
|
| 'gpt-image-2-2026-04-21'
|
|
13344
|
+
| 'gpt-image-2.5-sunburst'
|
|
13345
|
+
| 'gpt-image-2.5-sunburst-2026-09-08'
|
|
13346
|
+
| 'gpt-image-2.5-flare'
|
|
13347
|
+
| 'gpt-image-2.5-flare-2026-09-08'
|
|
13248
13348
|
| 'gpt-image-1.5'
|
|
13249
13349
|
| 'chatgpt-image-latest';
|
|
13250
13350
|
|
|
@@ -13271,23 +13371,26 @@ export namespace BetaTool {
|
|
|
13271
13371
|
partial_images?: number;
|
|
13272
13372
|
|
|
13273
13373
|
/**
|
|
13274
|
-
* The quality of the generated image.
|
|
13275
|
-
*
|
|
13374
|
+
* The quality of the generated image. The GPT image models support `low`,
|
|
13375
|
+
* `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
|
|
13376
|
+
* including their `2026-09-08` snapshots, also support `xhigh` and `max`. Default:
|
|
13377
|
+
* `auto`.
|
|
13276
13378
|
*/
|
|
13277
|
-
quality?: 'low' | 'medium' | 'high' | 'auto';
|
|
13379
|
+
quality?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'auto';
|
|
13278
13380
|
|
|
13279
13381
|
/**
|
|
13280
|
-
* The size of the generated images. For `gpt-image-2`
|
|
13281
|
-
* `gpt-image-2-2026-
|
|
13282
|
-
*
|
|
13283
|
-
*
|
|
13284
|
-
*
|
|
13285
|
-
*
|
|
13286
|
-
*
|
|
13287
|
-
*
|
|
13288
|
-
*
|
|
13289
|
-
* `
|
|
13290
|
-
* `
|
|
13382
|
+
* The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
|
|
13383
|
+
* `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
|
|
13384
|
+
* `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
|
|
13385
|
+
* resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
|
|
13386
|
+
* Width and height must both be divisible by 16 and the requested aspect ratio
|
|
13387
|
+
* must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
|
|
13388
|
+
* the maximum supported resolution is `3840x2160`. The requested size must also
|
|
13389
|
+
* satisfy the model's current pixel and edge limits. The standard sizes
|
|
13390
|
+
* `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
|
|
13391
|
+
* `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
|
|
13392
|
+
* one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
|
|
13393
|
+
* `1024x1024`, `1792x1024`, or `1024x1792`.
|
|
13291
13394
|
*/
|
|
13292
13395
|
size?: (string & {}) | '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
|
|
13293
13396
|
}
|
|
@@ -13958,7 +14061,9 @@ export interface ResponseCreateParamsBase {
|
|
|
13958
14061
|
|
|
13959
14062
|
/**
|
|
13960
14063
|
* Body param: Whether to store the generated model response for later retrieval
|
|
13961
|
-
* via API.
|
|
14064
|
+
* via API. Defaults to true when omitted. If set to true, response data will be
|
|
14065
|
+
* stored for at least 30 days, subject to the
|
|
14066
|
+
* [data retention exceptions](/api/docs/guides/your-data#v1responses).
|
|
13962
14067
|
*/
|
|
13963
14068
|
store?: boolean | null;
|
|
13964
14069
|
|
|
@@ -14173,6 +14278,12 @@ export namespace ResponseCreateParams {
|
|
|
14173
14278
|
* for current details.
|
|
14174
14279
|
*/
|
|
14175
14280
|
export interface PromptCacheOptions {
|
|
14281
|
+
/**
|
|
14282
|
+
* The ID of a response to compare when diagnosing prompt cache reuse. Supplying
|
|
14283
|
+
* this field requests prompt cache diagnostics when the feature is enabled.
|
|
14284
|
+
*/
|
|
14285
|
+
comparison_response_id?: string | null;
|
|
14286
|
+
|
|
14176
14287
|
/**
|
|
14177
14288
|
* Controls whether OpenAI automatically creates an implicit cache breakpoint.
|
|
14178
14289
|
* Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
|
|
@@ -14549,12 +14660,13 @@ export interface ResponseCompactParams {
|
|
|
14549
14660
|
* request will be processed with the Flex Processing service tier. - To opt-in to
|
|
14550
14661
|
* [Fast mode](/api/docs/guides/fast-mode) at the request level, include the
|
|
14551
14662
|
* `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat
|
|
14552
|
-
* Completions.
|
|
14553
|
-
*
|
|
14554
|
-
* default behavior is 'auto'. When
|
|
14555
|
-
*
|
|
14556
|
-
*
|
|
14557
|
-
* the value set in the
|
|
14663
|
+
* Completions. For models with a dedicated Fast tier, either value resolves to
|
|
14664
|
+
* `service_tier=fast`; for other models, either value resolves to
|
|
14665
|
+
* `service_tier=priority`. - When not set, the default behavior is 'auto'. When
|
|
14666
|
+
* the `service_tier` parameter is set, the response body will include the
|
|
14667
|
+
* `service_tier` value based on the processing mode actually used to serve the
|
|
14668
|
+
* request. This response value may be different from the value set in the
|
|
14669
|
+
* parameter.
|
|
14558
14670
|
*/
|
|
14559
14671
|
service_tier?: 'auto' | 'default' | 'fast' | 'flex' | 'priority' | null;
|
|
14560
14672
|
|
|
@@ -142,6 +142,17 @@ export namespace ConversationItem {
|
|
|
142
142
|
* The type of the image generation call. Always `image_generation_call`.
|
|
143
143
|
*/
|
|
144
144
|
type: 'image_generation_call';
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The quality of the image generated by the image generation tool call. One of
|
|
148
|
+
* `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
|
|
149
|
+
*/
|
|
150
|
+
quality?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'auto' | null;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
154
|
+
*/
|
|
155
|
+
size?: (string & {}) | '1024x1024' | '1024x1536' | '1536x1024' | null;
|
|
145
156
|
}
|
|
146
157
|
|
|
147
158
|
export interface AdditionalTools {
|