@ai-sdk/openai 3.0.116 → 3.0.118
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 +18 -0
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1398 -1325
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1386 -1312
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1196 -1123
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1179 -1105
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +83 -34
- package/package.json +2 -2
- package/src/chat/openai-chat-api.ts +5 -0
- package/src/chat/openai-chat-language-model.ts +4 -1
- package/src/index.ts +1 -0
- package/src/openai-stream-error.ts +4 -0
- package/src/responses/convert-to-openai-responses-input.ts +39 -0
- package/src/responses/openai-responses-language-model.ts +64 -15
- package/src/responses/openai-responses-options.ts +22 -0
package/dist/index.mjs
CHANGED
|
@@ -153,7 +153,8 @@ function createOpenAIStreamError({
|
|
|
153
153
|
statusCode: streamError == null ? 500 : getStatusCode(streamError),
|
|
154
154
|
responseHeaders,
|
|
155
155
|
responseBody: JSON.stringify(frame),
|
|
156
|
-
data: frame
|
|
156
|
+
data: frame,
|
|
157
|
+
isRetryable: streamError == null ? true : isRetryableStreamError(streamError, getStatusCode(streamError))
|
|
157
158
|
});
|
|
158
159
|
}
|
|
159
160
|
function parseStreamError(frame) {
|
|
@@ -572,6 +573,9 @@ var openaiChatResponseSchema = lazySchema(
|
|
|
572
573
|
message: z2.object({
|
|
573
574
|
role: z2.literal("assistant").nullish(),
|
|
574
575
|
content: z2.string().nullish(),
|
|
576
|
+
audio: z2.object({
|
|
577
|
+
transcript: z2.string().nullish()
|
|
578
|
+
}).nullish(),
|
|
575
579
|
tool_calls: z2.array(
|
|
576
580
|
z2.object({
|
|
577
581
|
id: z2.string().nullish(),
|
|
@@ -1116,7 +1120,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1116
1120
|
};
|
|
1117
1121
|
}
|
|
1118
1122
|
async doGenerate(options) {
|
|
1119
|
-
var _a2, _b, _c, _d, _e, _f, _g;
|
|
1123
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
1120
1124
|
const { args: body, warnings } = await this.getArgs(options);
|
|
1121
1125
|
const {
|
|
1122
1126
|
responseHeaders,
|
|
@@ -1144,19 +1148,19 @@ var OpenAIChatLanguageModel = class {
|
|
|
1144
1148
|
});
|
|
1145
1149
|
}
|
|
1146
1150
|
const content = [];
|
|
1147
|
-
const text = choice.message.content;
|
|
1151
|
+
const text = choice.message.content != null && choice.message.content.length > 0 ? choice.message.content : (_a2 = choice.message.audio) == null ? void 0 : _a2.transcript;
|
|
1148
1152
|
if (text != null && text.length > 0) {
|
|
1149
1153
|
content.push({ type: "text", text });
|
|
1150
1154
|
}
|
|
1151
|
-
for (const toolCall of (
|
|
1155
|
+
for (const toolCall of (_b = choice.message.tool_calls) != null ? _b : []) {
|
|
1152
1156
|
content.push({
|
|
1153
1157
|
type: "tool-call",
|
|
1154
|
-
toolCallId: (
|
|
1158
|
+
toolCallId: (_c = toolCall.id) != null ? _c : generateId(),
|
|
1155
1159
|
toolName: toolCall.function.name,
|
|
1156
1160
|
input: toolCall.function.arguments
|
|
1157
1161
|
});
|
|
1158
1162
|
}
|
|
1159
|
-
for (const annotation of (
|
|
1163
|
+
for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
|
|
1160
1164
|
content.push({
|
|
1161
1165
|
type: "source",
|
|
1162
1166
|
sourceType: "url",
|
|
@@ -1165,8 +1169,8 @@ var OpenAIChatLanguageModel = class {
|
|
|
1165
1169
|
title: annotation.url_citation.title
|
|
1166
1170
|
});
|
|
1167
1171
|
}
|
|
1168
|
-
const completionTokenDetails = (
|
|
1169
|
-
const promptTokenDetails = (
|
|
1172
|
+
const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
|
|
1173
|
+
const promptTokenDetails = (_f = response.usage) == null ? void 0 : _f.prompt_tokens_details;
|
|
1170
1174
|
const providerMetadata = { openai: {} };
|
|
1171
1175
|
if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
|
|
1172
1176
|
providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
|
|
@@ -1174,14 +1178,14 @@ var OpenAIChatLanguageModel = class {
|
|
|
1174
1178
|
if ((completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens) != null) {
|
|
1175
1179
|
providerMetadata.openai.rejectedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens;
|
|
1176
1180
|
}
|
|
1177
|
-
if (((
|
|
1181
|
+
if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
|
|
1178
1182
|
providerMetadata.openai.logprobs = choice.logprobs.content;
|
|
1179
1183
|
}
|
|
1180
1184
|
return {
|
|
1181
1185
|
content,
|
|
1182
1186
|
finishReason: {
|
|
1183
1187
|
unified: mapOpenAIFinishReason(choice.finish_reason),
|
|
1184
|
-
raw: (
|
|
1188
|
+
raw: (_h = choice.finish_reason) != null ? _h : void 0
|
|
1185
1189
|
},
|
|
1186
1190
|
usage: convertOpenAIChatUsage(response.usage),
|
|
1187
1191
|
request: { body },
|
|
@@ -3077,6 +3081,7 @@ var openaiTools = {
|
|
|
3077
3081
|
|
|
3078
3082
|
// src/responses/openai-responses-language-model.ts
|
|
3079
3083
|
import {
|
|
3084
|
+
UnsupportedFunctionalityError as UnsupportedFunctionalityError6,
|
|
3080
3085
|
APICallError as APICallError2
|
|
3081
3086
|
} from "@ai-sdk/provider";
|
|
3082
3087
|
import {
|
|
@@ -3140,259 +3145,560 @@ import {
|
|
|
3140
3145
|
parseProviderOptions as parseProviderOptions5,
|
|
3141
3146
|
validateTypes
|
|
3142
3147
|
} from "@ai-sdk/provider-utils";
|
|
3143
|
-
import { z as
|
|
3148
|
+
import { z as z22 } from "zod/v4";
|
|
3144
3149
|
|
|
3145
|
-
// src/responses/
|
|
3150
|
+
// src/responses/openai-responses-options.ts
|
|
3146
3151
|
import {
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
var
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3152
|
+
lazySchema as lazySchema20,
|
|
3153
|
+
zodSchema as zodSchema20
|
|
3154
|
+
} from "@ai-sdk/provider-utils";
|
|
3155
|
+
import { z as z21 } from "zod/v4";
|
|
3156
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
3157
|
+
var openaiResponsesReasoningModelIds = [
|
|
3158
|
+
"o1",
|
|
3159
|
+
"o1-2024-12-17",
|
|
3160
|
+
"o3",
|
|
3161
|
+
"o3-2025-04-16",
|
|
3162
|
+
"o3-mini",
|
|
3163
|
+
"o3-mini-2025-01-31",
|
|
3164
|
+
"o4-mini",
|
|
3165
|
+
"o4-mini-2025-04-16",
|
|
3166
|
+
"gpt-5",
|
|
3167
|
+
"gpt-5-2025-08-07",
|
|
3168
|
+
"gpt-5-codex",
|
|
3169
|
+
"gpt-5-mini",
|
|
3170
|
+
"gpt-5-mini-2025-08-07",
|
|
3171
|
+
"gpt-5-nano",
|
|
3172
|
+
"gpt-5-nano-2025-08-07",
|
|
3173
|
+
"gpt-5-pro",
|
|
3174
|
+
"gpt-5-pro-2025-10-06",
|
|
3175
|
+
"gpt-5.1",
|
|
3176
|
+
"gpt-5.1-chat-latest",
|
|
3177
|
+
"gpt-5.1-codex-mini",
|
|
3178
|
+
"gpt-5.1-codex",
|
|
3179
|
+
"gpt-5.1-codex-max",
|
|
3180
|
+
"gpt-5.2",
|
|
3181
|
+
"gpt-5.2-chat-latest",
|
|
3182
|
+
"gpt-5.2-pro",
|
|
3183
|
+
"gpt-5.2-codex",
|
|
3184
|
+
"gpt-5.3-chat-latest",
|
|
3185
|
+
"gpt-5.3-codex",
|
|
3186
|
+
"gpt-5.4",
|
|
3187
|
+
"gpt-5.4-2026-03-05",
|
|
3188
|
+
"gpt-5.4-mini",
|
|
3189
|
+
"gpt-5.4-mini-2026-03-17",
|
|
3190
|
+
"gpt-5.4-nano",
|
|
3191
|
+
"gpt-5.4-nano-2026-03-17",
|
|
3192
|
+
"gpt-5.4-pro",
|
|
3193
|
+
"gpt-5.4-pro-2026-03-05",
|
|
3194
|
+
"gpt-5.5",
|
|
3195
|
+
"gpt-5.5-2026-04-23",
|
|
3196
|
+
"gpt-5.6",
|
|
3197
|
+
"gpt-5.6-luna",
|
|
3198
|
+
"gpt-5.6-sol",
|
|
3199
|
+
"gpt-5.6-terra",
|
|
3200
|
+
"gpt-6-astra",
|
|
3201
|
+
"gpt-6-luna",
|
|
3202
|
+
"gpt-6-sol"
|
|
3203
|
+
];
|
|
3204
|
+
var openaiResponsesModelIds = [
|
|
3205
|
+
"gpt-4.1",
|
|
3206
|
+
"gpt-4.1-2025-04-14",
|
|
3207
|
+
"gpt-4.1-mini",
|
|
3208
|
+
"gpt-4.1-mini-2025-04-14",
|
|
3209
|
+
"gpt-4.1-nano",
|
|
3210
|
+
"gpt-4.1-nano-2025-04-14",
|
|
3211
|
+
"gpt-4o",
|
|
3212
|
+
"gpt-4o-2024-05-13",
|
|
3213
|
+
"gpt-4o-2024-08-06",
|
|
3214
|
+
"gpt-4o-2024-11-20",
|
|
3215
|
+
"gpt-4o-audio-preview",
|
|
3216
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
3217
|
+
"gpt-4o-search-preview",
|
|
3218
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
3219
|
+
"gpt-4o-mini-search-preview",
|
|
3220
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
3221
|
+
"gpt-4o-mini",
|
|
3222
|
+
"gpt-4o-mini-2024-07-18",
|
|
3223
|
+
"gpt-3.5-turbo-0125",
|
|
3224
|
+
"gpt-3.5-turbo",
|
|
3225
|
+
"gpt-3.5-turbo-1106",
|
|
3226
|
+
"gpt-5-chat-latest",
|
|
3227
|
+
...openaiResponsesReasoningModelIds
|
|
3228
|
+
];
|
|
3229
|
+
var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
|
|
3230
|
+
() => zodSchema20(
|
|
3231
|
+
z21.object({
|
|
3232
|
+
/**
|
|
3233
|
+
* The ID of the OpenAI Conversation to continue.
|
|
3234
|
+
* You must create a conversation first via the OpenAI API.
|
|
3235
|
+
* Cannot be used in conjunction with `previousResponseId`.
|
|
3236
|
+
* Defaults to `undefined`.
|
|
3237
|
+
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
3238
|
+
*/
|
|
3239
|
+
conversation: z21.string().nullish(),
|
|
3240
|
+
/**
|
|
3241
|
+
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
3242
|
+
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
|
|
3243
|
+
*/
|
|
3244
|
+
include: z21.array(
|
|
3245
|
+
z21.enum([
|
|
3246
|
+
"reasoning.encrypted_content",
|
|
3247
|
+
// handled internally by default, only needed for unknown reasoning models
|
|
3248
|
+
"file_search_call.results",
|
|
3249
|
+
"web_search_call.results",
|
|
3250
|
+
"message.output_text.logprobs"
|
|
3251
|
+
])
|
|
3252
|
+
).nullish(),
|
|
3253
|
+
/**
|
|
3254
|
+
* Instructions for the model.
|
|
3255
|
+
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
3256
|
+
* Defaults to `undefined`.
|
|
3257
|
+
*/
|
|
3258
|
+
instructions: z21.string().nullish(),
|
|
3259
|
+
/**
|
|
3260
|
+
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
3261
|
+
* the response size and can slow down response times. However, it can
|
|
3262
|
+
* be useful to better understand how the model is behaving.
|
|
3263
|
+
*
|
|
3264
|
+
* Setting to true will return the log probabilities of the tokens that
|
|
3265
|
+
* were generated.
|
|
3266
|
+
*
|
|
3267
|
+
* Setting to a number will return the log probabilities of the top n
|
|
3268
|
+
* tokens that were generated.
|
|
3269
|
+
*
|
|
3270
|
+
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3271
|
+
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3272
|
+
*/
|
|
3273
|
+
logprobs: z21.union([z21.boolean(), z21.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3274
|
+
/**
|
|
3275
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3276
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3277
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
3278
|
+
*/
|
|
3279
|
+
maxToolCalls: z21.number().nullish(),
|
|
3280
|
+
/**
|
|
3281
|
+
* Additional metadata to store with the generation.
|
|
3282
|
+
*/
|
|
3283
|
+
metadata: z21.any().nullish(),
|
|
3284
|
+
/**
|
|
3285
|
+
* Whether to use parallel tool calls. Defaults to `true`.
|
|
3286
|
+
*/
|
|
3287
|
+
parallelToolCalls: z21.boolean().nullish(),
|
|
3288
|
+
/**
|
|
3289
|
+
* The ID of the previous response. You can use it to continue a conversation.
|
|
3290
|
+
* Defaults to `undefined`.
|
|
3291
|
+
*/
|
|
3292
|
+
previousResponseId: z21.string().nullish(),
|
|
3293
|
+
/**
|
|
3294
|
+
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
3295
|
+
*/
|
|
3296
|
+
promptCacheKey: z21.string().nullish(),
|
|
3297
|
+
/**
|
|
3298
|
+
* Prompt cache behavior for GPT-5.6 and later models.
|
|
3299
|
+
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
3300
|
+
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
3301
|
+
*/
|
|
3302
|
+
promptCacheOptions: z21.object({
|
|
3303
|
+
mode: z21.enum(["implicit", "explicit"]).optional(),
|
|
3304
|
+
ttl: z21.literal("30m").optional()
|
|
3305
|
+
}).optional(),
|
|
3306
|
+
/**
|
|
3307
|
+
* The retention policy for the prompt cache.
|
|
3308
|
+
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
3309
|
+
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
3310
|
+
* Available for models before GPT-5.6 that support extended caching.
|
|
3311
|
+
*
|
|
3312
|
+
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
3313
|
+
*
|
|
3314
|
+
* @default 'in_memory'
|
|
3315
|
+
*/
|
|
3316
|
+
promptCacheRetention: z21.enum(["in_memory", "24h"]).nullish(),
|
|
3317
|
+
/**
|
|
3318
|
+
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3319
|
+
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
3320
|
+
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
3321
|
+
* GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
3322
|
+
* Supported values vary by model.
|
|
3323
|
+
*/
|
|
3324
|
+
reasoningEffort: z21.string().nullish(),
|
|
3325
|
+
/**
|
|
3326
|
+
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
3327
|
+
* without changing the request-level reasoning effort. This preserves the
|
|
3328
|
+
* request prefix for prompt caching.
|
|
3329
|
+
*
|
|
3330
|
+
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
3331
|
+
* combined with automatic truncation.
|
|
3332
|
+
*/
|
|
3333
|
+
reasoningEffortUpdate: z21.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3334
|
+
/**
|
|
3335
|
+
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
3336
|
+
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
3337
|
+
*/
|
|
3338
|
+
reasoningMode: z21.enum(["standard", "pro"]).optional(),
|
|
3339
|
+
/**
|
|
3340
|
+
* Controls which available reasoning items GPT-5.6 can use.
|
|
3341
|
+
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
3342
|
+
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
3343
|
+
*/
|
|
3344
|
+
reasoningContext: z21.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
3345
|
+
/**
|
|
3346
|
+
* Controls reasoning summary output from the model.
|
|
3347
|
+
* Set to "auto" to automatically receive the richest level available,
|
|
3348
|
+
* or "detailed" for comprehensive summaries.
|
|
3349
|
+
*/
|
|
3350
|
+
reasoningSummary: z21.string().nullish(),
|
|
3351
|
+
/**
|
|
3352
|
+
* The identifier for safety monitoring and tracking.
|
|
3353
|
+
*/
|
|
3354
|
+
safetyIdentifier: z21.string().nullish(),
|
|
3355
|
+
/**
|
|
3356
|
+
* Service tier for the request.
|
|
3357
|
+
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
3358
|
+
* Set to 'priority' for faster processing with Enterprise access (available for gpt-4, gpt-5, gpt-5-mini, o3, o4-mini; gpt-5-nano is not supported).
|
|
3359
|
+
* Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
|
|
3360
|
+
*
|
|
3361
|
+
* Defaults to 'auto'.
|
|
3362
|
+
*/
|
|
3363
|
+
serviceTier: z21.enum(["auto", "flex", "priority", "fast", "default"]).nullish(),
|
|
3364
|
+
/**
|
|
3365
|
+
* Whether to store the generation. Defaults to `true`.
|
|
3366
|
+
*/
|
|
3367
|
+
store: z21.boolean().nullish(),
|
|
3368
|
+
/**
|
|
3369
|
+
* Whether to pass through non-image file types as generic input files.
|
|
3370
|
+
*
|
|
3371
|
+
* By default, inline file inputs are restricted to images and PDFs.
|
|
3372
|
+
* Enable this when the target OpenAI Responses model supports additional
|
|
3373
|
+
* file media types, such as text/csv.
|
|
3374
|
+
*/
|
|
3375
|
+
passThroughUnsupportedFiles: z21.boolean().optional(),
|
|
3376
|
+
/**
|
|
3377
|
+
* Whether to use strict JSON schema validation.
|
|
3378
|
+
* Defaults to `true`.
|
|
3379
|
+
*/
|
|
3380
|
+
strictJsonSchema: z21.boolean().nullish(),
|
|
3381
|
+
/**
|
|
3382
|
+
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
3383
|
+
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
3384
|
+
* Valid values: 'low', 'medium', 'high'.
|
|
3385
|
+
*/
|
|
3386
|
+
textVerbosity: z21.enum(["low", "medium", "high"]).nullish(),
|
|
3387
|
+
/**
|
|
3388
|
+
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
3389
|
+
* 'disabled' turns truncation off.
|
|
3390
|
+
*/
|
|
3391
|
+
truncation: z21.enum(["auto", "disabled"]).nullish(),
|
|
3392
|
+
/**
|
|
3393
|
+
* A unique identifier representing your end-user, which can help OpenAI to
|
|
3394
|
+
* monitor and detect abuse.
|
|
3395
|
+
* Defaults to `undefined`.
|
|
3396
|
+
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
3397
|
+
*/
|
|
3398
|
+
user: z21.string().nullish(),
|
|
3399
|
+
/**
|
|
3400
|
+
* Override the system message mode for this model.
|
|
3401
|
+
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
3402
|
+
* - 'developer': Use the 'developer' role for system messages (used by reasoning models)
|
|
3403
|
+
* - 'remove': Remove system messages entirely
|
|
3404
|
+
*
|
|
3405
|
+
* If not specified, the mode is automatically determined based on the model.
|
|
3406
|
+
*/
|
|
3407
|
+
systemMessageMode: z21.enum(["system", "developer", "remove"]).optional(),
|
|
3408
|
+
/**
|
|
3409
|
+
* Force treating this model as a reasoning model.
|
|
3410
|
+
*
|
|
3411
|
+
* This is useful for "stealth" reasoning models (e.g. via a custom baseURL)
|
|
3412
|
+
* where the model ID is not recognized by the SDK's allowlist.
|
|
3413
|
+
*
|
|
3414
|
+
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
3415
|
+
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
3416
|
+
*/
|
|
3417
|
+
forceReasoning: z21.boolean().optional(),
|
|
3418
|
+
/**
|
|
3419
|
+
* Restrict the callable tools to a subset while keeping the full tools
|
|
3420
|
+
* list intact, so prompt caching is preserved across requests with
|
|
3421
|
+
* different allowlists.
|
|
3422
|
+
*
|
|
3423
|
+
* When set, this overrides the request-level `toolChoice` and emits
|
|
3424
|
+
* `tool_choice: { type: "allowed_tools", mode, tools }` on the wire.
|
|
3425
|
+
*
|
|
3426
|
+
* @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
|
|
3427
|
+
*/
|
|
3428
|
+
allowedTools: z21.object({
|
|
3429
|
+
toolNames: z21.array(z21.string()).min(1),
|
|
3430
|
+
mode: z21.enum(["auto", "required"]).optional()
|
|
3431
|
+
}).optional()
|
|
3432
|
+
})
|
|
3433
|
+
)
|
|
3434
|
+
);
|
|
3435
|
+
var openaiResponsesSystemMessageOptionsSchema = lazySchema20(
|
|
3436
|
+
() => zodSchema20(
|
|
3437
|
+
z21.object({
|
|
3438
|
+
/**
|
|
3439
|
+
* Emit a configuration update at this position in Responses history.
|
|
3440
|
+
* Requires empty system message content and the same supported
|
|
3441
|
+
* configuration as the request-level reasoningEffortUpdate option.
|
|
3442
|
+
* Unsupported historical updates throw instead of being omitted.
|
|
3443
|
+
*
|
|
3444
|
+
* @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
|
|
3445
|
+
*/
|
|
3446
|
+
reasoningEffortUpdate: z21.enum(["low", "medium", "high", "xhigh", "max"]).optional()
|
|
3447
|
+
})
|
|
3448
|
+
)
|
|
3449
|
+
);
|
|
3450
|
+
|
|
3451
|
+
// src/responses/expand-parallel-tool-call.ts
|
|
3452
|
+
import {
|
|
3453
|
+
isJSONObject
|
|
3454
|
+
} from "@ai-sdk/provider";
|
|
3455
|
+
import { safeParseJSON } from "@ai-sdk/provider-utils";
|
|
3456
|
+
var parallelToolName = "parallel";
|
|
3457
|
+
var recipientNamePrefix = "functions.";
|
|
3458
|
+
function getParallelToolCallMetadata({
|
|
3459
|
+
providerOptions,
|
|
3460
|
+
providerOptionsName
|
|
3461
|
+
}) {
|
|
3462
|
+
var _a2;
|
|
3463
|
+
const metadata = (_a2 = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a2.parallelToolCall;
|
|
3464
|
+
if (!isJSONObject(metadata) || typeof metadata.itemId !== "string" || typeof metadata.toolCallId !== "string" || typeof metadata.toolName !== "string" || typeof metadata.input !== "string" || typeof metadata.index !== "number" || !Number.isInteger(metadata.index) || typeof metadata.count !== "number" || !Number.isInteger(metadata.count) || metadata.index < 0 || metadata.count <= metadata.index) {
|
|
3465
|
+
return void 0;
|
|
3466
|
+
}
|
|
3467
|
+
return metadata;
|
|
3468
|
+
}
|
|
3469
|
+
function isUndeclaredParallelToolCall({
|
|
3470
|
+
toolName,
|
|
3471
|
+
tools
|
|
3472
|
+
}) {
|
|
3473
|
+
return toolName === parallelToolName && !tools.some((tool) => tool.name === parallelToolName);
|
|
3474
|
+
}
|
|
3475
|
+
async function expandParallelToolCall({
|
|
3476
|
+
toolCall,
|
|
3477
|
+
tools,
|
|
3478
|
+
providerOptionsName,
|
|
3479
|
+
itemId
|
|
3480
|
+
}) {
|
|
3481
|
+
if (!isUndeclaredParallelToolCall({ toolName: toolCall.toolName, tools })) {
|
|
3482
|
+
return void 0;
|
|
3483
|
+
}
|
|
3484
|
+
const parsedInput = await safeParseJSON({ text: toolCall.input });
|
|
3485
|
+
if (!parsedInput.success || !isJSONObject(parsedInput.value)) {
|
|
3486
|
+
return void 0;
|
|
3487
|
+
}
|
|
3488
|
+
const toolUses = parsedInput.value.tool_uses;
|
|
3489
|
+
if (!Array.isArray(toolUses) || toolUses.length === 0) {
|
|
3490
|
+
return void 0;
|
|
3491
|
+
}
|
|
3492
|
+
const availableToolNames = new Set(tools.map((tool) => tool.name));
|
|
3493
|
+
const expandedToolCalls = [];
|
|
3494
|
+
for (const [index, toolUse] of toolUses.entries()) {
|
|
3495
|
+
if (!isJSONObject(toolUse)) {
|
|
3496
|
+
return void 0;
|
|
3497
|
+
}
|
|
3498
|
+
const recipientName = toolUse.recipient_name;
|
|
3499
|
+
const parameters = toolUse.parameters;
|
|
3500
|
+
if (typeof recipientName !== "string" || !recipientName.startsWith(recipientNamePrefix) || !isJSONObject(parameters)) {
|
|
3501
|
+
return void 0;
|
|
3502
|
+
}
|
|
3503
|
+
const toolName = recipientName.slice(recipientNamePrefix.length);
|
|
3504
|
+
if (toolName.length === 0 || !availableToolNames.has(toolName)) {
|
|
3505
|
+
return void 0;
|
|
3506
|
+
}
|
|
3507
|
+
expandedToolCalls.push({
|
|
3508
|
+
type: "tool-call",
|
|
3509
|
+
toolCallId: `${toolCall.toolCallId}_${index}`,
|
|
3510
|
+
toolName,
|
|
3511
|
+
input: JSON.stringify(parameters),
|
|
3512
|
+
providerMetadata: {
|
|
3513
|
+
[providerOptionsName]: {
|
|
3514
|
+
parallelToolCall: {
|
|
3515
|
+
itemId,
|
|
3516
|
+
toolCallId: toolCall.toolCallId,
|
|
3517
|
+
toolName: toolCall.toolName,
|
|
3518
|
+
input: toolCall.input,
|
|
3519
|
+
index,
|
|
3520
|
+
count: toolUses.length
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3524
|
+
});
|
|
3525
|
+
}
|
|
3526
|
+
return expandedToolCalls;
|
|
3527
|
+
}
|
|
3528
|
+
|
|
3529
|
+
// src/responses/convert-to-openai-responses-input.ts
|
|
3530
|
+
function serializeToolCallArguments2(input) {
|
|
3531
|
+
return JSON.stringify(input === void 0 ? {} : input);
|
|
3532
|
+
}
|
|
3533
|
+
async function convertFunctionToolResultOutput({
|
|
3534
|
+
output,
|
|
3535
|
+
promptCacheBreakpoint,
|
|
3536
|
+
providerOptionsName,
|
|
3537
|
+
warnings
|
|
3538
|
+
}) {
|
|
3539
|
+
var _a2;
|
|
3540
|
+
const convertScalarOutput = (value) => promptCacheBreakpoint == null ? value : [
|
|
3541
|
+
{
|
|
3542
|
+
type: "input_text",
|
|
3543
|
+
text: value,
|
|
3544
|
+
prompt_cache_breakpoint: promptCacheBreakpoint
|
|
3545
|
+
}
|
|
3546
|
+
];
|
|
3547
|
+
switch (output.type) {
|
|
3548
|
+
case "text":
|
|
3549
|
+
case "error-text":
|
|
3550
|
+
return convertScalarOutput(output.value);
|
|
3551
|
+
case "execution-denied": {
|
|
3552
|
+
return convertScalarOutput(
|
|
3553
|
+
(_a2 = output.reason) != null ? _a2 : "Tool call execution denied."
|
|
3554
|
+
);
|
|
3555
|
+
}
|
|
3556
|
+
case "json":
|
|
3557
|
+
case "error-json":
|
|
3558
|
+
return convertScalarOutput(JSON.stringify(output.value));
|
|
3559
|
+
case "content":
|
|
3560
|
+
return output.value.map((item) => {
|
|
3561
|
+
var _a3, _b, _c, _d, _e, _f, _g;
|
|
3562
|
+
const promptCacheBreakpoint2 = getPromptCacheBreakpoint2(
|
|
3563
|
+
item.providerOptions,
|
|
3564
|
+
providerOptionsName
|
|
3565
|
+
);
|
|
3566
|
+
switch (item.type) {
|
|
3567
|
+
case "text": {
|
|
3568
|
+
return {
|
|
3569
|
+
type: "input_text",
|
|
3570
|
+
text: item.text,
|
|
3571
|
+
...promptCacheBreakpoint2 != null && {
|
|
3572
|
+
prompt_cache_breakpoint: promptCacheBreakpoint2
|
|
3573
|
+
}
|
|
3574
|
+
};
|
|
3575
|
+
}
|
|
3576
|
+
case "image-data": {
|
|
3577
|
+
return {
|
|
3578
|
+
type: "input_image",
|
|
3579
|
+
image_url: `data:${item.mediaType};base64,${item.data}`,
|
|
3580
|
+
detail: (_b = (_a3 = item.providerOptions) == null ? void 0 : _a3[providerOptionsName]) == null ? void 0 : _b.imageDetail,
|
|
3581
|
+
...promptCacheBreakpoint2 != null && {
|
|
3582
|
+
prompt_cache_breakpoint: promptCacheBreakpoint2
|
|
3583
|
+
}
|
|
3584
|
+
};
|
|
3585
|
+
}
|
|
3586
|
+
case "image-url": {
|
|
3587
|
+
return {
|
|
3588
|
+
type: "input_image",
|
|
3589
|
+
image_url: item.url,
|
|
3590
|
+
detail: (_d = (_c = item.providerOptions) == null ? void 0 : _c[providerOptionsName]) == null ? void 0 : _d.imageDetail,
|
|
3591
|
+
...promptCacheBreakpoint2 != null && {
|
|
3592
|
+
prompt_cache_breakpoint: promptCacheBreakpoint2
|
|
3593
|
+
}
|
|
3594
|
+
};
|
|
3595
|
+
}
|
|
3596
|
+
case "file-id": {
|
|
3597
|
+
return {
|
|
3598
|
+
type: "input_file",
|
|
3599
|
+
file_id: typeof item.fileId === "string" ? item.fileId : item.fileId[providerOptionsName],
|
|
3600
|
+
...promptCacheBreakpoint2 != null && {
|
|
3601
|
+
prompt_cache_breakpoint: promptCacheBreakpoint2
|
|
3602
|
+
}
|
|
3603
|
+
};
|
|
3604
|
+
}
|
|
3605
|
+
case "image-file-id": {
|
|
3606
|
+
return {
|
|
3607
|
+
type: "input_image",
|
|
3608
|
+
file_id: typeof item.fileId === "string" ? item.fileId : item.fileId[providerOptionsName],
|
|
3609
|
+
detail: (_f = (_e = item.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.imageDetail,
|
|
3610
|
+
...promptCacheBreakpoint2 != null && {
|
|
3611
|
+
prompt_cache_breakpoint: promptCacheBreakpoint2
|
|
3612
|
+
}
|
|
3613
|
+
};
|
|
3614
|
+
}
|
|
3615
|
+
case "file-data": {
|
|
3616
|
+
return {
|
|
3617
|
+
type: "input_file",
|
|
3618
|
+
filename: (_g = item.filename) != null ? _g : "data",
|
|
3619
|
+
file_data: `data:${item.mediaType};base64,${item.data}`,
|
|
3620
|
+
...promptCacheBreakpoint2 != null && {
|
|
3621
|
+
prompt_cache_breakpoint: promptCacheBreakpoint2
|
|
3622
|
+
}
|
|
3623
|
+
};
|
|
3624
|
+
}
|
|
3625
|
+
case "file-url": {
|
|
3626
|
+
return {
|
|
3627
|
+
type: "input_file",
|
|
3628
|
+
file_url: item.url,
|
|
3629
|
+
...promptCacheBreakpoint2 != null && {
|
|
3630
|
+
prompt_cache_breakpoint: promptCacheBreakpoint2
|
|
3631
|
+
}
|
|
3632
|
+
};
|
|
3633
|
+
}
|
|
3634
|
+
default: {
|
|
3635
|
+
warnings.push({
|
|
3636
|
+
type: "other",
|
|
3637
|
+
message: `unsupported tool content part type: ${item.type}`
|
|
3638
|
+
});
|
|
3639
|
+
return void 0;
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
}).filter(isNonNullable);
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
function hasSameParallelToolCall(first, second) {
|
|
3646
|
+
return first.itemId === second.itemId && first.toolCallId === second.toolCallId && first.toolName === second.toolName && first.input === second.input && first.count === second.count;
|
|
3647
|
+
}
|
|
3648
|
+
function collectCompleteParallelToolResultGroups({
|
|
3649
|
+
prompt,
|
|
3650
|
+
providerOptionsName
|
|
3651
|
+
}) {
|
|
3652
|
+
const pendingGroups = /* @__PURE__ */ new Map();
|
|
3653
|
+
for (const message of prompt) {
|
|
3654
|
+
if (message.role !== "tool") {
|
|
3655
|
+
continue;
|
|
3656
|
+
}
|
|
3657
|
+
for (const part of message.content) {
|
|
3658
|
+
if (part.type !== "tool-result") {
|
|
3659
|
+
continue;
|
|
3660
|
+
}
|
|
3661
|
+
const metadata = getParallelToolCallMetadata({
|
|
3662
|
+
providerOptions: part.providerOptions,
|
|
3663
|
+
providerOptionsName
|
|
3664
|
+
});
|
|
3665
|
+
if (metadata == null) {
|
|
3666
|
+
continue;
|
|
3667
|
+
}
|
|
3668
|
+
const existing = pendingGroups.get(metadata.toolCallId);
|
|
3669
|
+
if (existing == null) {
|
|
3670
|
+
pendingGroups.set(metadata.toolCallId, {
|
|
3671
|
+
metadata,
|
|
3672
|
+
results: /* @__PURE__ */ new Map([[metadata.index, part]]),
|
|
3673
|
+
invalid: false
|
|
3674
|
+
});
|
|
3675
|
+
continue;
|
|
3676
|
+
}
|
|
3677
|
+
if (!hasSameParallelToolCall(existing.metadata, metadata) || existing.results.has(metadata.index)) {
|
|
3678
|
+
existing.invalid = true;
|
|
3679
|
+
continue;
|
|
3680
|
+
}
|
|
3681
|
+
existing.results.set(metadata.index, part);
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
const completeGroups = /* @__PURE__ */ new Map();
|
|
3685
|
+
for (const [toolCallId, group] of pendingGroups) {
|
|
3686
|
+
if (group.invalid || group.results.size !== group.metadata.count) {
|
|
3687
|
+
continue;
|
|
3688
|
+
}
|
|
3689
|
+
const results = Array.from(
|
|
3690
|
+
{ length: group.metadata.count },
|
|
3691
|
+
(_, index) => group.results.get(index)
|
|
3692
|
+
);
|
|
3693
|
+
if (results.every(isNonNullable)) {
|
|
3694
|
+
completeGroups.set(toolCallId, {
|
|
3695
|
+
metadata: group.metadata,
|
|
3696
|
+
results
|
|
3697
|
+
});
|
|
3698
|
+
}
|
|
3699
|
+
}
|
|
3700
|
+
return completeGroups;
|
|
3701
|
+
}
|
|
3396
3702
|
function getPromptCacheBreakpoint2(providerOptions, providerOptionsName) {
|
|
3397
3703
|
var _a2;
|
|
3398
3704
|
return (_a2 = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a2.promptCacheBreakpoint;
|
|
@@ -3423,6 +3729,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3423
3729
|
store,
|
|
3424
3730
|
hasConversation = false,
|
|
3425
3731
|
hasPreviousResponseId = false,
|
|
3732
|
+
configurationUpdateUnsupportedReason,
|
|
3426
3733
|
hasLocalShellTool = false,
|
|
3427
3734
|
hasShellTool = false,
|
|
3428
3735
|
hasApplyPatchTool = false,
|
|
@@ -3442,6 +3749,33 @@ async function convertToOpenAIResponsesInput({
|
|
|
3442
3749
|
for (const { role, content, providerOptions } of prompt) {
|
|
3443
3750
|
switch (role) {
|
|
3444
3751
|
case "system": {
|
|
3752
|
+
let options = await parseProviderOptions5({
|
|
3753
|
+
provider: providerOptionsName,
|
|
3754
|
+
providerOptions,
|
|
3755
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
3756
|
+
});
|
|
3757
|
+
if (options == null && providerOptionsName !== "openai") {
|
|
3758
|
+
options = await parseProviderOptions5({
|
|
3759
|
+
provider: "openai",
|
|
3760
|
+
providerOptions,
|
|
3761
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
3762
|
+
});
|
|
3763
|
+
}
|
|
3764
|
+
const effort = options == null ? void 0 : options.reasoningEffortUpdate;
|
|
3765
|
+
if (effort != null) {
|
|
3766
|
+
const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
|
|
3767
|
+
if (unsupportedReason != null) {
|
|
3768
|
+
throw new UnsupportedFunctionalityError4({
|
|
3769
|
+
functionality: "Message-level reasoningEffortUpdate",
|
|
3770
|
+
message: unsupportedReason
|
|
3771
|
+
});
|
|
3772
|
+
}
|
|
3773
|
+
input.push({
|
|
3774
|
+
type: "configuration_update",
|
|
3775
|
+
reasoning: { effort }
|
|
3776
|
+
});
|
|
3777
|
+
break;
|
|
3778
|
+
}
|
|
3445
3779
|
switch (systemMessageMode) {
|
|
3446
3780
|
case "system": {
|
|
3447
3781
|
const promptCacheBreakpoint = getPromptCacheBreakpoint2(
|
|
@@ -4158,9 +4492,9 @@ ${text}`,
|
|
|
4158
4492
|
}
|
|
4159
4493
|
return { input, warnings };
|
|
4160
4494
|
}
|
|
4161
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
4162
|
-
itemId:
|
|
4163
|
-
reasoningEncryptedContent:
|
|
4495
|
+
var openaiResponsesReasoningProviderOptionsSchema = z22.object({
|
|
4496
|
+
itemId: z22.string().nullish(),
|
|
4497
|
+
reasoningEncryptedContent: z22.string().nullish()
|
|
4164
4498
|
});
|
|
4165
4499
|
|
|
4166
4500
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -4183,77 +4517,77 @@ function mapOpenAIResponseFinishReason({
|
|
|
4183
4517
|
|
|
4184
4518
|
// src/responses/openai-responses-api.ts
|
|
4185
4519
|
import {
|
|
4186
|
-
lazySchema as
|
|
4187
|
-
zodSchema as
|
|
4520
|
+
lazySchema as lazySchema21,
|
|
4521
|
+
zodSchema as zodSchema21
|
|
4188
4522
|
} from "@ai-sdk/provider-utils";
|
|
4189
|
-
import { z as
|
|
4190
|
-
var jsonValueSchema2 =
|
|
4191
|
-
() =>
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4523
|
+
import { z as z23 } from "zod/v4";
|
|
4524
|
+
var jsonValueSchema2 = z23.lazy(
|
|
4525
|
+
() => z23.union([
|
|
4526
|
+
z23.string(),
|
|
4527
|
+
z23.number(),
|
|
4528
|
+
z23.boolean(),
|
|
4529
|
+
z23.null(),
|
|
4530
|
+
z23.array(jsonValueSchema2),
|
|
4531
|
+
z23.record(z23.string(), jsonValueSchema2.optional())
|
|
4198
4532
|
])
|
|
4199
4533
|
);
|
|
4200
|
-
var jsonObjectSchema =
|
|
4201
|
-
var openaiResponsesUsageSchema =
|
|
4534
|
+
var jsonObjectSchema = z23.record(z23.string(), jsonValueSchema2.optional());
|
|
4535
|
+
var openaiResponsesUsageSchema = z23.intersection(
|
|
4202
4536
|
jsonObjectSchema,
|
|
4203
|
-
|
|
4204
|
-
input_tokens:
|
|
4205
|
-
input_tokens_details:
|
|
4537
|
+
z23.object({
|
|
4538
|
+
input_tokens: z23.number(),
|
|
4539
|
+
input_tokens_details: z23.intersection(
|
|
4206
4540
|
jsonObjectSchema,
|
|
4207
|
-
|
|
4208
|
-
cached_tokens:
|
|
4209
|
-
cache_write_tokens:
|
|
4210
|
-
orchestration_input_tokens:
|
|
4211
|
-
orchestration_input_cached_tokens:
|
|
4541
|
+
z23.object({
|
|
4542
|
+
cached_tokens: z23.number().nullish(),
|
|
4543
|
+
cache_write_tokens: z23.number().nullish(),
|
|
4544
|
+
orchestration_input_tokens: z23.number().nullish(),
|
|
4545
|
+
orchestration_input_cached_tokens: z23.number().nullish()
|
|
4212
4546
|
})
|
|
4213
4547
|
).nullish(),
|
|
4214
|
-
output_tokens:
|
|
4215
|
-
output_tokens_details:
|
|
4548
|
+
output_tokens: z23.number(),
|
|
4549
|
+
output_tokens_details: z23.intersection(
|
|
4216
4550
|
jsonObjectSchema,
|
|
4217
|
-
|
|
4218
|
-
reasoning_tokens:
|
|
4219
|
-
orchestration_output_tokens:
|
|
4551
|
+
z23.object({
|
|
4552
|
+
reasoning_tokens: z23.number().nullish(),
|
|
4553
|
+
orchestration_output_tokens: z23.number().nullish()
|
|
4220
4554
|
})
|
|
4221
4555
|
).nullish(),
|
|
4222
|
-
total_tokens:
|
|
4556
|
+
total_tokens: z23.number().optional()
|
|
4223
4557
|
})
|
|
4224
4558
|
);
|
|
4225
4559
|
function isRecord(value) {
|
|
4226
4560
|
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
4227
4561
|
}
|
|
4228
|
-
var openaiResponsesLocalShellCallSchema =
|
|
4229
|
-
type:
|
|
4230
|
-
id:
|
|
4231
|
-
call_id:
|
|
4232
|
-
action:
|
|
4233
|
-
type:
|
|
4234
|
-
command:
|
|
4235
|
-
timeout_ms:
|
|
4236
|
-
user:
|
|
4237
|
-
working_directory:
|
|
4238
|
-
env:
|
|
4562
|
+
var openaiResponsesLocalShellCallSchema = z23.object({
|
|
4563
|
+
type: z23.literal("local_shell_call"),
|
|
4564
|
+
id: z23.string(),
|
|
4565
|
+
call_id: z23.string(),
|
|
4566
|
+
action: z23.object({
|
|
4567
|
+
type: z23.literal("exec"),
|
|
4568
|
+
command: z23.array(z23.string()),
|
|
4569
|
+
timeout_ms: z23.number().optional(),
|
|
4570
|
+
user: z23.string().optional(),
|
|
4571
|
+
working_directory: z23.string().optional(),
|
|
4572
|
+
env: z23.record(z23.string(), z23.string()).optional()
|
|
4239
4573
|
})
|
|
4240
4574
|
});
|
|
4241
|
-
var openaiResponsesNestedErrorChunkSchema =
|
|
4242
|
-
type:
|
|
4243
|
-
sequence_number:
|
|
4244
|
-
error:
|
|
4245
|
-
type:
|
|
4246
|
-
code:
|
|
4247
|
-
message:
|
|
4248
|
-
param:
|
|
4575
|
+
var openaiResponsesNestedErrorChunkSchema = z23.object({
|
|
4576
|
+
type: z23.literal("error"),
|
|
4577
|
+
sequence_number: z23.number(),
|
|
4578
|
+
error: z23.object({
|
|
4579
|
+
type: z23.string(),
|
|
4580
|
+
code: z23.string(),
|
|
4581
|
+
message: z23.string(),
|
|
4582
|
+
param: z23.string().nullish()
|
|
4249
4583
|
})
|
|
4250
4584
|
});
|
|
4251
|
-
var openaiResponsesErrorChunkSchema =
|
|
4252
|
-
type:
|
|
4253
|
-
sequence_number:
|
|
4254
|
-
code:
|
|
4255
|
-
message:
|
|
4256
|
-
param:
|
|
4585
|
+
var openaiResponsesErrorChunkSchema = z23.object({
|
|
4586
|
+
type: z23.literal("error"),
|
|
4587
|
+
sequence_number: z23.number(),
|
|
4588
|
+
code: z23.string().nullish(),
|
|
4589
|
+
message: z23.string(),
|
|
4590
|
+
param: z23.string().nullish()
|
|
4257
4591
|
});
|
|
4258
4592
|
var openaiResponsesModeledChunkTypes = /* @__PURE__ */ new Set([
|
|
4259
4593
|
"error",
|
|
@@ -4309,1105 +4643,819 @@ function isModeledOpenAIResponsesChunk(value) {
|
|
|
4309
4643
|
}
|
|
4310
4644
|
return openaiResponsesModeledOutputItemTypes.has(value.item.type);
|
|
4311
4645
|
}
|
|
4312
|
-
var openaiResponsesChunkSchema =
|
|
4313
|
-
() =>
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
type:
|
|
4317
|
-
item_id:
|
|
4318
|
-
delta:
|
|
4319
|
-
logprobs:
|
|
4320
|
-
|
|
4321
|
-
token:
|
|
4322
|
-
logprob:
|
|
4323
|
-
top_logprobs:
|
|
4324
|
-
|
|
4325
|
-
token:
|
|
4326
|
-
logprob:
|
|
4646
|
+
var openaiResponsesChunkSchema = lazySchema21(
|
|
4647
|
+
() => zodSchema21(
|
|
4648
|
+
z23.union([
|
|
4649
|
+
z23.object({
|
|
4650
|
+
type: z23.literal("response.output_text.delta"),
|
|
4651
|
+
item_id: z23.string(),
|
|
4652
|
+
delta: z23.string(),
|
|
4653
|
+
logprobs: z23.array(
|
|
4654
|
+
z23.object({
|
|
4655
|
+
token: z23.string(),
|
|
4656
|
+
logprob: z23.number(),
|
|
4657
|
+
top_logprobs: z23.array(
|
|
4658
|
+
z23.object({
|
|
4659
|
+
token: z23.string(),
|
|
4660
|
+
logprob: z23.number()
|
|
4327
4661
|
})
|
|
4328
4662
|
)
|
|
4329
4663
|
})
|
|
4330
4664
|
).nullish()
|
|
4331
4665
|
}),
|
|
4332
|
-
|
|
4333
|
-
type:
|
|
4334
|
-
response:
|
|
4335
|
-
incomplete_details:
|
|
4666
|
+
z23.object({
|
|
4667
|
+
type: z23.enum(["response.completed", "response.incomplete"]),
|
|
4668
|
+
response: z23.object({
|
|
4669
|
+
incomplete_details: z23.object({ reason: z23.string() }).nullish(),
|
|
4336
4670
|
usage: openaiResponsesUsageSchema.nullish(),
|
|
4337
|
-
reasoning:
|
|
4338
|
-
context:
|
|
4671
|
+
reasoning: z23.object({
|
|
4672
|
+
context: z23.string().nullish()
|
|
4339
4673
|
}).nullish(),
|
|
4340
|
-
service_tier:
|
|
4674
|
+
service_tier: z23.string().nullish()
|
|
4341
4675
|
})
|
|
4342
4676
|
}),
|
|
4343
|
-
|
|
4344
|
-
type:
|
|
4345
|
-
sequence_number:
|
|
4346
|
-
response:
|
|
4347
|
-
error:
|
|
4348
|
-
code:
|
|
4349
|
-
message:
|
|
4677
|
+
z23.object({
|
|
4678
|
+
type: z23.literal("response.failed"),
|
|
4679
|
+
sequence_number: z23.number(),
|
|
4680
|
+
response: z23.object({
|
|
4681
|
+
error: z23.object({
|
|
4682
|
+
code: z23.string().nullish(),
|
|
4683
|
+
message: z23.string()
|
|
4350
4684
|
}).nullish(),
|
|
4351
|
-
incomplete_details:
|
|
4685
|
+
incomplete_details: z23.object({ reason: z23.string() }).nullish(),
|
|
4352
4686
|
usage: openaiResponsesUsageSchema.nullish(),
|
|
4353
|
-
reasoning:
|
|
4354
|
-
context:
|
|
4687
|
+
reasoning: z23.object({
|
|
4688
|
+
context: z23.string().nullish()
|
|
4355
4689
|
}).nullish(),
|
|
4356
|
-
service_tier:
|
|
4690
|
+
service_tier: z23.string().nullish()
|
|
4357
4691
|
})
|
|
4358
4692
|
}),
|
|
4359
|
-
|
|
4360
|
-
type:
|
|
4361
|
-
response:
|
|
4362
|
-
id:
|
|
4363
|
-
created_at:
|
|
4364
|
-
model:
|
|
4365
|
-
service_tier:
|
|
4693
|
+
z23.object({
|
|
4694
|
+
type: z23.literal("response.created"),
|
|
4695
|
+
response: z23.object({
|
|
4696
|
+
id: z23.string(),
|
|
4697
|
+
created_at: z23.number(),
|
|
4698
|
+
model: z23.string(),
|
|
4699
|
+
service_tier: z23.string().nullish()
|
|
4366
4700
|
})
|
|
4367
4701
|
}),
|
|
4368
|
-
|
|
4369
|
-
type:
|
|
4370
|
-
output_index:
|
|
4371
|
-
item:
|
|
4372
|
-
|
|
4373
|
-
type:
|
|
4374
|
-
id:
|
|
4375
|
-
phase:
|
|
4702
|
+
z23.object({
|
|
4703
|
+
type: z23.literal("response.output_item.added"),
|
|
4704
|
+
output_index: z23.number(),
|
|
4705
|
+
item: z23.discriminatedUnion("type", [
|
|
4706
|
+
z23.object({
|
|
4707
|
+
type: z23.literal("message"),
|
|
4708
|
+
id: z23.string(),
|
|
4709
|
+
phase: z23.enum(["commentary", "final_answer"]).nullish()
|
|
4376
4710
|
}),
|
|
4377
|
-
|
|
4378
|
-
type:
|
|
4379
|
-
id:
|
|
4380
|
-
encrypted_content:
|
|
4711
|
+
z23.object({
|
|
4712
|
+
type: z23.literal("reasoning"),
|
|
4713
|
+
id: z23.string(),
|
|
4714
|
+
encrypted_content: z23.string().nullish()
|
|
4381
4715
|
}),
|
|
4382
|
-
|
|
4383
|
-
type:
|
|
4384
|
-
id:
|
|
4385
|
-
call_id:
|
|
4386
|
-
name:
|
|
4387
|
-
arguments:
|
|
4388
|
-
async:
|
|
4389
|
-
namespace:
|
|
4716
|
+
z23.object({
|
|
4717
|
+
type: z23.literal("function_call"),
|
|
4718
|
+
id: z23.string(),
|
|
4719
|
+
call_id: z23.string(),
|
|
4720
|
+
name: z23.string(),
|
|
4721
|
+
arguments: z23.string(),
|
|
4722
|
+
async: z23.boolean().nullish(),
|
|
4723
|
+
namespace: z23.string().nullish()
|
|
4390
4724
|
}),
|
|
4391
|
-
|
|
4392
|
-
type:
|
|
4393
|
-
id:
|
|
4394
|
-
status:
|
|
4725
|
+
z23.object({
|
|
4726
|
+
type: z23.literal("web_search_call"),
|
|
4727
|
+
id: z23.string(),
|
|
4728
|
+
status: z23.string()
|
|
4395
4729
|
}),
|
|
4396
|
-
|
|
4397
|
-
type:
|
|
4398
|
-
id:
|
|
4399
|
-
status:
|
|
4730
|
+
z23.object({
|
|
4731
|
+
type: z23.literal("computer_call"),
|
|
4732
|
+
id: z23.string(),
|
|
4733
|
+
status: z23.string()
|
|
4400
4734
|
}),
|
|
4401
|
-
|
|
4402
|
-
type:
|
|
4403
|
-
id:
|
|
4735
|
+
z23.object({
|
|
4736
|
+
type: z23.literal("file_search_call"),
|
|
4737
|
+
id: z23.string()
|
|
4404
4738
|
}),
|
|
4405
4739
|
openaiResponsesLocalShellCallSchema,
|
|
4406
|
-
|
|
4407
|
-
type:
|
|
4408
|
-
id:
|
|
4740
|
+
z23.object({
|
|
4741
|
+
type: z23.literal("image_generation_call"),
|
|
4742
|
+
id: z23.string()
|
|
4409
4743
|
}),
|
|
4410
|
-
|
|
4411
|
-
type:
|
|
4412
|
-
id:
|
|
4413
|
-
container_id:
|
|
4414
|
-
code:
|
|
4415
|
-
outputs:
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4744
|
+
z23.object({
|
|
4745
|
+
type: z23.literal("code_interpreter_call"),
|
|
4746
|
+
id: z23.string(),
|
|
4747
|
+
container_id: z23.string(),
|
|
4748
|
+
code: z23.string().nullable(),
|
|
4749
|
+
outputs: z23.array(
|
|
4750
|
+
z23.discriminatedUnion("type", [
|
|
4751
|
+
z23.object({ type: z23.literal("logs"), logs: z23.string() }),
|
|
4752
|
+
z23.object({ type: z23.literal("image"), url: z23.string() })
|
|
4419
4753
|
])
|
|
4420
4754
|
).nullable(),
|
|
4421
|
-
status:
|
|
4755
|
+
status: z23.string()
|
|
4422
4756
|
}),
|
|
4423
|
-
|
|
4424
|
-
type:
|
|
4425
|
-
id:
|
|
4426
|
-
status:
|
|
4427
|
-
approval_request_id:
|
|
4757
|
+
z23.object({
|
|
4758
|
+
type: z23.literal("mcp_call"),
|
|
4759
|
+
id: z23.string(),
|
|
4760
|
+
status: z23.string(),
|
|
4761
|
+
approval_request_id: z23.string().nullish()
|
|
4428
4762
|
}),
|
|
4429
|
-
|
|
4430
|
-
type:
|
|
4431
|
-
id:
|
|
4763
|
+
z23.object({
|
|
4764
|
+
type: z23.literal("mcp_list_tools"),
|
|
4765
|
+
id: z23.string()
|
|
4432
4766
|
}),
|
|
4433
|
-
|
|
4434
|
-
type:
|
|
4435
|
-
id:
|
|
4767
|
+
z23.object({
|
|
4768
|
+
type: z23.literal("mcp_approval_request"),
|
|
4769
|
+
id: z23.string()
|
|
4436
4770
|
}),
|
|
4437
|
-
|
|
4438
|
-
type:
|
|
4439
|
-
id:
|
|
4440
|
-
call_id:
|
|
4441
|
-
status:
|
|
4442
|
-
operation:
|
|
4443
|
-
|
|
4444
|
-
type:
|
|
4445
|
-
path:
|
|
4446
|
-
diff:
|
|
4771
|
+
z23.object({
|
|
4772
|
+
type: z23.literal("apply_patch_call"),
|
|
4773
|
+
id: z23.string(),
|
|
4774
|
+
call_id: z23.string(),
|
|
4775
|
+
status: z23.enum(["in_progress", "completed"]),
|
|
4776
|
+
operation: z23.discriminatedUnion("type", [
|
|
4777
|
+
z23.object({
|
|
4778
|
+
type: z23.literal("create_file"),
|
|
4779
|
+
path: z23.string(),
|
|
4780
|
+
diff: z23.string()
|
|
4447
4781
|
}),
|
|
4448
|
-
|
|
4449
|
-
type:
|
|
4450
|
-
path:
|
|
4782
|
+
z23.object({
|
|
4783
|
+
type: z23.literal("delete_file"),
|
|
4784
|
+
path: z23.string()
|
|
4451
4785
|
}),
|
|
4452
|
-
|
|
4453
|
-
type:
|
|
4454
|
-
path:
|
|
4455
|
-
diff:
|
|
4786
|
+
z23.object({
|
|
4787
|
+
type: z23.literal("update_file"),
|
|
4788
|
+
path: z23.string(),
|
|
4789
|
+
diff: z23.string()
|
|
4456
4790
|
})
|
|
4457
4791
|
])
|
|
4458
4792
|
}),
|
|
4459
|
-
|
|
4460
|
-
type:
|
|
4461
|
-
id:
|
|
4462
|
-
call_id:
|
|
4463
|
-
name:
|
|
4464
|
-
input:
|
|
4465
|
-
async:
|
|
4793
|
+
z23.object({
|
|
4794
|
+
type: z23.literal("custom_tool_call"),
|
|
4795
|
+
id: z23.string(),
|
|
4796
|
+
call_id: z23.string(),
|
|
4797
|
+
name: z23.string(),
|
|
4798
|
+
input: z23.string(),
|
|
4799
|
+
async: z23.boolean().nullish()
|
|
4466
4800
|
}),
|
|
4467
|
-
|
|
4468
|
-
type:
|
|
4469
|
-
id:
|
|
4470
|
-
call_id:
|
|
4471
|
-
status:
|
|
4472
|
-
action:
|
|
4473
|
-
commands:
|
|
4801
|
+
z23.object({
|
|
4802
|
+
type: z23.literal("shell_call"),
|
|
4803
|
+
id: z23.string(),
|
|
4804
|
+
call_id: z23.string(),
|
|
4805
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
4806
|
+
action: z23.object({
|
|
4807
|
+
commands: z23.array(z23.string())
|
|
4474
4808
|
})
|
|
4475
4809
|
}),
|
|
4476
|
-
|
|
4477
|
-
type:
|
|
4478
|
-
id:
|
|
4479
|
-
call_id:
|
|
4480
|
-
status:
|
|
4481
|
-
output:
|
|
4482
|
-
|
|
4483
|
-
stdout:
|
|
4484
|
-
stderr:
|
|
4485
|
-
outcome:
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
type:
|
|
4489
|
-
exit_code:
|
|
4810
|
+
z23.object({
|
|
4811
|
+
type: z23.literal("shell_call_output"),
|
|
4812
|
+
id: z23.string(),
|
|
4813
|
+
call_id: z23.string(),
|
|
4814
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
4815
|
+
output: z23.array(
|
|
4816
|
+
z23.object({
|
|
4817
|
+
stdout: z23.string(),
|
|
4818
|
+
stderr: z23.string(),
|
|
4819
|
+
outcome: z23.discriminatedUnion("type", [
|
|
4820
|
+
z23.object({ type: z23.literal("timeout") }),
|
|
4821
|
+
z23.object({
|
|
4822
|
+
type: z23.literal("exit"),
|
|
4823
|
+
exit_code: z23.number()
|
|
4490
4824
|
})
|
|
4491
4825
|
])
|
|
4492
4826
|
})
|
|
4493
4827
|
)
|
|
4494
4828
|
}),
|
|
4495
|
-
|
|
4496
|
-
type:
|
|
4497
|
-
id:
|
|
4498
|
-
execution:
|
|
4499
|
-
call_id:
|
|
4500
|
-
status:
|
|
4501
|
-
arguments:
|
|
4829
|
+
z23.object({
|
|
4830
|
+
type: z23.literal("tool_search_call"),
|
|
4831
|
+
id: z23.string(),
|
|
4832
|
+
execution: z23.enum(["server", "client"]),
|
|
4833
|
+
call_id: z23.string().nullable(),
|
|
4834
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
4835
|
+
arguments: z23.unknown()
|
|
4502
4836
|
}),
|
|
4503
|
-
|
|
4504
|
-
type:
|
|
4505
|
-
id:
|
|
4506
|
-
execution:
|
|
4507
|
-
call_id:
|
|
4508
|
-
status:
|
|
4509
|
-
tools:
|
|
4837
|
+
z23.object({
|
|
4838
|
+
type: z23.literal("tool_search_output"),
|
|
4839
|
+
id: z23.string(),
|
|
4840
|
+
execution: z23.enum(["server", "client"]),
|
|
4841
|
+
call_id: z23.string().nullable(),
|
|
4842
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
4843
|
+
tools: z23.array(z23.record(z23.string(), jsonValueSchema2.optional()))
|
|
4510
4844
|
})
|
|
4511
4845
|
])
|
|
4512
4846
|
}),
|
|
4513
|
-
|
|
4514
|
-
type:
|
|
4515
|
-
output_index:
|
|
4516
|
-
item:
|
|
4517
|
-
|
|
4518
|
-
type:
|
|
4519
|
-
id:
|
|
4520
|
-
phase:
|
|
4847
|
+
z23.object({
|
|
4848
|
+
type: z23.literal("response.output_item.done"),
|
|
4849
|
+
output_index: z23.number(),
|
|
4850
|
+
item: z23.discriminatedUnion("type", [
|
|
4851
|
+
z23.object({
|
|
4852
|
+
type: z23.literal("message"),
|
|
4853
|
+
id: z23.string(),
|
|
4854
|
+
phase: z23.enum(["commentary", "final_answer"]).nullish()
|
|
4521
4855
|
}),
|
|
4522
|
-
|
|
4523
|
-
type:
|
|
4524
|
-
id:
|
|
4525
|
-
encrypted_content:
|
|
4856
|
+
z23.object({
|
|
4857
|
+
type: z23.literal("reasoning"),
|
|
4858
|
+
id: z23.string(),
|
|
4859
|
+
encrypted_content: z23.string().nullish()
|
|
4526
4860
|
}),
|
|
4527
|
-
|
|
4528
|
-
type:
|
|
4529
|
-
id:
|
|
4530
|
-
call_id:
|
|
4531
|
-
name:
|
|
4532
|
-
arguments:
|
|
4533
|
-
async:
|
|
4534
|
-
status:
|
|
4535
|
-
namespace:
|
|
4861
|
+
z23.object({
|
|
4862
|
+
type: z23.literal("function_call"),
|
|
4863
|
+
id: z23.string(),
|
|
4864
|
+
call_id: z23.string(),
|
|
4865
|
+
name: z23.string(),
|
|
4866
|
+
arguments: z23.string(),
|
|
4867
|
+
async: z23.boolean().nullish(),
|
|
4868
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
4869
|
+
namespace: z23.string().nullish()
|
|
4536
4870
|
}),
|
|
4537
|
-
|
|
4538
|
-
type:
|
|
4539
|
-
id:
|
|
4540
|
-
call_id:
|
|
4541
|
-
name:
|
|
4542
|
-
input:
|
|
4543
|
-
async:
|
|
4544
|
-
status:
|
|
4871
|
+
z23.object({
|
|
4872
|
+
type: z23.literal("custom_tool_call"),
|
|
4873
|
+
id: z23.string(),
|
|
4874
|
+
call_id: z23.string(),
|
|
4875
|
+
name: z23.string(),
|
|
4876
|
+
input: z23.string(),
|
|
4877
|
+
async: z23.boolean().nullish(),
|
|
4878
|
+
status: z23.enum(["in_progress", "completed", "incomplete"])
|
|
4545
4879
|
}),
|
|
4546
|
-
|
|
4547
|
-
type:
|
|
4548
|
-
id:
|
|
4549
|
-
code:
|
|
4550
|
-
container_id:
|
|
4551
|
-
outputs:
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4880
|
+
z23.object({
|
|
4881
|
+
type: z23.literal("code_interpreter_call"),
|
|
4882
|
+
id: z23.string(),
|
|
4883
|
+
code: z23.string().nullable(),
|
|
4884
|
+
container_id: z23.string(),
|
|
4885
|
+
outputs: z23.array(
|
|
4886
|
+
z23.discriminatedUnion("type", [
|
|
4887
|
+
z23.object({ type: z23.literal("logs"), logs: z23.string() }),
|
|
4888
|
+
z23.object({ type: z23.literal("image"), url: z23.string() })
|
|
4555
4889
|
])
|
|
4556
4890
|
).nullable()
|
|
4557
4891
|
}),
|
|
4558
|
-
|
|
4559
|
-
type:
|
|
4560
|
-
id:
|
|
4561
|
-
result:
|
|
4892
|
+
z23.object({
|
|
4893
|
+
type: z23.literal("image_generation_call"),
|
|
4894
|
+
id: z23.string(),
|
|
4895
|
+
result: z23.string()
|
|
4562
4896
|
}),
|
|
4563
|
-
|
|
4564
|
-
type:
|
|
4565
|
-
id:
|
|
4566
|
-
status:
|
|
4567
|
-
action:
|
|
4568
|
-
|
|
4569
|
-
type:
|
|
4570
|
-
query:
|
|
4571
|
-
queries:
|
|
4572
|
-
sources:
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4897
|
+
z23.object({
|
|
4898
|
+
type: z23.literal("web_search_call"),
|
|
4899
|
+
id: z23.string(),
|
|
4900
|
+
status: z23.string(),
|
|
4901
|
+
action: z23.discriminatedUnion("type", [
|
|
4902
|
+
z23.object({
|
|
4903
|
+
type: z23.literal("search"),
|
|
4904
|
+
query: z23.string().nullish(),
|
|
4905
|
+
queries: z23.array(z23.string()).nullish(),
|
|
4906
|
+
sources: z23.array(
|
|
4907
|
+
z23.discriminatedUnion("type", [
|
|
4908
|
+
z23.object({ type: z23.literal("url"), url: z23.string() }),
|
|
4909
|
+
z23.object({ type: z23.literal("api"), name: z23.string() })
|
|
4576
4910
|
])
|
|
4577
4911
|
).nullish()
|
|
4578
4912
|
}),
|
|
4579
|
-
|
|
4580
|
-
type:
|
|
4581
|
-
url:
|
|
4913
|
+
z23.object({
|
|
4914
|
+
type: z23.literal("open_page"),
|
|
4915
|
+
url: z23.string().nullish()
|
|
4582
4916
|
}),
|
|
4583
|
-
|
|
4584
|
-
type:
|
|
4585
|
-
url:
|
|
4586
|
-
pattern:
|
|
4917
|
+
z23.object({
|
|
4918
|
+
type: z23.literal("find_in_page"),
|
|
4919
|
+
url: z23.string().nullish(),
|
|
4920
|
+
pattern: z23.string().nullish()
|
|
4587
4921
|
})
|
|
4588
4922
|
]).nullish()
|
|
4589
4923
|
}),
|
|
4590
|
-
|
|
4591
|
-
type:
|
|
4592
|
-
id:
|
|
4593
|
-
queries:
|
|
4594
|
-
results:
|
|
4595
|
-
|
|
4596
|
-
attributes:
|
|
4597
|
-
|
|
4598
|
-
|
|
4924
|
+
z23.object({
|
|
4925
|
+
type: z23.literal("file_search_call"),
|
|
4926
|
+
id: z23.string(),
|
|
4927
|
+
queries: z23.array(z23.string()),
|
|
4928
|
+
results: z23.array(
|
|
4929
|
+
z23.object({
|
|
4930
|
+
attributes: z23.record(
|
|
4931
|
+
z23.string(),
|
|
4932
|
+
z23.union([z23.string(), z23.number(), z23.boolean()])
|
|
4599
4933
|
),
|
|
4600
|
-
file_id:
|
|
4601
|
-
filename:
|
|
4602
|
-
score:
|
|
4603
|
-
text:
|
|
4934
|
+
file_id: z23.string(),
|
|
4935
|
+
filename: z23.string(),
|
|
4936
|
+
score: z23.number(),
|
|
4937
|
+
text: z23.string()
|
|
4604
4938
|
})
|
|
4605
4939
|
).nullish()
|
|
4606
4940
|
}),
|
|
4607
4941
|
openaiResponsesLocalShellCallSchema,
|
|
4608
|
-
|
|
4609
|
-
type:
|
|
4610
|
-
id:
|
|
4611
|
-
status:
|
|
4942
|
+
z23.object({
|
|
4943
|
+
type: z23.literal("computer_call"),
|
|
4944
|
+
id: z23.string(),
|
|
4945
|
+
status: z23.literal("completed")
|
|
4612
4946
|
}),
|
|
4613
|
-
|
|
4614
|
-
type:
|
|
4615
|
-
id:
|
|
4616
|
-
status:
|
|
4617
|
-
arguments:
|
|
4618
|
-
name:
|
|
4619
|
-
server_label:
|
|
4620
|
-
output:
|
|
4621
|
-
error:
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
type:
|
|
4625
|
-
code:
|
|
4626
|
-
message:
|
|
4947
|
+
z23.object({
|
|
4948
|
+
type: z23.literal("mcp_call"),
|
|
4949
|
+
id: z23.string(),
|
|
4950
|
+
status: z23.string(),
|
|
4951
|
+
arguments: z23.string(),
|
|
4952
|
+
name: z23.string(),
|
|
4953
|
+
server_label: z23.string(),
|
|
4954
|
+
output: z23.string().nullish(),
|
|
4955
|
+
error: z23.union([
|
|
4956
|
+
z23.string(),
|
|
4957
|
+
z23.object({
|
|
4958
|
+
type: z23.string().optional(),
|
|
4959
|
+
code: z23.union([z23.number(), z23.string()]).optional(),
|
|
4960
|
+
message: z23.string().optional()
|
|
4627
4961
|
}).loose()
|
|
4628
4962
|
]).nullish(),
|
|
4629
|
-
approval_request_id:
|
|
4963
|
+
approval_request_id: z23.string().nullish()
|
|
4630
4964
|
}),
|
|
4631
|
-
|
|
4632
|
-
type:
|
|
4633
|
-
id:
|
|
4634
|
-
server_label:
|
|
4635
|
-
tools:
|
|
4636
|
-
|
|
4637
|
-
name:
|
|
4638
|
-
description:
|
|
4639
|
-
input_schema:
|
|
4640
|
-
annotations:
|
|
4965
|
+
z23.object({
|
|
4966
|
+
type: z23.literal("mcp_list_tools"),
|
|
4967
|
+
id: z23.string(),
|
|
4968
|
+
server_label: z23.string(),
|
|
4969
|
+
tools: z23.array(
|
|
4970
|
+
z23.object({
|
|
4971
|
+
name: z23.string(),
|
|
4972
|
+
description: z23.string().optional(),
|
|
4973
|
+
input_schema: z23.any(),
|
|
4974
|
+
annotations: z23.record(z23.string(), z23.unknown()).optional()
|
|
4641
4975
|
})
|
|
4642
4976
|
),
|
|
4643
|
-
error:
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
type:
|
|
4647
|
-
code:
|
|
4648
|
-
message:
|
|
4977
|
+
error: z23.union([
|
|
4978
|
+
z23.string(),
|
|
4979
|
+
z23.object({
|
|
4980
|
+
type: z23.string().optional(),
|
|
4981
|
+
code: z23.union([z23.number(), z23.string()]).optional(),
|
|
4982
|
+
message: z23.string().optional()
|
|
4649
4983
|
}).loose()
|
|
4650
4984
|
]).optional()
|
|
4651
4985
|
}),
|
|
4652
|
-
|
|
4653
|
-
type:
|
|
4654
|
-
id:
|
|
4655
|
-
server_label:
|
|
4656
|
-
name:
|
|
4657
|
-
arguments:
|
|
4658
|
-
approval_request_id:
|
|
4986
|
+
z23.object({
|
|
4987
|
+
type: z23.literal("mcp_approval_request"),
|
|
4988
|
+
id: z23.string(),
|
|
4989
|
+
server_label: z23.string(),
|
|
4990
|
+
name: z23.string(),
|
|
4991
|
+
arguments: z23.string(),
|
|
4992
|
+
approval_request_id: z23.string().optional()
|
|
4659
4993
|
}),
|
|
4660
|
-
|
|
4661
|
-
type:
|
|
4662
|
-
id:
|
|
4663
|
-
call_id:
|
|
4664
|
-
status:
|
|
4665
|
-
operation:
|
|
4666
|
-
|
|
4667
|
-
type:
|
|
4668
|
-
path:
|
|
4669
|
-
diff:
|
|
4994
|
+
z23.object({
|
|
4995
|
+
type: z23.literal("apply_patch_call"),
|
|
4996
|
+
id: z23.string(),
|
|
4997
|
+
call_id: z23.string(),
|
|
4998
|
+
status: z23.enum(["in_progress", "completed"]),
|
|
4999
|
+
operation: z23.discriminatedUnion("type", [
|
|
5000
|
+
z23.object({
|
|
5001
|
+
type: z23.literal("create_file"),
|
|
5002
|
+
path: z23.string(),
|
|
5003
|
+
diff: z23.string()
|
|
4670
5004
|
}),
|
|
4671
|
-
|
|
4672
|
-
type:
|
|
4673
|
-
path:
|
|
5005
|
+
z23.object({
|
|
5006
|
+
type: z23.literal("delete_file"),
|
|
5007
|
+
path: z23.string()
|
|
4674
5008
|
}),
|
|
4675
|
-
|
|
4676
|
-
type:
|
|
4677
|
-
path:
|
|
4678
|
-
diff:
|
|
5009
|
+
z23.object({
|
|
5010
|
+
type: z23.literal("update_file"),
|
|
5011
|
+
path: z23.string(),
|
|
5012
|
+
diff: z23.string()
|
|
4679
5013
|
})
|
|
4680
5014
|
])
|
|
4681
5015
|
}),
|
|
4682
|
-
|
|
4683
|
-
type:
|
|
4684
|
-
id:
|
|
4685
|
-
call_id:
|
|
4686
|
-
status:
|
|
4687
|
-
action:
|
|
4688
|
-
commands:
|
|
5016
|
+
z23.object({
|
|
5017
|
+
type: z23.literal("shell_call"),
|
|
5018
|
+
id: z23.string(),
|
|
5019
|
+
call_id: z23.string(),
|
|
5020
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
5021
|
+
action: z23.object({
|
|
5022
|
+
commands: z23.array(z23.string())
|
|
4689
5023
|
})
|
|
4690
5024
|
}),
|
|
4691
|
-
|
|
4692
|
-
type:
|
|
4693
|
-
id:
|
|
4694
|
-
call_id:
|
|
4695
|
-
status:
|
|
4696
|
-
output:
|
|
4697
|
-
|
|
4698
|
-
stdout:
|
|
4699
|
-
stderr:
|
|
4700
|
-
outcome:
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
type:
|
|
4704
|
-
exit_code:
|
|
5025
|
+
z23.object({
|
|
5026
|
+
type: z23.literal("shell_call_output"),
|
|
5027
|
+
id: z23.string(),
|
|
5028
|
+
call_id: z23.string(),
|
|
5029
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
5030
|
+
output: z23.array(
|
|
5031
|
+
z23.object({
|
|
5032
|
+
stdout: z23.string(),
|
|
5033
|
+
stderr: z23.string(),
|
|
5034
|
+
outcome: z23.discriminatedUnion("type", [
|
|
5035
|
+
z23.object({ type: z23.literal("timeout") }),
|
|
5036
|
+
z23.object({
|
|
5037
|
+
type: z23.literal("exit"),
|
|
5038
|
+
exit_code: z23.number()
|
|
4705
5039
|
})
|
|
4706
5040
|
])
|
|
4707
5041
|
})
|
|
4708
5042
|
)
|
|
4709
5043
|
}),
|
|
4710
|
-
|
|
4711
|
-
type:
|
|
4712
|
-
id:
|
|
4713
|
-
execution:
|
|
4714
|
-
call_id:
|
|
4715
|
-
status:
|
|
4716
|
-
arguments:
|
|
5044
|
+
z23.object({
|
|
5045
|
+
type: z23.literal("tool_search_call"),
|
|
5046
|
+
id: z23.string(),
|
|
5047
|
+
execution: z23.enum(["server", "client"]),
|
|
5048
|
+
call_id: z23.string().nullable(),
|
|
5049
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
5050
|
+
arguments: z23.unknown()
|
|
4717
5051
|
}),
|
|
4718
|
-
|
|
4719
|
-
type:
|
|
4720
|
-
id:
|
|
4721
|
-
execution:
|
|
4722
|
-
call_id:
|
|
4723
|
-
status:
|
|
4724
|
-
tools:
|
|
5052
|
+
z23.object({
|
|
5053
|
+
type: z23.literal("tool_search_output"),
|
|
5054
|
+
id: z23.string(),
|
|
5055
|
+
execution: z23.enum(["server", "client"]),
|
|
5056
|
+
call_id: z23.string().nullable(),
|
|
5057
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
5058
|
+
tools: z23.array(z23.record(z23.string(), jsonValueSchema2.optional()))
|
|
4725
5059
|
})
|
|
4726
5060
|
])
|
|
4727
5061
|
}),
|
|
4728
|
-
|
|
4729
|
-
type:
|
|
4730
|
-
item_id:
|
|
4731
|
-
output_index:
|
|
4732
|
-
delta:
|
|
5062
|
+
z23.object({
|
|
5063
|
+
type: z23.literal("response.function_call_arguments.delta"),
|
|
5064
|
+
item_id: z23.string(),
|
|
5065
|
+
output_index: z23.number(),
|
|
5066
|
+
delta: z23.string()
|
|
4733
5067
|
}),
|
|
4734
|
-
|
|
5068
|
+
z23.object({
|
|
4735
5069
|
// `name` is documented as required but omitted from live API events:
|
|
4736
5070
|
// https://github.com/openai/openai-openapi/issues/545
|
|
4737
|
-
type:
|
|
4738
|
-
item_id:
|
|
4739
|
-
output_index:
|
|
4740
|
-
arguments:
|
|
5071
|
+
type: z23.literal("response.function_call_arguments.done"),
|
|
5072
|
+
item_id: z23.string(),
|
|
5073
|
+
output_index: z23.number(),
|
|
5074
|
+
arguments: z23.string()
|
|
4741
5075
|
}),
|
|
4742
|
-
|
|
4743
|
-
type:
|
|
4744
|
-
item_id:
|
|
4745
|
-
output_index:
|
|
4746
|
-
delta:
|
|
5076
|
+
z23.object({
|
|
5077
|
+
type: z23.literal("response.custom_tool_call_input.delta"),
|
|
5078
|
+
item_id: z23.string(),
|
|
5079
|
+
output_index: z23.number(),
|
|
5080
|
+
delta: z23.string()
|
|
4747
5081
|
}),
|
|
4748
|
-
|
|
4749
|
-
type:
|
|
4750
|
-
item_id:
|
|
4751
|
-
output_index:
|
|
4752
|
-
partial_image_b64:
|
|
5082
|
+
z23.object({
|
|
5083
|
+
type: z23.literal("response.image_generation_call.partial_image"),
|
|
5084
|
+
item_id: z23.string(),
|
|
5085
|
+
output_index: z23.number(),
|
|
5086
|
+
partial_image_b64: z23.string()
|
|
4753
5087
|
}),
|
|
4754
|
-
|
|
4755
|
-
type:
|
|
4756
|
-
item_id:
|
|
4757
|
-
output_index:
|
|
4758
|
-
delta:
|
|
5088
|
+
z23.object({
|
|
5089
|
+
type: z23.literal("response.code_interpreter_call_code.delta"),
|
|
5090
|
+
item_id: z23.string(),
|
|
5091
|
+
output_index: z23.number(),
|
|
5092
|
+
delta: z23.string()
|
|
4759
5093
|
}),
|
|
4760
|
-
|
|
4761
|
-
type:
|
|
4762
|
-
item_id:
|
|
4763
|
-
output_index:
|
|
4764
|
-
code:
|
|
5094
|
+
z23.object({
|
|
5095
|
+
type: z23.literal("response.code_interpreter_call_code.done"),
|
|
5096
|
+
item_id: z23.string(),
|
|
5097
|
+
output_index: z23.number(),
|
|
5098
|
+
code: z23.string()
|
|
4765
5099
|
}),
|
|
4766
|
-
|
|
4767
|
-
type:
|
|
4768
|
-
annotation:
|
|
4769
|
-
|
|
4770
|
-
type:
|
|
4771
|
-
start_index:
|
|
4772
|
-
end_index:
|
|
4773
|
-
url:
|
|
4774
|
-
title:
|
|
5100
|
+
z23.object({
|
|
5101
|
+
type: z23.literal("response.output_text.annotation.added"),
|
|
5102
|
+
annotation: z23.discriminatedUnion("type", [
|
|
5103
|
+
z23.object({
|
|
5104
|
+
type: z23.literal("url_citation"),
|
|
5105
|
+
start_index: z23.number(),
|
|
5106
|
+
end_index: z23.number(),
|
|
5107
|
+
url: z23.string(),
|
|
5108
|
+
title: z23.string()
|
|
4775
5109
|
}),
|
|
4776
|
-
|
|
4777
|
-
type:
|
|
4778
|
-
file_id:
|
|
4779
|
-
filename:
|
|
4780
|
-
index:
|
|
5110
|
+
z23.object({
|
|
5111
|
+
type: z23.literal("file_citation"),
|
|
5112
|
+
file_id: z23.string(),
|
|
5113
|
+
filename: z23.string(),
|
|
5114
|
+
index: z23.number()
|
|
4781
5115
|
}),
|
|
4782
|
-
|
|
4783
|
-
type:
|
|
4784
|
-
container_id:
|
|
4785
|
-
file_id:
|
|
4786
|
-
filename:
|
|
4787
|
-
start_index:
|
|
4788
|
-
end_index:
|
|
5116
|
+
z23.object({
|
|
5117
|
+
type: z23.literal("container_file_citation"),
|
|
5118
|
+
container_id: z23.string(),
|
|
5119
|
+
file_id: z23.string(),
|
|
5120
|
+
filename: z23.string(),
|
|
5121
|
+
start_index: z23.number(),
|
|
5122
|
+
end_index: z23.number()
|
|
4789
5123
|
}),
|
|
4790
|
-
|
|
4791
|
-
type:
|
|
4792
|
-
file_id:
|
|
4793
|
-
index:
|
|
5124
|
+
z23.object({
|
|
5125
|
+
type: z23.literal("file_path"),
|
|
5126
|
+
file_id: z23.string(),
|
|
5127
|
+
index: z23.number()
|
|
4794
5128
|
})
|
|
4795
5129
|
])
|
|
4796
5130
|
}),
|
|
4797
|
-
|
|
4798
|
-
type:
|
|
4799
|
-
item_id:
|
|
4800
|
-
summary_index:
|
|
4801
|
-
}),
|
|
4802
|
-
z22.object({
|
|
4803
|
-
type: z22.literal("response.reasoning_summary_text.delta"),
|
|
4804
|
-
item_id: z22.string(),
|
|
4805
|
-
summary_index: z22.number(),
|
|
4806
|
-
delta: z22.string()
|
|
4807
|
-
}),
|
|
4808
|
-
z22.object({
|
|
4809
|
-
type: z22.literal("response.reasoning_summary_part.done"),
|
|
4810
|
-
item_id: z22.string(),
|
|
4811
|
-
summary_index: z22.number()
|
|
5131
|
+
z23.object({
|
|
5132
|
+
type: z23.literal("response.reasoning_summary_part.added"),
|
|
5133
|
+
item_id: z23.string(),
|
|
5134
|
+
summary_index: z23.number()
|
|
4812
5135
|
}),
|
|
4813
|
-
|
|
4814
|
-
type:
|
|
4815
|
-
item_id:
|
|
4816
|
-
|
|
4817
|
-
delta:
|
|
4818
|
-
obfuscation: z22.string().nullish()
|
|
5136
|
+
z23.object({
|
|
5137
|
+
type: z23.literal("response.reasoning_summary_text.delta"),
|
|
5138
|
+
item_id: z23.string(),
|
|
5139
|
+
summary_index: z23.number(),
|
|
5140
|
+
delta: z23.string()
|
|
4819
5141
|
}),
|
|
4820
|
-
|
|
4821
|
-
type:
|
|
4822
|
-
item_id:
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
)
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
message:
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
z22.discriminatedUnion("type", [
|
|
4852
|
-
z22.object({
|
|
4853
|
-
type: z22.literal("message"),
|
|
4854
|
-
role: z22.literal("assistant"),
|
|
4855
|
-
id: z22.string(),
|
|
4856
|
-
phase: z22.enum(["commentary", "final_answer"]).nullish(),
|
|
4857
|
-
content: z22.array(
|
|
4858
|
-
z22.object({
|
|
4859
|
-
type: z22.literal("output_text"),
|
|
4860
|
-
text: z22.string(),
|
|
4861
|
-
logprobs: z22.array(
|
|
4862
|
-
z22.object({
|
|
4863
|
-
token: z22.string(),
|
|
4864
|
-
logprob: z22.number(),
|
|
4865
|
-
top_logprobs: z22.array(
|
|
4866
|
-
z22.object({
|
|
4867
|
-
token: z22.string(),
|
|
4868
|
-
logprob: z22.number()
|
|
4869
|
-
})
|
|
4870
|
-
)
|
|
4871
|
-
})
|
|
4872
|
-
).nullish(),
|
|
4873
|
-
annotations: z22.array(
|
|
4874
|
-
z22.discriminatedUnion("type", [
|
|
4875
|
-
z22.object({
|
|
4876
|
-
type: z22.literal("url_citation"),
|
|
4877
|
-
start_index: z22.number(),
|
|
4878
|
-
end_index: z22.number(),
|
|
4879
|
-
url: z22.string(),
|
|
4880
|
-
title: z22.string()
|
|
4881
|
-
}),
|
|
4882
|
-
z22.object({
|
|
4883
|
-
type: z22.literal("file_citation"),
|
|
4884
|
-
file_id: z22.string(),
|
|
4885
|
-
filename: z22.string(),
|
|
4886
|
-
index: z22.number()
|
|
4887
|
-
}),
|
|
4888
|
-
z22.object({
|
|
4889
|
-
type: z22.literal("container_file_citation"),
|
|
4890
|
-
container_id: z22.string(),
|
|
4891
|
-
file_id: z22.string(),
|
|
4892
|
-
filename: z22.string(),
|
|
4893
|
-
start_index: z22.number(),
|
|
4894
|
-
end_index: z22.number()
|
|
4895
|
-
}),
|
|
4896
|
-
z22.object({
|
|
4897
|
-
type: z22.literal("file_path"),
|
|
4898
|
-
file_id: z22.string(),
|
|
4899
|
-
index: z22.number()
|
|
4900
|
-
})
|
|
4901
|
-
])
|
|
4902
|
-
)
|
|
4903
|
-
})
|
|
4904
|
-
)
|
|
4905
|
-
}),
|
|
4906
|
-
z22.object({
|
|
4907
|
-
type: z22.literal("web_search_call"),
|
|
4908
|
-
id: z22.string(),
|
|
4909
|
-
status: z22.string(),
|
|
4910
|
-
action: z22.discriminatedUnion("type", [
|
|
4911
|
-
z22.object({
|
|
4912
|
-
type: z22.literal("search"),
|
|
4913
|
-
query: z22.string().nullish(),
|
|
4914
|
-
queries: z22.array(z22.string()).nullish(),
|
|
4915
|
-
sources: z22.array(
|
|
4916
|
-
z22.discriminatedUnion("type", [
|
|
4917
|
-
z22.object({ type: z22.literal("url"), url: z22.string() }),
|
|
4918
|
-
z22.object({
|
|
4919
|
-
type: z22.literal("api"),
|
|
4920
|
-
name: z22.string()
|
|
4921
|
-
})
|
|
4922
|
-
])
|
|
4923
|
-
).nullish()
|
|
4924
|
-
}),
|
|
4925
|
-
z22.object({
|
|
4926
|
-
type: z22.literal("open_page"),
|
|
4927
|
-
url: z22.string().nullish()
|
|
4928
|
-
}),
|
|
4929
|
-
z22.object({
|
|
4930
|
-
type: z22.literal("find_in_page"),
|
|
4931
|
-
url: z22.string().nullish(),
|
|
4932
|
-
pattern: z22.string().nullish()
|
|
4933
|
-
})
|
|
4934
|
-
]).nullish()
|
|
4935
|
-
}),
|
|
4936
|
-
z22.object({
|
|
4937
|
-
type: z22.literal("file_search_call"),
|
|
4938
|
-
id: z22.string(),
|
|
4939
|
-
queries: z22.array(z22.string()),
|
|
4940
|
-
results: z22.array(
|
|
4941
|
-
z22.object({
|
|
4942
|
-
attributes: z22.record(
|
|
4943
|
-
z22.string(),
|
|
4944
|
-
z22.union([z22.string(), z22.number(), z22.boolean()])
|
|
4945
|
-
),
|
|
4946
|
-
file_id: z22.string(),
|
|
4947
|
-
filename: z22.string(),
|
|
4948
|
-
score: z22.number(),
|
|
4949
|
-
text: z22.string()
|
|
4950
|
-
})
|
|
4951
|
-
).nullish()
|
|
4952
|
-
}),
|
|
4953
|
-
z22.object({
|
|
4954
|
-
type: z22.literal("code_interpreter_call"),
|
|
4955
|
-
id: z22.string(),
|
|
4956
|
-
code: z22.string().nullable(),
|
|
4957
|
-
container_id: z22.string(),
|
|
4958
|
-
outputs: z22.array(
|
|
4959
|
-
z22.discriminatedUnion("type", [
|
|
4960
|
-
z22.object({ type: z22.literal("logs"), logs: z22.string() }),
|
|
4961
|
-
z22.object({ type: z22.literal("image"), url: z22.string() })
|
|
4962
|
-
])
|
|
4963
|
-
).nullable()
|
|
4964
|
-
}),
|
|
4965
|
-
z22.object({
|
|
4966
|
-
type: z22.literal("image_generation_call"),
|
|
4967
|
-
id: z22.string(),
|
|
4968
|
-
result: z22.string()
|
|
4969
|
-
}),
|
|
4970
|
-
openaiResponsesLocalShellCallSchema,
|
|
4971
|
-
z22.object({
|
|
4972
|
-
type: z22.literal("function_call"),
|
|
4973
|
-
call_id: z22.string(),
|
|
4974
|
-
name: z22.string(),
|
|
4975
|
-
arguments: z22.string(),
|
|
4976
|
-
id: z22.string(),
|
|
4977
|
-
async: z22.boolean().nullish(),
|
|
4978
|
-
namespace: z22.string().nullish()
|
|
4979
|
-
}),
|
|
4980
|
-
z22.object({
|
|
4981
|
-
type: z22.literal("custom_tool_call"),
|
|
4982
|
-
call_id: z22.string(),
|
|
4983
|
-
name: z22.string(),
|
|
4984
|
-
input: z22.string(),
|
|
4985
|
-
id: z22.string(),
|
|
4986
|
-
async: z22.boolean().nullish()
|
|
4987
|
-
}),
|
|
4988
|
-
z22.object({
|
|
4989
|
-
type: z22.literal("computer_call"),
|
|
4990
|
-
id: z22.string(),
|
|
4991
|
-
status: z22.string().optional()
|
|
4992
|
-
}),
|
|
4993
|
-
z22.object({
|
|
4994
|
-
type: z22.literal("reasoning"),
|
|
4995
|
-
id: z22.string(),
|
|
4996
|
-
encrypted_content: z22.string().nullish(),
|
|
4997
|
-
summary: z22.array(
|
|
4998
|
-
z22.object({
|
|
4999
|
-
type: z22.literal("summary_text"),
|
|
5000
|
-
text: z22.string()
|
|
5001
|
-
})
|
|
5002
|
-
)
|
|
5003
|
-
}),
|
|
5004
|
-
z22.object({
|
|
5005
|
-
type: z22.literal("mcp_call"),
|
|
5006
|
-
id: z22.string(),
|
|
5007
|
-
status: z22.string(),
|
|
5008
|
-
arguments: z22.string(),
|
|
5009
|
-
name: z22.string(),
|
|
5010
|
-
server_label: z22.string(),
|
|
5011
|
-
output: z22.string().nullish(),
|
|
5012
|
-
error: z22.union([
|
|
5013
|
-
z22.string(),
|
|
5014
|
-
z22.object({
|
|
5015
|
-
type: z22.string().optional(),
|
|
5016
|
-
code: z22.union([z22.number(), z22.string()]).optional(),
|
|
5017
|
-
message: z22.string().optional()
|
|
5018
|
-
}).loose()
|
|
5019
|
-
]).nullish(),
|
|
5020
|
-
approval_request_id: z22.string().nullish()
|
|
5021
|
-
}),
|
|
5022
|
-
z22.object({
|
|
5023
|
-
type: z22.literal("mcp_list_tools"),
|
|
5024
|
-
id: z22.string(),
|
|
5025
|
-
server_label: z22.string(),
|
|
5026
|
-
tools: z22.array(
|
|
5027
|
-
z22.object({
|
|
5028
|
-
name: z22.string(),
|
|
5029
|
-
description: z22.string().optional(),
|
|
5030
|
-
input_schema: z22.any(),
|
|
5031
|
-
annotations: z22.record(z22.string(), z22.unknown()).optional()
|
|
5032
|
-
})
|
|
5033
|
-
),
|
|
5034
|
-
error: z22.union([
|
|
5035
|
-
z22.string(),
|
|
5036
|
-
z22.object({
|
|
5037
|
-
type: z22.string().optional(),
|
|
5038
|
-
code: z22.union([z22.number(), z22.string()]).optional(),
|
|
5039
|
-
message: z22.string().optional()
|
|
5040
|
-
}).loose()
|
|
5041
|
-
]).optional()
|
|
5042
|
-
}),
|
|
5043
|
-
z22.object({
|
|
5044
|
-
type: z22.literal("mcp_approval_request"),
|
|
5045
|
-
id: z22.string(),
|
|
5046
|
-
server_label: z22.string(),
|
|
5047
|
-
name: z22.string(),
|
|
5048
|
-
arguments: z22.string(),
|
|
5049
|
-
approval_request_id: z22.string().optional()
|
|
5050
|
-
}),
|
|
5051
|
-
z22.object({
|
|
5052
|
-
type: z22.literal("apply_patch_call"),
|
|
5053
|
-
id: z22.string(),
|
|
5054
|
-
call_id: z22.string(),
|
|
5055
|
-
status: z22.enum(["in_progress", "completed"]),
|
|
5056
|
-
operation: z22.discriminatedUnion("type", [
|
|
5057
|
-
z22.object({
|
|
5058
|
-
type: z22.literal("create_file"),
|
|
5059
|
-
path: z22.string(),
|
|
5060
|
-
diff: z22.string()
|
|
5061
|
-
}),
|
|
5062
|
-
z22.object({
|
|
5063
|
-
type: z22.literal("delete_file"),
|
|
5064
|
-
path: z22.string()
|
|
5065
|
-
}),
|
|
5066
|
-
z22.object({
|
|
5067
|
-
type: z22.literal("update_file"),
|
|
5068
|
-
path: z22.string(),
|
|
5069
|
-
diff: z22.string()
|
|
5070
|
-
})
|
|
5071
|
-
])
|
|
5072
|
-
}),
|
|
5073
|
-
z22.object({
|
|
5074
|
-
type: z22.literal("shell_call"),
|
|
5075
|
-
id: z22.string(),
|
|
5076
|
-
call_id: z22.string(),
|
|
5077
|
-
status: z22.enum(["in_progress", "completed", "incomplete"]),
|
|
5078
|
-
action: z22.object({
|
|
5079
|
-
commands: z22.array(z22.string())
|
|
5080
|
-
})
|
|
5081
|
-
}),
|
|
5082
|
-
z22.object({
|
|
5083
|
-
type: z22.literal("shell_call_output"),
|
|
5084
|
-
id: z22.string(),
|
|
5085
|
-
call_id: z22.string(),
|
|
5086
|
-
status: z22.enum(["in_progress", "completed", "incomplete"]),
|
|
5087
|
-
output: z22.array(
|
|
5088
|
-
z22.object({
|
|
5089
|
-
stdout: z22.string(),
|
|
5090
|
-
stderr: z22.string(),
|
|
5091
|
-
outcome: z22.discriminatedUnion("type", [
|
|
5092
|
-
z22.object({ type: z22.literal("timeout") }),
|
|
5093
|
-
z22.object({
|
|
5094
|
-
type: z22.literal("exit"),
|
|
5095
|
-
exit_code: z22.number()
|
|
5096
|
-
})
|
|
5097
|
-
])
|
|
5098
|
-
})
|
|
5099
|
-
)
|
|
5100
|
-
}),
|
|
5101
|
-
z22.object({
|
|
5102
|
-
type: z22.literal("tool_search_call"),
|
|
5103
|
-
id: z22.string(),
|
|
5104
|
-
execution: z22.enum(["server", "client"]),
|
|
5105
|
-
call_id: z22.string().nullable(),
|
|
5106
|
-
status: z22.enum(["in_progress", "completed", "incomplete"]),
|
|
5107
|
-
arguments: z22.unknown()
|
|
5108
|
-
}),
|
|
5109
|
-
z22.object({
|
|
5110
|
-
type: z22.literal("tool_search_output"),
|
|
5111
|
-
id: z22.string(),
|
|
5112
|
-
execution: z22.enum(["server", "client"]),
|
|
5113
|
-
call_id: z22.string().nullable(),
|
|
5114
|
-
status: z22.enum(["in_progress", "completed", "incomplete"]),
|
|
5115
|
-
tools: z22.array(z22.record(z22.string(), jsonValueSchema2.optional()))
|
|
5116
|
-
})
|
|
5117
|
-
])
|
|
5118
|
-
).optional(),
|
|
5119
|
-
service_tier: z22.string().nullish(),
|
|
5120
|
-
reasoning: z22.object({
|
|
5121
|
-
context: z22.string().nullish()
|
|
5122
|
-
}).nullish(),
|
|
5123
|
-
incomplete_details: z22.object({ reason: z22.string() }).nullish(),
|
|
5124
|
-
usage: openaiResponsesUsageSchema.nullish()
|
|
5125
|
-
})
|
|
5126
|
-
)
|
|
5127
|
-
);
|
|
5128
|
-
|
|
5129
|
-
// src/responses/openai-responses-options.ts
|
|
5130
|
-
import {
|
|
5131
|
-
lazySchema as lazySchema21,
|
|
5132
|
-
zodSchema as zodSchema21
|
|
5133
|
-
} from "@ai-sdk/provider-utils";
|
|
5134
|
-
import { z as z23 } from "zod/v4";
|
|
5135
|
-
var TOP_LOGPROBS_MAX = 20;
|
|
5136
|
-
var openaiResponsesReasoningModelIds = [
|
|
5137
|
-
"o1",
|
|
5138
|
-
"o1-2024-12-17",
|
|
5139
|
-
"o3",
|
|
5140
|
-
"o3-2025-04-16",
|
|
5141
|
-
"o3-mini",
|
|
5142
|
-
"o3-mini-2025-01-31",
|
|
5143
|
-
"o4-mini",
|
|
5144
|
-
"o4-mini-2025-04-16",
|
|
5145
|
-
"gpt-5",
|
|
5146
|
-
"gpt-5-2025-08-07",
|
|
5147
|
-
"gpt-5-codex",
|
|
5148
|
-
"gpt-5-mini",
|
|
5149
|
-
"gpt-5-mini-2025-08-07",
|
|
5150
|
-
"gpt-5-nano",
|
|
5151
|
-
"gpt-5-nano-2025-08-07",
|
|
5152
|
-
"gpt-5-pro",
|
|
5153
|
-
"gpt-5-pro-2025-10-06",
|
|
5154
|
-
"gpt-5.1",
|
|
5155
|
-
"gpt-5.1-chat-latest",
|
|
5156
|
-
"gpt-5.1-codex-mini",
|
|
5157
|
-
"gpt-5.1-codex",
|
|
5158
|
-
"gpt-5.1-codex-max",
|
|
5159
|
-
"gpt-5.2",
|
|
5160
|
-
"gpt-5.2-chat-latest",
|
|
5161
|
-
"gpt-5.2-pro",
|
|
5162
|
-
"gpt-5.2-codex",
|
|
5163
|
-
"gpt-5.3-chat-latest",
|
|
5164
|
-
"gpt-5.3-codex",
|
|
5165
|
-
"gpt-5.4",
|
|
5166
|
-
"gpt-5.4-2026-03-05",
|
|
5167
|
-
"gpt-5.4-mini",
|
|
5168
|
-
"gpt-5.4-mini-2026-03-17",
|
|
5169
|
-
"gpt-5.4-nano",
|
|
5170
|
-
"gpt-5.4-nano-2026-03-17",
|
|
5171
|
-
"gpt-5.4-pro",
|
|
5172
|
-
"gpt-5.4-pro-2026-03-05",
|
|
5173
|
-
"gpt-5.5",
|
|
5174
|
-
"gpt-5.5-2026-04-23",
|
|
5175
|
-
"gpt-5.6",
|
|
5176
|
-
"gpt-5.6-luna",
|
|
5177
|
-
"gpt-5.6-sol",
|
|
5178
|
-
"gpt-5.6-terra",
|
|
5179
|
-
"gpt-6-astra",
|
|
5180
|
-
"gpt-6-luna",
|
|
5181
|
-
"gpt-6-sol"
|
|
5182
|
-
];
|
|
5183
|
-
var openaiResponsesModelIds = [
|
|
5184
|
-
"gpt-4.1",
|
|
5185
|
-
"gpt-4.1-2025-04-14",
|
|
5186
|
-
"gpt-4.1-mini",
|
|
5187
|
-
"gpt-4.1-mini-2025-04-14",
|
|
5188
|
-
"gpt-4.1-nano",
|
|
5189
|
-
"gpt-4.1-nano-2025-04-14",
|
|
5190
|
-
"gpt-4o",
|
|
5191
|
-
"gpt-4o-2024-05-13",
|
|
5192
|
-
"gpt-4o-2024-08-06",
|
|
5193
|
-
"gpt-4o-2024-11-20",
|
|
5194
|
-
"gpt-4o-audio-preview",
|
|
5195
|
-
"gpt-4o-audio-preview-2024-12-17",
|
|
5196
|
-
"gpt-4o-search-preview",
|
|
5197
|
-
"gpt-4o-search-preview-2025-03-11",
|
|
5198
|
-
"gpt-4o-mini-search-preview",
|
|
5199
|
-
"gpt-4o-mini-search-preview-2025-03-11",
|
|
5200
|
-
"gpt-4o-mini",
|
|
5201
|
-
"gpt-4o-mini-2024-07-18",
|
|
5202
|
-
"gpt-3.5-turbo-0125",
|
|
5203
|
-
"gpt-3.5-turbo",
|
|
5204
|
-
"gpt-3.5-turbo-1106",
|
|
5205
|
-
"gpt-5-chat-latest",
|
|
5206
|
-
...openaiResponsesReasoningModelIds
|
|
5207
|
-
];
|
|
5208
|
-
var openaiLanguageModelResponsesOptionsSchema = lazySchema21(
|
|
5142
|
+
z23.object({
|
|
5143
|
+
type: z23.literal("response.reasoning_summary_part.done"),
|
|
5144
|
+
item_id: z23.string(),
|
|
5145
|
+
summary_index: z23.number()
|
|
5146
|
+
}),
|
|
5147
|
+
z23.object({
|
|
5148
|
+
type: z23.literal("response.apply_patch_call_operation_diff.delta"),
|
|
5149
|
+
item_id: z23.string(),
|
|
5150
|
+
output_index: z23.number(),
|
|
5151
|
+
delta: z23.string(),
|
|
5152
|
+
obfuscation: z23.string().nullish()
|
|
5153
|
+
}),
|
|
5154
|
+
z23.object({
|
|
5155
|
+
type: z23.literal("response.apply_patch_call_operation_diff.done"),
|
|
5156
|
+
item_id: z23.string(),
|
|
5157
|
+
output_index: z23.number(),
|
|
5158
|
+
diff: z23.string()
|
|
5159
|
+
}),
|
|
5160
|
+
openaiResponsesNestedErrorChunkSchema,
|
|
5161
|
+
openaiResponsesErrorChunkSchema,
|
|
5162
|
+
z23.object({ type: z23.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
|
|
5163
|
+
message: "Known response chunk failed schema validation"
|
|
5164
|
+
}).transform((value) => ({
|
|
5165
|
+
type: "unknown_chunk",
|
|
5166
|
+
message: value.type
|
|
5167
|
+
}))
|
|
5168
|
+
// fallback for unknown chunks
|
|
5169
|
+
])
|
|
5170
|
+
)
|
|
5171
|
+
);
|
|
5172
|
+
var openaiResponsesResponseSchema = lazySchema21(
|
|
5209
5173
|
() => zodSchema21(
|
|
5210
5174
|
z23.object({
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5175
|
+
id: z23.string().optional(),
|
|
5176
|
+
created_at: z23.number().optional(),
|
|
5177
|
+
error: z23.object({
|
|
5178
|
+
message: z23.string(),
|
|
5179
|
+
type: z23.string(),
|
|
5180
|
+
param: z23.string().nullish(),
|
|
5181
|
+
code: z23.string()
|
|
5182
|
+
}).nullish(),
|
|
5183
|
+
model: z23.string().optional(),
|
|
5184
|
+
output: z23.array(
|
|
5185
|
+
z23.discriminatedUnion("type", [
|
|
5186
|
+
z23.object({
|
|
5187
|
+
type: z23.literal("message"),
|
|
5188
|
+
role: z23.literal("assistant"),
|
|
5189
|
+
id: z23.string(),
|
|
5190
|
+
phase: z23.enum(["commentary", "final_answer"]).nullish(),
|
|
5191
|
+
content: z23.array(
|
|
5192
|
+
z23.object({
|
|
5193
|
+
type: z23.literal("output_text"),
|
|
5194
|
+
text: z23.string(),
|
|
5195
|
+
logprobs: z23.array(
|
|
5196
|
+
z23.object({
|
|
5197
|
+
token: z23.string(),
|
|
5198
|
+
logprob: z23.number(),
|
|
5199
|
+
top_logprobs: z23.array(
|
|
5200
|
+
z23.object({
|
|
5201
|
+
token: z23.string(),
|
|
5202
|
+
logprob: z23.number()
|
|
5203
|
+
})
|
|
5204
|
+
)
|
|
5205
|
+
})
|
|
5206
|
+
).nullish(),
|
|
5207
|
+
annotations: z23.array(
|
|
5208
|
+
z23.discriminatedUnion("type", [
|
|
5209
|
+
z23.object({
|
|
5210
|
+
type: z23.literal("url_citation"),
|
|
5211
|
+
start_index: z23.number(),
|
|
5212
|
+
end_index: z23.number(),
|
|
5213
|
+
url: z23.string(),
|
|
5214
|
+
title: z23.string()
|
|
5215
|
+
}),
|
|
5216
|
+
z23.object({
|
|
5217
|
+
type: z23.literal("file_citation"),
|
|
5218
|
+
file_id: z23.string(),
|
|
5219
|
+
filename: z23.string(),
|
|
5220
|
+
index: z23.number()
|
|
5221
|
+
}),
|
|
5222
|
+
z23.object({
|
|
5223
|
+
type: z23.literal("container_file_citation"),
|
|
5224
|
+
container_id: z23.string(),
|
|
5225
|
+
file_id: z23.string(),
|
|
5226
|
+
filename: z23.string(),
|
|
5227
|
+
start_index: z23.number(),
|
|
5228
|
+
end_index: z23.number()
|
|
5229
|
+
}),
|
|
5230
|
+
z23.object({
|
|
5231
|
+
type: z23.literal("file_path"),
|
|
5232
|
+
file_id: z23.string(),
|
|
5233
|
+
index: z23.number()
|
|
5234
|
+
})
|
|
5235
|
+
])
|
|
5236
|
+
)
|
|
5237
|
+
})
|
|
5238
|
+
)
|
|
5239
|
+
}),
|
|
5240
|
+
z23.object({
|
|
5241
|
+
type: z23.literal("web_search_call"),
|
|
5242
|
+
id: z23.string(),
|
|
5243
|
+
status: z23.string(),
|
|
5244
|
+
action: z23.discriminatedUnion("type", [
|
|
5245
|
+
z23.object({
|
|
5246
|
+
type: z23.literal("search"),
|
|
5247
|
+
query: z23.string().nullish(),
|
|
5248
|
+
queries: z23.array(z23.string()).nullish(),
|
|
5249
|
+
sources: z23.array(
|
|
5250
|
+
z23.discriminatedUnion("type", [
|
|
5251
|
+
z23.object({ type: z23.literal("url"), url: z23.string() }),
|
|
5252
|
+
z23.object({
|
|
5253
|
+
type: z23.literal("api"),
|
|
5254
|
+
name: z23.string()
|
|
5255
|
+
})
|
|
5256
|
+
])
|
|
5257
|
+
).nullish()
|
|
5258
|
+
}),
|
|
5259
|
+
z23.object({
|
|
5260
|
+
type: z23.literal("open_page"),
|
|
5261
|
+
url: z23.string().nullish()
|
|
5262
|
+
}),
|
|
5263
|
+
z23.object({
|
|
5264
|
+
type: z23.literal("find_in_page"),
|
|
5265
|
+
url: z23.string().nullish(),
|
|
5266
|
+
pattern: z23.string().nullish()
|
|
5267
|
+
})
|
|
5268
|
+
]).nullish()
|
|
5269
|
+
}),
|
|
5270
|
+
z23.object({
|
|
5271
|
+
type: z23.literal("file_search_call"),
|
|
5272
|
+
id: z23.string(),
|
|
5273
|
+
queries: z23.array(z23.string()),
|
|
5274
|
+
results: z23.array(
|
|
5275
|
+
z23.object({
|
|
5276
|
+
attributes: z23.record(
|
|
5277
|
+
z23.string(),
|
|
5278
|
+
z23.union([z23.string(), z23.number(), z23.boolean()])
|
|
5279
|
+
),
|
|
5280
|
+
file_id: z23.string(),
|
|
5281
|
+
filename: z23.string(),
|
|
5282
|
+
score: z23.number(),
|
|
5283
|
+
text: z23.string()
|
|
5284
|
+
})
|
|
5285
|
+
).nullish()
|
|
5286
|
+
}),
|
|
5287
|
+
z23.object({
|
|
5288
|
+
type: z23.literal("code_interpreter_call"),
|
|
5289
|
+
id: z23.string(),
|
|
5290
|
+
code: z23.string().nullable(),
|
|
5291
|
+
container_id: z23.string(),
|
|
5292
|
+
outputs: z23.array(
|
|
5293
|
+
z23.discriminatedUnion("type", [
|
|
5294
|
+
z23.object({ type: z23.literal("logs"), logs: z23.string() }),
|
|
5295
|
+
z23.object({ type: z23.literal("image"), url: z23.string() })
|
|
5296
|
+
])
|
|
5297
|
+
).nullable()
|
|
5298
|
+
}),
|
|
5299
|
+
z23.object({
|
|
5300
|
+
type: z23.literal("image_generation_call"),
|
|
5301
|
+
id: z23.string(),
|
|
5302
|
+
result: z23.string()
|
|
5303
|
+
}),
|
|
5304
|
+
openaiResponsesLocalShellCallSchema,
|
|
5305
|
+
z23.object({
|
|
5306
|
+
type: z23.literal("function_call"),
|
|
5307
|
+
call_id: z23.string(),
|
|
5308
|
+
name: z23.string(),
|
|
5309
|
+
arguments: z23.string(),
|
|
5310
|
+
id: z23.string(),
|
|
5311
|
+
async: z23.boolean().nullish(),
|
|
5312
|
+
namespace: z23.string().nullish()
|
|
5313
|
+
}),
|
|
5314
|
+
z23.object({
|
|
5315
|
+
type: z23.literal("custom_tool_call"),
|
|
5316
|
+
call_id: z23.string(),
|
|
5317
|
+
name: z23.string(),
|
|
5318
|
+
input: z23.string(),
|
|
5319
|
+
id: z23.string(),
|
|
5320
|
+
async: z23.boolean().nullish()
|
|
5321
|
+
}),
|
|
5322
|
+
z23.object({
|
|
5323
|
+
type: z23.literal("computer_call"),
|
|
5324
|
+
id: z23.string(),
|
|
5325
|
+
status: z23.string().optional()
|
|
5326
|
+
}),
|
|
5327
|
+
z23.object({
|
|
5328
|
+
type: z23.literal("reasoning"),
|
|
5329
|
+
id: z23.string(),
|
|
5330
|
+
encrypted_content: z23.string().nullish(),
|
|
5331
|
+
summary: z23.array(
|
|
5332
|
+
z23.object({
|
|
5333
|
+
type: z23.literal("summary_text"),
|
|
5334
|
+
text: z23.string()
|
|
5335
|
+
})
|
|
5336
|
+
)
|
|
5337
|
+
}),
|
|
5338
|
+
z23.object({
|
|
5339
|
+
type: z23.literal("mcp_call"),
|
|
5340
|
+
id: z23.string(),
|
|
5341
|
+
status: z23.string(),
|
|
5342
|
+
arguments: z23.string(),
|
|
5343
|
+
name: z23.string(),
|
|
5344
|
+
server_label: z23.string(),
|
|
5345
|
+
output: z23.string().nullish(),
|
|
5346
|
+
error: z23.union([
|
|
5347
|
+
z23.string(),
|
|
5348
|
+
z23.object({
|
|
5349
|
+
type: z23.string().optional(),
|
|
5350
|
+
code: z23.union([z23.number(), z23.string()]).optional(),
|
|
5351
|
+
message: z23.string().optional()
|
|
5352
|
+
}).loose()
|
|
5353
|
+
]).nullish(),
|
|
5354
|
+
approval_request_id: z23.string().nullish()
|
|
5355
|
+
}),
|
|
5356
|
+
z23.object({
|
|
5357
|
+
type: z23.literal("mcp_list_tools"),
|
|
5358
|
+
id: z23.string(),
|
|
5359
|
+
server_label: z23.string(),
|
|
5360
|
+
tools: z23.array(
|
|
5361
|
+
z23.object({
|
|
5362
|
+
name: z23.string(),
|
|
5363
|
+
description: z23.string().optional(),
|
|
5364
|
+
input_schema: z23.any(),
|
|
5365
|
+
annotations: z23.record(z23.string(), z23.unknown()).optional()
|
|
5366
|
+
})
|
|
5367
|
+
),
|
|
5368
|
+
error: z23.union([
|
|
5369
|
+
z23.string(),
|
|
5370
|
+
z23.object({
|
|
5371
|
+
type: z23.string().optional(),
|
|
5372
|
+
code: z23.union([z23.number(), z23.string()]).optional(),
|
|
5373
|
+
message: z23.string().optional()
|
|
5374
|
+
}).loose()
|
|
5375
|
+
]).optional()
|
|
5376
|
+
}),
|
|
5377
|
+
z23.object({
|
|
5378
|
+
type: z23.literal("mcp_approval_request"),
|
|
5379
|
+
id: z23.string(),
|
|
5380
|
+
server_label: z23.string(),
|
|
5381
|
+
name: z23.string(),
|
|
5382
|
+
arguments: z23.string(),
|
|
5383
|
+
approval_request_id: z23.string().optional()
|
|
5384
|
+
}),
|
|
5385
|
+
z23.object({
|
|
5386
|
+
type: z23.literal("apply_patch_call"),
|
|
5387
|
+
id: z23.string(),
|
|
5388
|
+
call_id: z23.string(),
|
|
5389
|
+
status: z23.enum(["in_progress", "completed"]),
|
|
5390
|
+
operation: z23.discriminatedUnion("type", [
|
|
5391
|
+
z23.object({
|
|
5392
|
+
type: z23.literal("create_file"),
|
|
5393
|
+
path: z23.string(),
|
|
5394
|
+
diff: z23.string()
|
|
5395
|
+
}),
|
|
5396
|
+
z23.object({
|
|
5397
|
+
type: z23.literal("delete_file"),
|
|
5398
|
+
path: z23.string()
|
|
5399
|
+
}),
|
|
5400
|
+
z23.object({
|
|
5401
|
+
type: z23.literal("update_file"),
|
|
5402
|
+
path: z23.string(),
|
|
5403
|
+
diff: z23.string()
|
|
5404
|
+
})
|
|
5405
|
+
])
|
|
5406
|
+
}),
|
|
5407
|
+
z23.object({
|
|
5408
|
+
type: z23.literal("shell_call"),
|
|
5409
|
+
id: z23.string(),
|
|
5410
|
+
call_id: z23.string(),
|
|
5411
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
5412
|
+
action: z23.object({
|
|
5413
|
+
commands: z23.array(z23.string())
|
|
5414
|
+
})
|
|
5415
|
+
}),
|
|
5416
|
+
z23.object({
|
|
5417
|
+
type: z23.literal("shell_call_output"),
|
|
5418
|
+
id: z23.string(),
|
|
5419
|
+
call_id: z23.string(),
|
|
5420
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
5421
|
+
output: z23.array(
|
|
5422
|
+
z23.object({
|
|
5423
|
+
stdout: z23.string(),
|
|
5424
|
+
stderr: z23.string(),
|
|
5425
|
+
outcome: z23.discriminatedUnion("type", [
|
|
5426
|
+
z23.object({ type: z23.literal("timeout") }),
|
|
5427
|
+
z23.object({
|
|
5428
|
+
type: z23.literal("exit"),
|
|
5429
|
+
exit_code: z23.number()
|
|
5430
|
+
})
|
|
5431
|
+
])
|
|
5432
|
+
})
|
|
5433
|
+
)
|
|
5434
|
+
}),
|
|
5435
|
+
z23.object({
|
|
5436
|
+
type: z23.literal("tool_search_call"),
|
|
5437
|
+
id: z23.string(),
|
|
5438
|
+
execution: z23.enum(["server", "client"]),
|
|
5439
|
+
call_id: z23.string().nullable(),
|
|
5440
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
5441
|
+
arguments: z23.unknown()
|
|
5442
|
+
}),
|
|
5443
|
+
z23.object({
|
|
5444
|
+
type: z23.literal("tool_search_output"),
|
|
5445
|
+
id: z23.string(),
|
|
5446
|
+
execution: z23.enum(["server", "client"]),
|
|
5447
|
+
call_id: z23.string().nullable(),
|
|
5448
|
+
status: z23.enum(["in_progress", "completed", "incomplete"]),
|
|
5449
|
+
tools: z23.array(z23.record(z23.string(), jsonValueSchema2.optional()))
|
|
5450
|
+
})
|
|
5230
5451
|
])
|
|
5231
|
-
).
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
/**
|
|
5239
|
-
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
5240
|
-
* the response size and can slow down response times. However, it can
|
|
5241
|
-
* be useful to better understand how the model is behaving.
|
|
5242
|
-
*
|
|
5243
|
-
* Setting to true will return the log probabilities of the tokens that
|
|
5244
|
-
* were generated.
|
|
5245
|
-
*
|
|
5246
|
-
* Setting to a number will return the log probabilities of the top n
|
|
5247
|
-
* tokens that were generated.
|
|
5248
|
-
*
|
|
5249
|
-
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
5250
|
-
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
5251
|
-
*/
|
|
5252
|
-
logprobs: z23.union([z23.boolean(), z23.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
5253
|
-
/**
|
|
5254
|
-
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
5255
|
-
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
5256
|
-
* Any further attempts to call a tool by the model will be ignored.
|
|
5257
|
-
*/
|
|
5258
|
-
maxToolCalls: z23.number().nullish(),
|
|
5259
|
-
/**
|
|
5260
|
-
* Additional metadata to store with the generation.
|
|
5261
|
-
*/
|
|
5262
|
-
metadata: z23.any().nullish(),
|
|
5263
|
-
/**
|
|
5264
|
-
* Whether to use parallel tool calls. Defaults to `true`.
|
|
5265
|
-
*/
|
|
5266
|
-
parallelToolCalls: z23.boolean().nullish(),
|
|
5267
|
-
/**
|
|
5268
|
-
* The ID of the previous response. You can use it to continue a conversation.
|
|
5269
|
-
* Defaults to `undefined`.
|
|
5270
|
-
*/
|
|
5271
|
-
previousResponseId: z23.string().nullish(),
|
|
5272
|
-
/**
|
|
5273
|
-
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
5274
|
-
*/
|
|
5275
|
-
promptCacheKey: z23.string().nullish(),
|
|
5276
|
-
/**
|
|
5277
|
-
* Prompt cache behavior for GPT-5.6 and later models.
|
|
5278
|
-
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
5279
|
-
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
5280
|
-
*/
|
|
5281
|
-
promptCacheOptions: z23.object({
|
|
5282
|
-
mode: z23.enum(["implicit", "explicit"]).optional(),
|
|
5283
|
-
ttl: z23.literal("30m").optional()
|
|
5284
|
-
}).optional(),
|
|
5285
|
-
/**
|
|
5286
|
-
* The retention policy for the prompt cache.
|
|
5287
|
-
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
5288
|
-
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
5289
|
-
* Available for models before GPT-5.6 that support extended caching.
|
|
5290
|
-
*
|
|
5291
|
-
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
5292
|
-
*
|
|
5293
|
-
* @default 'in_memory'
|
|
5294
|
-
*/
|
|
5295
|
-
promptCacheRetention: z23.enum(["in_memory", "24h"]).nullish(),
|
|
5296
|
-
/**
|
|
5297
|
-
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
5298
|
-
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
5299
|
-
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
5300
|
-
* GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
5301
|
-
* Supported values vary by model.
|
|
5302
|
-
*/
|
|
5303
|
-
reasoningEffort: z23.string().nullish(),
|
|
5304
|
-
/**
|
|
5305
|
-
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
5306
|
-
* without changing the request-level reasoning effort. This preserves the
|
|
5307
|
-
* request prefix for prompt caching.
|
|
5308
|
-
*
|
|
5309
|
-
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
5310
|
-
* combined with automatic truncation.
|
|
5311
|
-
*/
|
|
5312
|
-
reasoningEffortUpdate: z23.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
5313
|
-
/**
|
|
5314
|
-
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
5315
|
-
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
5316
|
-
*/
|
|
5317
|
-
reasoningMode: z23.enum(["standard", "pro"]).optional(),
|
|
5318
|
-
/**
|
|
5319
|
-
* Controls which available reasoning items GPT-5.6 can use.
|
|
5320
|
-
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
5321
|
-
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
5322
|
-
*/
|
|
5323
|
-
reasoningContext: z23.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
5324
|
-
/**
|
|
5325
|
-
* Controls reasoning summary output from the model.
|
|
5326
|
-
* Set to "auto" to automatically receive the richest level available,
|
|
5327
|
-
* or "detailed" for comprehensive summaries.
|
|
5328
|
-
*/
|
|
5329
|
-
reasoningSummary: z23.string().nullish(),
|
|
5330
|
-
/**
|
|
5331
|
-
* The identifier for safety monitoring and tracking.
|
|
5332
|
-
*/
|
|
5333
|
-
safetyIdentifier: z23.string().nullish(),
|
|
5334
|
-
/**
|
|
5335
|
-
* Service tier for the request.
|
|
5336
|
-
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
5337
|
-
* Set to 'priority' for faster processing with Enterprise access (available for gpt-4, gpt-5, gpt-5-mini, o3, o4-mini; gpt-5-nano is not supported).
|
|
5338
|
-
* Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
|
|
5339
|
-
*
|
|
5340
|
-
* Defaults to 'auto'.
|
|
5341
|
-
*/
|
|
5342
|
-
serviceTier: z23.enum(["auto", "flex", "priority", "fast", "default"]).nullish(),
|
|
5343
|
-
/**
|
|
5344
|
-
* Whether to store the generation. Defaults to `true`.
|
|
5345
|
-
*/
|
|
5346
|
-
store: z23.boolean().nullish(),
|
|
5347
|
-
/**
|
|
5348
|
-
* Whether to pass through non-image file types as generic input files.
|
|
5349
|
-
*
|
|
5350
|
-
* By default, inline file inputs are restricted to images and PDFs.
|
|
5351
|
-
* Enable this when the target OpenAI Responses model supports additional
|
|
5352
|
-
* file media types, such as text/csv.
|
|
5353
|
-
*/
|
|
5354
|
-
passThroughUnsupportedFiles: z23.boolean().optional(),
|
|
5355
|
-
/**
|
|
5356
|
-
* Whether to use strict JSON schema validation.
|
|
5357
|
-
* Defaults to `true`.
|
|
5358
|
-
*/
|
|
5359
|
-
strictJsonSchema: z23.boolean().nullish(),
|
|
5360
|
-
/**
|
|
5361
|
-
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
5362
|
-
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
5363
|
-
* Valid values: 'low', 'medium', 'high'.
|
|
5364
|
-
*/
|
|
5365
|
-
textVerbosity: z23.enum(["low", "medium", "high"]).nullish(),
|
|
5366
|
-
/**
|
|
5367
|
-
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
5368
|
-
* 'disabled' turns truncation off.
|
|
5369
|
-
*/
|
|
5370
|
-
truncation: z23.enum(["auto", "disabled"]).nullish(),
|
|
5371
|
-
/**
|
|
5372
|
-
* A unique identifier representing your end-user, which can help OpenAI to
|
|
5373
|
-
* monitor and detect abuse.
|
|
5374
|
-
* Defaults to `undefined`.
|
|
5375
|
-
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
5376
|
-
*/
|
|
5377
|
-
user: z23.string().nullish(),
|
|
5378
|
-
/**
|
|
5379
|
-
* Override the system message mode for this model.
|
|
5380
|
-
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
5381
|
-
* - 'developer': Use the 'developer' role for system messages (used by reasoning models)
|
|
5382
|
-
* - 'remove': Remove system messages entirely
|
|
5383
|
-
*
|
|
5384
|
-
* If not specified, the mode is automatically determined based on the model.
|
|
5385
|
-
*/
|
|
5386
|
-
systemMessageMode: z23.enum(["system", "developer", "remove"]).optional(),
|
|
5387
|
-
/**
|
|
5388
|
-
* Force treating this model as a reasoning model.
|
|
5389
|
-
*
|
|
5390
|
-
* This is useful for "stealth" reasoning models (e.g. via a custom baseURL)
|
|
5391
|
-
* where the model ID is not recognized by the SDK's allowlist.
|
|
5392
|
-
*
|
|
5393
|
-
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
5394
|
-
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
5395
|
-
*/
|
|
5396
|
-
forceReasoning: z23.boolean().optional(),
|
|
5397
|
-
/**
|
|
5398
|
-
* Restrict the callable tools to a subset while keeping the full tools
|
|
5399
|
-
* list intact, so prompt caching is preserved across requests with
|
|
5400
|
-
* different allowlists.
|
|
5401
|
-
*
|
|
5402
|
-
* When set, this overrides the request-level `toolChoice` and emits
|
|
5403
|
-
* `tool_choice: { type: "allowed_tools", mode, tools }` on the wire.
|
|
5404
|
-
*
|
|
5405
|
-
* @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
|
|
5406
|
-
*/
|
|
5407
|
-
allowedTools: z23.object({
|
|
5408
|
-
toolNames: z23.array(z23.string()).min(1),
|
|
5409
|
-
mode: z23.enum(["auto", "required"]).optional()
|
|
5410
|
-
}).optional()
|
|
5452
|
+
).optional(),
|
|
5453
|
+
service_tier: z23.string().nullish(),
|
|
5454
|
+
reasoning: z23.object({
|
|
5455
|
+
context: z23.string().nullish()
|
|
5456
|
+
}).nullish(),
|
|
5457
|
+
incomplete_details: z23.object({ reason: z23.string() }).nullish(),
|
|
5458
|
+
usage: openaiResponsesUsageSchema.nullish()
|
|
5411
5459
|
})
|
|
5412
5460
|
)
|
|
5413
5461
|
);
|
|
@@ -5912,6 +5960,18 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
|
5912
5960
|
}
|
|
5913
5961
|
return mapping;
|
|
5914
5962
|
}
|
|
5963
|
+
function getConfigurationUpdateUnsupportedReason({
|
|
5964
|
+
modelCapabilities,
|
|
5965
|
+
options
|
|
5966
|
+
}) {
|
|
5967
|
+
if (!modelCapabilities.supportsConfigurationUpdate) {
|
|
5968
|
+
return "reasoningEffortUpdate is only supported by GPT-6 and later models";
|
|
5969
|
+
}
|
|
5970
|
+
if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
|
|
5971
|
+
return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
|
|
5972
|
+
}
|
|
5973
|
+
return void 0;
|
|
5974
|
+
}
|
|
5915
5975
|
var OpenAIResponsesLanguageModel = class {
|
|
5916
5976
|
constructor(modelId, config) {
|
|
5917
5977
|
this.specificationVersion = "v3";
|
|
@@ -6019,8 +6079,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6019
6079
|
customProviderToolNames,
|
|
6020
6080
|
supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
|
|
6021
6081
|
});
|
|
6082
|
+
const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
|
|
6083
|
+
modelCapabilities,
|
|
6084
|
+
options: openaiOptions
|
|
6085
|
+
});
|
|
6022
6086
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
6023
6087
|
prompt,
|
|
6088
|
+
configurationUpdateUnsupportedReason,
|
|
6024
6089
|
toolNameMapping,
|
|
6025
6090
|
systemMessageMode: (_c = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
|
|
6026
6091
|
providerOptionsName,
|
|
@@ -6038,18 +6103,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6038
6103
|
});
|
|
6039
6104
|
warnings.push(...inputWarnings);
|
|
6040
6105
|
const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
|
|
6041
|
-
|
|
6042
|
-
if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
|
|
6106
|
+
if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
|
|
6043
6107
|
warnings.push({
|
|
6044
6108
|
type: "unsupported",
|
|
6045
6109
|
feature: "reasoningEffortUpdate",
|
|
6046
|
-
details:
|
|
6110
|
+
details: configurationUpdateUnsupportedReason
|
|
6047
6111
|
});
|
|
6048
6112
|
} else if (reasoningEffortUpdate != null) {
|
|
6049
|
-
input
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6113
|
+
const firstItem = input[0];
|
|
6114
|
+
if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
|
|
6115
|
+
input.unshift({
|
|
6116
|
+
type: "configuration_update",
|
|
6117
|
+
reasoning: { effort: reasoningEffortUpdate }
|
|
6118
|
+
});
|
|
6119
|
+
}
|
|
6120
|
+
}
|
|
6121
|
+
for (let i = 1; i < input.length; i++) {
|
|
6122
|
+
if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
|
|
6123
|
+
throw new UnsupportedFunctionalityError6({
|
|
6124
|
+
functionality: "Adjacent reasoning effort configuration updates"
|
|
6125
|
+
});
|
|
6126
|
+
}
|
|
6053
6127
|
}
|
|
6054
6128
|
const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
|
|
6055
6129
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
@@ -6996,7 +7070,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6996
7070
|
};
|
|
6997
7071
|
} else if (value.item.type === "shell_call_output") {
|
|
6998
7072
|
} else if (value.item.type === "message") {
|
|
6999
|
-
ongoingAnnotations.splice(0
|
|
7073
|
+
ongoingAnnotations.splice(0);
|
|
7000
7074
|
activeMessagePhase = (_b2 = value.item.phase) != null ? _b2 : void 0;
|
|
7001
7075
|
controller.enqueue({
|
|
7002
7076
|
type: "text-start",
|
|
@@ -8256,7 +8330,7 @@ var OpenAITranscriptionModel = class {
|
|
|
8256
8330
|
};
|
|
8257
8331
|
|
|
8258
8332
|
// src/version.ts
|
|
8259
|
-
var VERSION = true ? "3.0.
|
|
8333
|
+
var VERSION = true ? "3.0.118" : "0.0.0-test";
|
|
8260
8334
|
|
|
8261
8335
|
// src/openai-provider.ts
|
|
8262
8336
|
function createOpenAI(options = {}) {
|