@ai-sdk/openai 2.0.132 → 2.0.134
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 +15 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +76 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +77 -9
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +570 -503
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +568 -500
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/internal/index.mjs
CHANGED
|
@@ -2350,9 +2350,10 @@ import {
|
|
|
2350
2350
|
import {
|
|
2351
2351
|
convertToBase64 as convertToBase642,
|
|
2352
2352
|
parseProviderOptions as parseProviderOptions7,
|
|
2353
|
+
safeValidateTypes,
|
|
2353
2354
|
validateTypes
|
|
2354
2355
|
} from "@ai-sdk/provider-utils";
|
|
2355
|
-
import { z as
|
|
2356
|
+
import { z as z16 } from "zod/v4";
|
|
2356
2357
|
|
|
2357
2358
|
// src/responses/openai-responses-options.ts
|
|
2358
2359
|
import {
|
|
@@ -2590,7 +2591,119 @@ var localShell = createProviderDefinedToolFactoryWithOutputSchema({
|
|
|
2590
2591
|
outputSchema: localShellOutputSchema
|
|
2591
2592
|
});
|
|
2592
2593
|
|
|
2594
|
+
// src/tool/web-search.ts
|
|
2595
|
+
import {
|
|
2596
|
+
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
|
|
2597
|
+
lazySchema as lazySchema2,
|
|
2598
|
+
zodSchema as zodSchema14
|
|
2599
|
+
} from "@ai-sdk/provider-utils";
|
|
2600
|
+
import { z as z15 } from "zod/v4";
|
|
2601
|
+
var webSearchArgsSchema = lazySchema2(
|
|
2602
|
+
() => zodSchema14(
|
|
2603
|
+
z15.object({
|
|
2604
|
+
externalWebAccess: z15.boolean().optional(),
|
|
2605
|
+
filters: z15.object({
|
|
2606
|
+
allowedDomains: z15.array(z15.string()).optional(),
|
|
2607
|
+
blockedDomains: z15.array(z15.string()).optional()
|
|
2608
|
+
}).optional(),
|
|
2609
|
+
searchContextSize: z15.enum(["low", "medium", "high"]).optional(),
|
|
2610
|
+
userLocation: z15.object({
|
|
2611
|
+
type: z15.literal("approximate"),
|
|
2612
|
+
country: z15.string().optional(),
|
|
2613
|
+
city: z15.string().optional(),
|
|
2614
|
+
region: z15.string().optional(),
|
|
2615
|
+
timezone: z15.string().optional()
|
|
2616
|
+
}).optional()
|
|
2617
|
+
})
|
|
2618
|
+
)
|
|
2619
|
+
);
|
|
2620
|
+
var webSearchInputSchema = lazySchema2(() => zodSchema14(z15.object({})));
|
|
2621
|
+
var webSearchOutputSchema = lazySchema2(
|
|
2622
|
+
() => zodSchema14(
|
|
2623
|
+
z15.object({
|
|
2624
|
+
action: z15.discriminatedUnion("type", [
|
|
2625
|
+
z15.object({
|
|
2626
|
+
type: z15.literal("search"),
|
|
2627
|
+
query: z15.string().optional()
|
|
2628
|
+
}),
|
|
2629
|
+
z15.object({
|
|
2630
|
+
type: z15.literal("openPage"),
|
|
2631
|
+
url: z15.string().nullish()
|
|
2632
|
+
}),
|
|
2633
|
+
z15.object({
|
|
2634
|
+
type: z15.literal("findInPage"),
|
|
2635
|
+
url: z15.string().nullish(),
|
|
2636
|
+
pattern: z15.string().nullish()
|
|
2637
|
+
})
|
|
2638
|
+
]).optional(),
|
|
2639
|
+
sources: z15.array(
|
|
2640
|
+
z15.discriminatedUnion("type", [
|
|
2641
|
+
z15.object({ type: z15.literal("url"), url: z15.string() }),
|
|
2642
|
+
z15.object({ type: z15.literal("api"), name: z15.string() })
|
|
2643
|
+
])
|
|
2644
|
+
).optional()
|
|
2645
|
+
})
|
|
2646
|
+
)
|
|
2647
|
+
);
|
|
2648
|
+
var webSearchToolFactory = createProviderDefinedToolFactoryWithOutputSchema2({
|
|
2649
|
+
id: "openai.web_search",
|
|
2650
|
+
name: "web_search",
|
|
2651
|
+
inputSchema: webSearchInputSchema,
|
|
2652
|
+
outputSchema: webSearchOutputSchema
|
|
2653
|
+
});
|
|
2654
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2655
|
+
|
|
2593
2656
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2657
|
+
async function convertWebSearchToolResultOutput({
|
|
2658
|
+
output,
|
|
2659
|
+
id
|
|
2660
|
+
}) {
|
|
2661
|
+
if (output.type !== "json") {
|
|
2662
|
+
return void 0;
|
|
2663
|
+
}
|
|
2664
|
+
const validation = await safeValidateTypes({
|
|
2665
|
+
value: output.value,
|
|
2666
|
+
schema: webSearchOutputSchema
|
|
2667
|
+
});
|
|
2668
|
+
if (!validation.success || validation.value.action == null) {
|
|
2669
|
+
return void 0;
|
|
2670
|
+
}
|
|
2671
|
+
const { action, sources } = validation.value;
|
|
2672
|
+
switch (action.type) {
|
|
2673
|
+
case "search":
|
|
2674
|
+
return {
|
|
2675
|
+
type: "web_search_call",
|
|
2676
|
+
id,
|
|
2677
|
+
status: "completed",
|
|
2678
|
+
action: {
|
|
2679
|
+
type: "search",
|
|
2680
|
+
...action.query != null && { query: action.query },
|
|
2681
|
+
...sources != null && { sources }
|
|
2682
|
+
}
|
|
2683
|
+
};
|
|
2684
|
+
case "openPage":
|
|
2685
|
+
return {
|
|
2686
|
+
type: "web_search_call",
|
|
2687
|
+
id,
|
|
2688
|
+
status: "completed",
|
|
2689
|
+
action: {
|
|
2690
|
+
type: "open_page",
|
|
2691
|
+
url: action.url
|
|
2692
|
+
}
|
|
2693
|
+
};
|
|
2694
|
+
case "findInPage":
|
|
2695
|
+
return {
|
|
2696
|
+
type: "web_search_call",
|
|
2697
|
+
id,
|
|
2698
|
+
status: "completed",
|
|
2699
|
+
action: {
|
|
2700
|
+
type: "find_in_page",
|
|
2701
|
+
url: action.url,
|
|
2702
|
+
pattern: action.pattern
|
|
2703
|
+
}
|
|
2704
|
+
};
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2594
2707
|
function getPromptCacheBreakpoint2(providerOptions) {
|
|
2595
2708
|
var _a2;
|
|
2596
2709
|
return (_a2 = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a2.promptCacheBreakpoint;
|
|
@@ -2607,9 +2720,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2607
2720
|
fileIdPrefixes,
|
|
2608
2721
|
store,
|
|
2609
2722
|
configurationUpdateUnsupportedReason,
|
|
2610
|
-
hasLocalShellTool = false
|
|
2723
|
+
hasLocalShellTool = false,
|
|
2724
|
+
webSearchToolName
|
|
2611
2725
|
}) {
|
|
2612
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
2726
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2613
2727
|
let input = [];
|
|
2614
2728
|
const warnings = [];
|
|
2615
2729
|
for (const { role, content, providerOptions } of prompt) {
|
|
@@ -2819,6 +2933,21 @@ async function convertToOpenAIResponsesInput({
|
|
|
2819
2933
|
}
|
|
2820
2934
|
// assistant tool result parts are from provider-executed tools:
|
|
2821
2935
|
case "tool-result": {
|
|
2936
|
+
if (part.toolName === "web_search" || part.toolName === "web_search_preview" || part.toolName === webSearchToolName) {
|
|
2937
|
+
const itemId = (_k = (_j = (_i = part.providerOptions) == null ? void 0 : _i[providerOptionsName]) == null ? void 0 : _j.itemId) != null ? _k : part.toolCallId;
|
|
2938
|
+
if (store) {
|
|
2939
|
+
input.push({ type: "item_reference", id: itemId });
|
|
2940
|
+
break;
|
|
2941
|
+
}
|
|
2942
|
+
const webSearchCall = await convertWebSearchToolResultOutput({
|
|
2943
|
+
output: part.output,
|
|
2944
|
+
id: itemId
|
|
2945
|
+
});
|
|
2946
|
+
if (webSearchCall != null) {
|
|
2947
|
+
input.push(webSearchCall);
|
|
2948
|
+
break;
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2822
2951
|
if (store) {
|
|
2823
2952
|
input.push({ type: "item_reference", id: part.toolCallId });
|
|
2824
2953
|
} else {
|
|
@@ -2987,9 +3116,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2987
3116
|
}
|
|
2988
3117
|
return { input, warnings };
|
|
2989
3118
|
}
|
|
2990
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2991
|
-
itemId:
|
|
2992
|
-
reasoningEncryptedContent:
|
|
3119
|
+
var openaiResponsesReasoningProviderOptionsSchema = z16.object({
|
|
3120
|
+
itemId: z16.string().nullish(),
|
|
3121
|
+
reasoningEncryptedContent: z16.string().nullish()
|
|
2993
3122
|
});
|
|
2994
3123
|
|
|
2995
3124
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3013,289 +3142,289 @@ function mapOpenAIResponseFinishReason({
|
|
|
3013
3142
|
// src/responses/openai-responses-api.ts
|
|
3014
3143
|
import {
|
|
3015
3144
|
lazyValidator as lazyValidator13,
|
|
3016
|
-
zodSchema as
|
|
3145
|
+
zodSchema as zodSchema15
|
|
3017
3146
|
} from "@ai-sdk/provider-utils";
|
|
3018
|
-
import { z as
|
|
3147
|
+
import { z as z17 } from "zod/v4";
|
|
3019
3148
|
var openaiResponsesChunkSchema = lazyValidator13(
|
|
3020
|
-
() =>
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
type:
|
|
3024
|
-
item_id:
|
|
3025
|
-
delta:
|
|
3026
|
-
logprobs:
|
|
3027
|
-
|
|
3028
|
-
token:
|
|
3029
|
-
logprob:
|
|
3030
|
-
top_logprobs:
|
|
3031
|
-
|
|
3032
|
-
token:
|
|
3033
|
-
logprob:
|
|
3149
|
+
() => zodSchema15(
|
|
3150
|
+
z17.union([
|
|
3151
|
+
z17.object({
|
|
3152
|
+
type: z17.literal("response.output_text.delta"),
|
|
3153
|
+
item_id: z17.string(),
|
|
3154
|
+
delta: z17.string(),
|
|
3155
|
+
logprobs: z17.array(
|
|
3156
|
+
z17.object({
|
|
3157
|
+
token: z17.string(),
|
|
3158
|
+
logprob: z17.number(),
|
|
3159
|
+
top_logprobs: z17.array(
|
|
3160
|
+
z17.object({
|
|
3161
|
+
token: z17.string(),
|
|
3162
|
+
logprob: z17.number()
|
|
3034
3163
|
})
|
|
3035
3164
|
)
|
|
3036
3165
|
})
|
|
3037
3166
|
).nullish()
|
|
3038
3167
|
}),
|
|
3039
|
-
|
|
3040
|
-
type:
|
|
3041
|
-
response:
|
|
3042
|
-
incomplete_details:
|
|
3043
|
-
usage:
|
|
3044
|
-
input_tokens:
|
|
3045
|
-
input_tokens_details:
|
|
3046
|
-
cached_tokens:
|
|
3047
|
-
cache_write_tokens:
|
|
3048
|
-
orchestration_input_tokens:
|
|
3049
|
-
orchestration_input_cached_tokens:
|
|
3168
|
+
z17.object({
|
|
3169
|
+
type: z17.enum(["response.completed", "response.incomplete"]),
|
|
3170
|
+
response: z17.object({
|
|
3171
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
3172
|
+
usage: z17.object({
|
|
3173
|
+
input_tokens: z17.number(),
|
|
3174
|
+
input_tokens_details: z17.object({
|
|
3175
|
+
cached_tokens: z17.number().nullish(),
|
|
3176
|
+
cache_write_tokens: z17.number().nullish(),
|
|
3177
|
+
orchestration_input_tokens: z17.number().nullish(),
|
|
3178
|
+
orchestration_input_cached_tokens: z17.number().nullish()
|
|
3050
3179
|
}).nullish(),
|
|
3051
|
-
output_tokens:
|
|
3052
|
-
output_tokens_details:
|
|
3053
|
-
reasoning_tokens:
|
|
3054
|
-
orchestration_output_tokens:
|
|
3180
|
+
output_tokens: z17.number(),
|
|
3181
|
+
output_tokens_details: z17.object({
|
|
3182
|
+
reasoning_tokens: z17.number().nullish(),
|
|
3183
|
+
orchestration_output_tokens: z17.number().nullish()
|
|
3055
3184
|
}).nullish()
|
|
3056
3185
|
}),
|
|
3057
|
-
reasoning:
|
|
3058
|
-
context:
|
|
3186
|
+
reasoning: z17.object({
|
|
3187
|
+
context: z17.string().nullish()
|
|
3059
3188
|
}).nullish(),
|
|
3060
|
-
service_tier:
|
|
3189
|
+
service_tier: z17.string().nullish()
|
|
3061
3190
|
})
|
|
3062
3191
|
}),
|
|
3063
|
-
|
|
3064
|
-
type:
|
|
3065
|
-
response:
|
|
3066
|
-
id:
|
|
3067
|
-
created_at:
|
|
3068
|
-
model:
|
|
3069
|
-
service_tier:
|
|
3192
|
+
z17.object({
|
|
3193
|
+
type: z17.literal("response.created"),
|
|
3194
|
+
response: z17.object({
|
|
3195
|
+
id: z17.string(),
|
|
3196
|
+
created_at: z17.number(),
|
|
3197
|
+
model: z17.string(),
|
|
3198
|
+
service_tier: z17.string().nullish()
|
|
3070
3199
|
})
|
|
3071
3200
|
}),
|
|
3072
|
-
|
|
3073
|
-
type:
|
|
3074
|
-
output_index:
|
|
3075
|
-
item:
|
|
3076
|
-
|
|
3077
|
-
type:
|
|
3078
|
-
id:
|
|
3079
|
-
phase:
|
|
3201
|
+
z17.object({
|
|
3202
|
+
type: z17.literal("response.output_item.added"),
|
|
3203
|
+
output_index: z17.number(),
|
|
3204
|
+
item: z17.discriminatedUnion("type", [
|
|
3205
|
+
z17.object({
|
|
3206
|
+
type: z17.literal("message"),
|
|
3207
|
+
id: z17.string(),
|
|
3208
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish()
|
|
3080
3209
|
}),
|
|
3081
|
-
|
|
3082
|
-
type:
|
|
3083
|
-
id:
|
|
3084
|
-
encrypted_content:
|
|
3210
|
+
z17.object({
|
|
3211
|
+
type: z17.literal("reasoning"),
|
|
3212
|
+
id: z17.string(),
|
|
3213
|
+
encrypted_content: z17.string().nullish()
|
|
3085
3214
|
}),
|
|
3086
|
-
|
|
3087
|
-
type:
|
|
3088
|
-
id:
|
|
3089
|
-
call_id:
|
|
3090
|
-
name:
|
|
3091
|
-
arguments:
|
|
3092
|
-
async:
|
|
3215
|
+
z17.object({
|
|
3216
|
+
type: z17.literal("function_call"),
|
|
3217
|
+
id: z17.string(),
|
|
3218
|
+
call_id: z17.string(),
|
|
3219
|
+
name: z17.string(),
|
|
3220
|
+
arguments: z17.string(),
|
|
3221
|
+
async: z17.boolean().nullish()
|
|
3093
3222
|
}),
|
|
3094
|
-
|
|
3095
|
-
type:
|
|
3096
|
-
id:
|
|
3097
|
-
status:
|
|
3223
|
+
z17.object({
|
|
3224
|
+
type: z17.literal("web_search_call"),
|
|
3225
|
+
id: z17.string(),
|
|
3226
|
+
status: z17.string()
|
|
3098
3227
|
}),
|
|
3099
|
-
|
|
3100
|
-
type:
|
|
3101
|
-
id:
|
|
3102
|
-
status:
|
|
3228
|
+
z17.object({
|
|
3229
|
+
type: z17.literal("computer_call"),
|
|
3230
|
+
id: z17.string(),
|
|
3231
|
+
status: z17.string()
|
|
3103
3232
|
}),
|
|
3104
|
-
|
|
3105
|
-
type:
|
|
3106
|
-
id:
|
|
3233
|
+
z17.object({
|
|
3234
|
+
type: z17.literal("file_search_call"),
|
|
3235
|
+
id: z17.string()
|
|
3107
3236
|
}),
|
|
3108
|
-
|
|
3109
|
-
type:
|
|
3110
|
-
id:
|
|
3237
|
+
z17.object({
|
|
3238
|
+
type: z17.literal("image_generation_call"),
|
|
3239
|
+
id: z17.string()
|
|
3111
3240
|
}),
|
|
3112
|
-
|
|
3113
|
-
type:
|
|
3114
|
-
id:
|
|
3115
|
-
container_id:
|
|
3116
|
-
code:
|
|
3117
|
-
outputs:
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3241
|
+
z17.object({
|
|
3242
|
+
type: z17.literal("code_interpreter_call"),
|
|
3243
|
+
id: z17.string(),
|
|
3244
|
+
container_id: z17.string(),
|
|
3245
|
+
code: z17.string().nullable(),
|
|
3246
|
+
outputs: z17.array(
|
|
3247
|
+
z17.discriminatedUnion("type", [
|
|
3248
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3249
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3121
3250
|
])
|
|
3122
3251
|
).nullable(),
|
|
3123
|
-
status:
|
|
3252
|
+
status: z17.string()
|
|
3124
3253
|
})
|
|
3125
3254
|
])
|
|
3126
3255
|
}),
|
|
3127
|
-
|
|
3128
|
-
type:
|
|
3129
|
-
output_index:
|
|
3130
|
-
item:
|
|
3131
|
-
|
|
3132
|
-
type:
|
|
3133
|
-
id:
|
|
3134
|
-
phase:
|
|
3256
|
+
z17.object({
|
|
3257
|
+
type: z17.literal("response.output_item.done"),
|
|
3258
|
+
output_index: z17.number(),
|
|
3259
|
+
item: z17.discriminatedUnion("type", [
|
|
3260
|
+
z17.object({
|
|
3261
|
+
type: z17.literal("message"),
|
|
3262
|
+
id: z17.string(),
|
|
3263
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish()
|
|
3135
3264
|
}),
|
|
3136
|
-
|
|
3137
|
-
type:
|
|
3138
|
-
id:
|
|
3139
|
-
encrypted_content:
|
|
3265
|
+
z17.object({
|
|
3266
|
+
type: z17.literal("reasoning"),
|
|
3267
|
+
id: z17.string(),
|
|
3268
|
+
encrypted_content: z17.string().nullish()
|
|
3140
3269
|
}),
|
|
3141
|
-
|
|
3142
|
-
type:
|
|
3143
|
-
id:
|
|
3144
|
-
call_id:
|
|
3145
|
-
name:
|
|
3146
|
-
arguments:
|
|
3147
|
-
async:
|
|
3148
|
-
status:
|
|
3270
|
+
z17.object({
|
|
3271
|
+
type: z17.literal("function_call"),
|
|
3272
|
+
id: z17.string(),
|
|
3273
|
+
call_id: z17.string(),
|
|
3274
|
+
name: z17.string(),
|
|
3275
|
+
arguments: z17.string(),
|
|
3276
|
+
async: z17.boolean().nullish(),
|
|
3277
|
+
status: z17.enum(["in_progress", "completed", "incomplete"])
|
|
3149
3278
|
}),
|
|
3150
|
-
|
|
3151
|
-
type:
|
|
3152
|
-
id:
|
|
3153
|
-
code:
|
|
3154
|
-
container_id:
|
|
3155
|
-
outputs:
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3279
|
+
z17.object({
|
|
3280
|
+
type: z17.literal("code_interpreter_call"),
|
|
3281
|
+
id: z17.string(),
|
|
3282
|
+
code: z17.string().nullable(),
|
|
3283
|
+
container_id: z17.string(),
|
|
3284
|
+
outputs: z17.array(
|
|
3285
|
+
z17.discriminatedUnion("type", [
|
|
3286
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3287
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3159
3288
|
])
|
|
3160
3289
|
).nullable()
|
|
3161
3290
|
}),
|
|
3162
|
-
|
|
3163
|
-
type:
|
|
3164
|
-
id:
|
|
3165
|
-
result:
|
|
3291
|
+
z17.object({
|
|
3292
|
+
type: z17.literal("image_generation_call"),
|
|
3293
|
+
id: z17.string(),
|
|
3294
|
+
result: z17.string()
|
|
3166
3295
|
}),
|
|
3167
|
-
|
|
3168
|
-
type:
|
|
3169
|
-
id:
|
|
3170
|
-
status:
|
|
3171
|
-
action:
|
|
3172
|
-
|
|
3173
|
-
type:
|
|
3174
|
-
query:
|
|
3175
|
-
sources:
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3296
|
+
z17.object({
|
|
3297
|
+
type: z17.literal("web_search_call"),
|
|
3298
|
+
id: z17.string(),
|
|
3299
|
+
status: z17.string(),
|
|
3300
|
+
action: z17.discriminatedUnion("type", [
|
|
3301
|
+
z17.object({
|
|
3302
|
+
type: z17.literal("search"),
|
|
3303
|
+
query: z17.string().nullish(),
|
|
3304
|
+
sources: z17.array(
|
|
3305
|
+
z17.discriminatedUnion("type", [
|
|
3306
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
3307
|
+
z17.object({ type: z17.literal("api"), name: z17.string() })
|
|
3179
3308
|
])
|
|
3180
3309
|
).nullish()
|
|
3181
3310
|
}),
|
|
3182
|
-
|
|
3183
|
-
type:
|
|
3184
|
-
url:
|
|
3311
|
+
z17.object({
|
|
3312
|
+
type: z17.literal("open_page"),
|
|
3313
|
+
url: z17.string().nullish()
|
|
3185
3314
|
}),
|
|
3186
|
-
|
|
3187
|
-
type:
|
|
3188
|
-
url:
|
|
3189
|
-
pattern:
|
|
3315
|
+
z17.object({
|
|
3316
|
+
type: z17.literal("find_in_page"),
|
|
3317
|
+
url: z17.string().nullish(),
|
|
3318
|
+
pattern: z17.string().nullish()
|
|
3190
3319
|
})
|
|
3191
3320
|
]).nullish()
|
|
3192
3321
|
}),
|
|
3193
|
-
|
|
3194
|
-
type:
|
|
3195
|
-
id:
|
|
3196
|
-
queries:
|
|
3197
|
-
results:
|
|
3198
|
-
|
|
3199
|
-
attributes:
|
|
3200
|
-
file_id:
|
|
3201
|
-
filename:
|
|
3202
|
-
score:
|
|
3203
|
-
text:
|
|
3322
|
+
z17.object({
|
|
3323
|
+
type: z17.literal("file_search_call"),
|
|
3324
|
+
id: z17.string(),
|
|
3325
|
+
queries: z17.array(z17.string()),
|
|
3326
|
+
results: z17.array(
|
|
3327
|
+
z17.object({
|
|
3328
|
+
attributes: z17.record(z17.string(), z17.unknown()),
|
|
3329
|
+
file_id: z17.string(),
|
|
3330
|
+
filename: z17.string(),
|
|
3331
|
+
score: z17.number(),
|
|
3332
|
+
text: z17.string()
|
|
3204
3333
|
})
|
|
3205
3334
|
).nullish()
|
|
3206
3335
|
}),
|
|
3207
|
-
|
|
3208
|
-
type:
|
|
3209
|
-
id:
|
|
3210
|
-
call_id:
|
|
3211
|
-
action:
|
|
3212
|
-
type:
|
|
3213
|
-
command:
|
|
3214
|
-
timeout_ms:
|
|
3215
|
-
user:
|
|
3216
|
-
working_directory:
|
|
3217
|
-
env:
|
|
3336
|
+
z17.object({
|
|
3337
|
+
type: z17.literal("local_shell_call"),
|
|
3338
|
+
id: z17.string(),
|
|
3339
|
+
call_id: z17.string(),
|
|
3340
|
+
action: z17.object({
|
|
3341
|
+
type: z17.literal("exec"),
|
|
3342
|
+
command: z17.array(z17.string()),
|
|
3343
|
+
timeout_ms: z17.number().optional(),
|
|
3344
|
+
user: z17.string().optional(),
|
|
3345
|
+
working_directory: z17.string().optional(),
|
|
3346
|
+
env: z17.record(z17.string(), z17.string()).optional()
|
|
3218
3347
|
})
|
|
3219
3348
|
}),
|
|
3220
|
-
|
|
3221
|
-
type:
|
|
3222
|
-
id:
|
|
3223
|
-
status:
|
|
3349
|
+
z17.object({
|
|
3350
|
+
type: z17.literal("computer_call"),
|
|
3351
|
+
id: z17.string(),
|
|
3352
|
+
status: z17.literal("completed")
|
|
3224
3353
|
})
|
|
3225
3354
|
])
|
|
3226
3355
|
}),
|
|
3227
|
-
|
|
3228
|
-
type:
|
|
3229
|
-
item_id:
|
|
3230
|
-
output_index:
|
|
3231
|
-
delta:
|
|
3356
|
+
z17.object({
|
|
3357
|
+
type: z17.literal("response.function_call_arguments.delta"),
|
|
3358
|
+
item_id: z17.string(),
|
|
3359
|
+
output_index: z17.number(),
|
|
3360
|
+
delta: z17.string()
|
|
3232
3361
|
}),
|
|
3233
|
-
|
|
3234
|
-
type:
|
|
3235
|
-
item_id:
|
|
3236
|
-
output_index:
|
|
3237
|
-
partial_image_b64:
|
|
3362
|
+
z17.object({
|
|
3363
|
+
type: z17.literal("response.image_generation_call.partial_image"),
|
|
3364
|
+
item_id: z17.string(),
|
|
3365
|
+
output_index: z17.number(),
|
|
3366
|
+
partial_image_b64: z17.string()
|
|
3238
3367
|
}),
|
|
3239
|
-
|
|
3240
|
-
type:
|
|
3241
|
-
item_id:
|
|
3242
|
-
output_index:
|
|
3243
|
-
delta:
|
|
3368
|
+
z17.object({
|
|
3369
|
+
type: z17.literal("response.code_interpreter_call_code.delta"),
|
|
3370
|
+
item_id: z17.string(),
|
|
3371
|
+
output_index: z17.number(),
|
|
3372
|
+
delta: z17.string()
|
|
3244
3373
|
}),
|
|
3245
|
-
|
|
3246
|
-
type:
|
|
3247
|
-
item_id:
|
|
3248
|
-
output_index:
|
|
3249
|
-
code:
|
|
3374
|
+
z17.object({
|
|
3375
|
+
type: z17.literal("response.code_interpreter_call_code.done"),
|
|
3376
|
+
item_id: z17.string(),
|
|
3377
|
+
output_index: z17.number(),
|
|
3378
|
+
code: z17.string()
|
|
3250
3379
|
}),
|
|
3251
|
-
|
|
3252
|
-
type:
|
|
3253
|
-
annotation:
|
|
3254
|
-
|
|
3255
|
-
type:
|
|
3256
|
-
start_index:
|
|
3257
|
-
end_index:
|
|
3258
|
-
url:
|
|
3259
|
-
title:
|
|
3380
|
+
z17.object({
|
|
3381
|
+
type: z17.literal("response.output_text.annotation.added"),
|
|
3382
|
+
annotation: z17.discriminatedUnion("type", [
|
|
3383
|
+
z17.object({
|
|
3384
|
+
type: z17.literal("url_citation"),
|
|
3385
|
+
start_index: z17.number(),
|
|
3386
|
+
end_index: z17.number(),
|
|
3387
|
+
url: z17.string(),
|
|
3388
|
+
title: z17.string()
|
|
3260
3389
|
}),
|
|
3261
|
-
|
|
3262
|
-
type:
|
|
3263
|
-
file_id:
|
|
3264
|
-
filename:
|
|
3265
|
-
index:
|
|
3266
|
-
start_index:
|
|
3267
|
-
end_index:
|
|
3268
|
-
quote:
|
|
3390
|
+
z17.object({
|
|
3391
|
+
type: z17.literal("file_citation"),
|
|
3392
|
+
file_id: z17.string(),
|
|
3393
|
+
filename: z17.string().nullish(),
|
|
3394
|
+
index: z17.number().nullish(),
|
|
3395
|
+
start_index: z17.number().nullish(),
|
|
3396
|
+
end_index: z17.number().nullish(),
|
|
3397
|
+
quote: z17.string().nullish()
|
|
3269
3398
|
})
|
|
3270
3399
|
])
|
|
3271
3400
|
}),
|
|
3272
|
-
|
|
3273
|
-
type:
|
|
3274
|
-
item_id:
|
|
3275
|
-
summary_index:
|
|
3401
|
+
z17.object({
|
|
3402
|
+
type: z17.literal("response.reasoning_summary_part.added"),
|
|
3403
|
+
item_id: z17.string(),
|
|
3404
|
+
summary_index: z17.number()
|
|
3276
3405
|
}),
|
|
3277
|
-
|
|
3278
|
-
type:
|
|
3279
|
-
item_id:
|
|
3280
|
-
summary_index:
|
|
3281
|
-
delta:
|
|
3406
|
+
z17.object({
|
|
3407
|
+
type: z17.literal("response.reasoning_summary_text.delta"),
|
|
3408
|
+
item_id: z17.string(),
|
|
3409
|
+
summary_index: z17.number(),
|
|
3410
|
+
delta: z17.string()
|
|
3282
3411
|
}),
|
|
3283
|
-
|
|
3284
|
-
type:
|
|
3285
|
-
item_id:
|
|
3286
|
-
summary_index:
|
|
3412
|
+
z17.object({
|
|
3413
|
+
type: z17.literal("response.reasoning_summary_part.done"),
|
|
3414
|
+
item_id: z17.string(),
|
|
3415
|
+
summary_index: z17.number()
|
|
3287
3416
|
}),
|
|
3288
|
-
|
|
3289
|
-
type:
|
|
3290
|
-
sequence_number:
|
|
3291
|
-
error:
|
|
3292
|
-
type:
|
|
3293
|
-
code:
|
|
3294
|
-
message:
|
|
3295
|
-
param:
|
|
3417
|
+
z17.object({
|
|
3418
|
+
type: z17.literal("error"),
|
|
3419
|
+
sequence_number: z17.number(),
|
|
3420
|
+
error: z17.object({
|
|
3421
|
+
type: z17.string(),
|
|
3422
|
+
code: z17.string(),
|
|
3423
|
+
message: z17.string(),
|
|
3424
|
+
param: z17.string().nullish()
|
|
3296
3425
|
})
|
|
3297
3426
|
}),
|
|
3298
|
-
|
|
3427
|
+
z17.object({ type: z17.string() }).loose().transform((value) => ({
|
|
3299
3428
|
type: "unknown_chunk",
|
|
3300
3429
|
message: value.type
|
|
3301
3430
|
}))
|
|
@@ -3304,196 +3433,196 @@ var openaiResponsesChunkSchema = lazyValidator13(
|
|
|
3304
3433
|
)
|
|
3305
3434
|
);
|
|
3306
3435
|
var openaiResponsesResponseSchema = lazyValidator13(
|
|
3307
|
-
() =>
|
|
3308
|
-
|
|
3309
|
-
id:
|
|
3310
|
-
created_at:
|
|
3311
|
-
error:
|
|
3312
|
-
message:
|
|
3313
|
-
type:
|
|
3314
|
-
param:
|
|
3315
|
-
code:
|
|
3436
|
+
() => zodSchema15(
|
|
3437
|
+
z17.object({
|
|
3438
|
+
id: z17.string().optional(),
|
|
3439
|
+
created_at: z17.number().optional(),
|
|
3440
|
+
error: z17.object({
|
|
3441
|
+
message: z17.string(),
|
|
3442
|
+
type: z17.string(),
|
|
3443
|
+
param: z17.string().nullish(),
|
|
3444
|
+
code: z17.string()
|
|
3316
3445
|
}).nullish(),
|
|
3317
|
-
model:
|
|
3318
|
-
output:
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
type:
|
|
3322
|
-
role:
|
|
3323
|
-
id:
|
|
3324
|
-
phase:
|
|
3325
|
-
content:
|
|
3326
|
-
|
|
3327
|
-
type:
|
|
3328
|
-
text:
|
|
3329
|
-
logprobs:
|
|
3330
|
-
|
|
3331
|
-
token:
|
|
3332
|
-
logprob:
|
|
3333
|
-
top_logprobs:
|
|
3334
|
-
|
|
3335
|
-
token:
|
|
3336
|
-
logprob:
|
|
3446
|
+
model: z17.string().optional(),
|
|
3447
|
+
output: z17.array(
|
|
3448
|
+
z17.discriminatedUnion("type", [
|
|
3449
|
+
z17.object({
|
|
3450
|
+
type: z17.literal("message"),
|
|
3451
|
+
role: z17.literal("assistant"),
|
|
3452
|
+
id: z17.string(),
|
|
3453
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish(),
|
|
3454
|
+
content: z17.array(
|
|
3455
|
+
z17.object({
|
|
3456
|
+
type: z17.literal("output_text"),
|
|
3457
|
+
text: z17.string(),
|
|
3458
|
+
logprobs: z17.array(
|
|
3459
|
+
z17.object({
|
|
3460
|
+
token: z17.string(),
|
|
3461
|
+
logprob: z17.number(),
|
|
3462
|
+
top_logprobs: z17.array(
|
|
3463
|
+
z17.object({
|
|
3464
|
+
token: z17.string(),
|
|
3465
|
+
logprob: z17.number()
|
|
3337
3466
|
})
|
|
3338
3467
|
)
|
|
3339
3468
|
})
|
|
3340
3469
|
).nullish(),
|
|
3341
|
-
annotations:
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
type:
|
|
3345
|
-
start_index:
|
|
3346
|
-
end_index:
|
|
3347
|
-
url:
|
|
3348
|
-
title:
|
|
3470
|
+
annotations: z17.array(
|
|
3471
|
+
z17.discriminatedUnion("type", [
|
|
3472
|
+
z17.object({
|
|
3473
|
+
type: z17.literal("url_citation"),
|
|
3474
|
+
start_index: z17.number(),
|
|
3475
|
+
end_index: z17.number(),
|
|
3476
|
+
url: z17.string(),
|
|
3477
|
+
title: z17.string()
|
|
3349
3478
|
}),
|
|
3350
|
-
|
|
3351
|
-
type:
|
|
3352
|
-
file_id:
|
|
3353
|
-
filename:
|
|
3354
|
-
index:
|
|
3355
|
-
start_index:
|
|
3356
|
-
end_index:
|
|
3357
|
-
quote:
|
|
3479
|
+
z17.object({
|
|
3480
|
+
type: z17.literal("file_citation"),
|
|
3481
|
+
file_id: z17.string(),
|
|
3482
|
+
filename: z17.string().nullish(),
|
|
3483
|
+
index: z17.number().nullish(),
|
|
3484
|
+
start_index: z17.number().nullish(),
|
|
3485
|
+
end_index: z17.number().nullish(),
|
|
3486
|
+
quote: z17.string().nullish()
|
|
3358
3487
|
}),
|
|
3359
|
-
|
|
3360
|
-
type:
|
|
3361
|
-
container_id:
|
|
3362
|
-
file_id:
|
|
3363
|
-
filename:
|
|
3364
|
-
start_index:
|
|
3365
|
-
end_index:
|
|
3366
|
-
index:
|
|
3488
|
+
z17.object({
|
|
3489
|
+
type: z17.literal("container_file_citation"),
|
|
3490
|
+
container_id: z17.string(),
|
|
3491
|
+
file_id: z17.string(),
|
|
3492
|
+
filename: z17.string().nullish(),
|
|
3493
|
+
start_index: z17.number().nullish(),
|
|
3494
|
+
end_index: z17.number().nullish(),
|
|
3495
|
+
index: z17.number().nullish()
|
|
3367
3496
|
}),
|
|
3368
|
-
|
|
3369
|
-
type:
|
|
3370
|
-
file_id:
|
|
3371
|
-
index:
|
|
3497
|
+
z17.object({
|
|
3498
|
+
type: z17.literal("file_path"),
|
|
3499
|
+
file_id: z17.string(),
|
|
3500
|
+
index: z17.number().nullish()
|
|
3372
3501
|
})
|
|
3373
3502
|
])
|
|
3374
3503
|
)
|
|
3375
3504
|
})
|
|
3376
3505
|
)
|
|
3377
3506
|
}),
|
|
3378
|
-
|
|
3379
|
-
type:
|
|
3380
|
-
id:
|
|
3381
|
-
status:
|
|
3382
|
-
action:
|
|
3383
|
-
|
|
3384
|
-
type:
|
|
3385
|
-
query:
|
|
3386
|
-
sources:
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
type:
|
|
3391
|
-
name:
|
|
3507
|
+
z17.object({
|
|
3508
|
+
type: z17.literal("web_search_call"),
|
|
3509
|
+
id: z17.string(),
|
|
3510
|
+
status: z17.string(),
|
|
3511
|
+
action: z17.discriminatedUnion("type", [
|
|
3512
|
+
z17.object({
|
|
3513
|
+
type: z17.literal("search"),
|
|
3514
|
+
query: z17.string().nullish(),
|
|
3515
|
+
sources: z17.array(
|
|
3516
|
+
z17.discriminatedUnion("type", [
|
|
3517
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
3518
|
+
z17.object({
|
|
3519
|
+
type: z17.literal("api"),
|
|
3520
|
+
name: z17.string()
|
|
3392
3521
|
})
|
|
3393
3522
|
])
|
|
3394
3523
|
).nullish()
|
|
3395
3524
|
}),
|
|
3396
|
-
|
|
3397
|
-
type:
|
|
3398
|
-
url:
|
|
3525
|
+
z17.object({
|
|
3526
|
+
type: z17.literal("open_page"),
|
|
3527
|
+
url: z17.string().nullish()
|
|
3399
3528
|
}),
|
|
3400
|
-
|
|
3401
|
-
type:
|
|
3402
|
-
url:
|
|
3403
|
-
pattern:
|
|
3529
|
+
z17.object({
|
|
3530
|
+
type: z17.literal("find_in_page"),
|
|
3531
|
+
url: z17.string().nullish(),
|
|
3532
|
+
pattern: z17.string().nullish()
|
|
3404
3533
|
})
|
|
3405
3534
|
]).nullish()
|
|
3406
3535
|
}),
|
|
3407
|
-
|
|
3408
|
-
type:
|
|
3409
|
-
id:
|
|
3410
|
-
queries:
|
|
3411
|
-
results:
|
|
3412
|
-
|
|
3413
|
-
attributes:
|
|
3414
|
-
|
|
3415
|
-
|
|
3536
|
+
z17.object({
|
|
3537
|
+
type: z17.literal("file_search_call"),
|
|
3538
|
+
id: z17.string(),
|
|
3539
|
+
queries: z17.array(z17.string()),
|
|
3540
|
+
results: z17.array(
|
|
3541
|
+
z17.object({
|
|
3542
|
+
attributes: z17.record(
|
|
3543
|
+
z17.string(),
|
|
3544
|
+
z17.union([z17.string(), z17.number(), z17.boolean()])
|
|
3416
3545
|
),
|
|
3417
|
-
file_id:
|
|
3418
|
-
filename:
|
|
3419
|
-
score:
|
|
3420
|
-
text:
|
|
3546
|
+
file_id: z17.string(),
|
|
3547
|
+
filename: z17.string(),
|
|
3548
|
+
score: z17.number(),
|
|
3549
|
+
text: z17.string()
|
|
3421
3550
|
})
|
|
3422
3551
|
).nullish()
|
|
3423
3552
|
}),
|
|
3424
|
-
|
|
3425
|
-
type:
|
|
3426
|
-
id:
|
|
3427
|
-
code:
|
|
3428
|
-
container_id:
|
|
3429
|
-
outputs:
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3553
|
+
z17.object({
|
|
3554
|
+
type: z17.literal("code_interpreter_call"),
|
|
3555
|
+
id: z17.string(),
|
|
3556
|
+
code: z17.string().nullable(),
|
|
3557
|
+
container_id: z17.string(),
|
|
3558
|
+
outputs: z17.array(
|
|
3559
|
+
z17.discriminatedUnion("type", [
|
|
3560
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3561
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3433
3562
|
])
|
|
3434
3563
|
).nullable()
|
|
3435
3564
|
}),
|
|
3436
|
-
|
|
3437
|
-
type:
|
|
3438
|
-
id:
|
|
3439
|
-
result:
|
|
3565
|
+
z17.object({
|
|
3566
|
+
type: z17.literal("image_generation_call"),
|
|
3567
|
+
id: z17.string(),
|
|
3568
|
+
result: z17.string()
|
|
3440
3569
|
}),
|
|
3441
|
-
|
|
3442
|
-
type:
|
|
3443
|
-
id:
|
|
3444
|
-
call_id:
|
|
3445
|
-
action:
|
|
3446
|
-
type:
|
|
3447
|
-
command:
|
|
3448
|
-
timeout_ms:
|
|
3449
|
-
user:
|
|
3450
|
-
working_directory:
|
|
3451
|
-
env:
|
|
3570
|
+
z17.object({
|
|
3571
|
+
type: z17.literal("local_shell_call"),
|
|
3572
|
+
id: z17.string(),
|
|
3573
|
+
call_id: z17.string(),
|
|
3574
|
+
action: z17.object({
|
|
3575
|
+
type: z17.literal("exec"),
|
|
3576
|
+
command: z17.array(z17.string()),
|
|
3577
|
+
timeout_ms: z17.number().optional(),
|
|
3578
|
+
user: z17.string().optional(),
|
|
3579
|
+
working_directory: z17.string().optional(),
|
|
3580
|
+
env: z17.record(z17.string(), z17.string()).optional()
|
|
3452
3581
|
})
|
|
3453
3582
|
}),
|
|
3454
|
-
|
|
3455
|
-
type:
|
|
3456
|
-
call_id:
|
|
3457
|
-
name:
|
|
3458
|
-
arguments:
|
|
3459
|
-
id:
|
|
3460
|
-
async:
|
|
3583
|
+
z17.object({
|
|
3584
|
+
type: z17.literal("function_call"),
|
|
3585
|
+
call_id: z17.string(),
|
|
3586
|
+
name: z17.string(),
|
|
3587
|
+
arguments: z17.string(),
|
|
3588
|
+
id: z17.string(),
|
|
3589
|
+
async: z17.boolean().nullish()
|
|
3461
3590
|
}),
|
|
3462
|
-
|
|
3463
|
-
type:
|
|
3464
|
-
id:
|
|
3465
|
-
status:
|
|
3591
|
+
z17.object({
|
|
3592
|
+
type: z17.literal("computer_call"),
|
|
3593
|
+
id: z17.string(),
|
|
3594
|
+
status: z17.string().optional()
|
|
3466
3595
|
}),
|
|
3467
|
-
|
|
3468
|
-
type:
|
|
3469
|
-
id:
|
|
3470
|
-
encrypted_content:
|
|
3471
|
-
summary:
|
|
3472
|
-
|
|
3473
|
-
type:
|
|
3474
|
-
text:
|
|
3596
|
+
z17.object({
|
|
3597
|
+
type: z17.literal("reasoning"),
|
|
3598
|
+
id: z17.string(),
|
|
3599
|
+
encrypted_content: z17.string().nullish(),
|
|
3600
|
+
summary: z17.array(
|
|
3601
|
+
z17.object({
|
|
3602
|
+
type: z17.literal("summary_text"),
|
|
3603
|
+
text: z17.string()
|
|
3475
3604
|
})
|
|
3476
3605
|
)
|
|
3477
3606
|
})
|
|
3478
3607
|
])
|
|
3479
3608
|
).optional(),
|
|
3480
|
-
service_tier:
|
|
3481
|
-
reasoning:
|
|
3482
|
-
context:
|
|
3609
|
+
service_tier: z17.string().nullish(),
|
|
3610
|
+
reasoning: z17.object({
|
|
3611
|
+
context: z17.string().nullish()
|
|
3483
3612
|
}).nullish(),
|
|
3484
|
-
incomplete_details:
|
|
3485
|
-
usage:
|
|
3486
|
-
input_tokens:
|
|
3487
|
-
input_tokens_details:
|
|
3488
|
-
cached_tokens:
|
|
3489
|
-
cache_write_tokens:
|
|
3490
|
-
orchestration_input_tokens:
|
|
3491
|
-
orchestration_input_cached_tokens:
|
|
3613
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
3614
|
+
usage: z17.object({
|
|
3615
|
+
input_tokens: z17.number(),
|
|
3616
|
+
input_tokens_details: z17.object({
|
|
3617
|
+
cached_tokens: z17.number().nullish(),
|
|
3618
|
+
cache_write_tokens: z17.number().nullish(),
|
|
3619
|
+
orchestration_input_tokens: z17.number().nullish(),
|
|
3620
|
+
orchestration_input_cached_tokens: z17.number().nullish()
|
|
3492
3621
|
}).nullish(),
|
|
3493
|
-
output_tokens:
|
|
3494
|
-
output_tokens_details:
|
|
3495
|
-
reasoning_tokens:
|
|
3496
|
-
orchestration_output_tokens:
|
|
3622
|
+
output_tokens: z17.number(),
|
|
3623
|
+
output_tokens_details: z17.object({
|
|
3624
|
+
reasoning_tokens: z17.number().nullish(),
|
|
3625
|
+
orchestration_output_tokens: z17.number().nullish()
|
|
3497
3626
|
}).nullish()
|
|
3498
3627
|
}).optional()
|
|
3499
3628
|
})
|
|
@@ -3507,44 +3636,44 @@ import {
|
|
|
3507
3636
|
|
|
3508
3637
|
// src/tool/code-interpreter.ts
|
|
3509
3638
|
import {
|
|
3510
|
-
createProviderDefinedToolFactoryWithOutputSchema as
|
|
3511
|
-
lazySchema as
|
|
3512
|
-
zodSchema as
|
|
3639
|
+
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
|
|
3640
|
+
lazySchema as lazySchema3,
|
|
3641
|
+
zodSchema as zodSchema16
|
|
3513
3642
|
} from "@ai-sdk/provider-utils";
|
|
3514
|
-
import { z as
|
|
3515
|
-
var codeInterpreterInputSchema =
|
|
3516
|
-
() =>
|
|
3517
|
-
|
|
3518
|
-
code:
|
|
3519
|
-
containerId:
|
|
3643
|
+
import { z as z18 } from "zod/v4";
|
|
3644
|
+
var codeInterpreterInputSchema = lazySchema3(
|
|
3645
|
+
() => zodSchema16(
|
|
3646
|
+
z18.object({
|
|
3647
|
+
code: z18.string().nullish(),
|
|
3648
|
+
containerId: z18.string()
|
|
3520
3649
|
})
|
|
3521
3650
|
)
|
|
3522
3651
|
);
|
|
3523
|
-
var codeInterpreterOutputSchema =
|
|
3524
|
-
() =>
|
|
3525
|
-
|
|
3526
|
-
outputs:
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3652
|
+
var codeInterpreterOutputSchema = lazySchema3(
|
|
3653
|
+
() => zodSchema16(
|
|
3654
|
+
z18.object({
|
|
3655
|
+
outputs: z18.array(
|
|
3656
|
+
z18.discriminatedUnion("type", [
|
|
3657
|
+
z18.object({ type: z18.literal("logs"), logs: z18.string() }),
|
|
3658
|
+
z18.object({ type: z18.literal("image"), url: z18.string() })
|
|
3530
3659
|
])
|
|
3531
3660
|
).nullish()
|
|
3532
3661
|
})
|
|
3533
3662
|
)
|
|
3534
3663
|
);
|
|
3535
|
-
var codeInterpreterArgsSchema =
|
|
3536
|
-
() =>
|
|
3537
|
-
|
|
3538
|
-
container:
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
fileIds:
|
|
3664
|
+
var codeInterpreterArgsSchema = lazySchema3(
|
|
3665
|
+
() => zodSchema16(
|
|
3666
|
+
z18.object({
|
|
3667
|
+
container: z18.union([
|
|
3668
|
+
z18.string(),
|
|
3669
|
+
z18.object({
|
|
3670
|
+
fileIds: z18.array(z18.string()).optional()
|
|
3542
3671
|
})
|
|
3543
3672
|
]).optional()
|
|
3544
3673
|
})
|
|
3545
3674
|
)
|
|
3546
3675
|
);
|
|
3547
|
-
var codeInterpreterToolFactory =
|
|
3676
|
+
var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
|
|
3548
3677
|
id: "openai.code_interpreter",
|
|
3549
3678
|
name: "code_interpreter",
|
|
3550
3679
|
inputSchema: codeInterpreterInputSchema,
|
|
@@ -3555,120 +3684,58 @@ var codeInterpreter = (args = {}) => {
|
|
|
3555
3684
|
};
|
|
3556
3685
|
|
|
3557
3686
|
// src/tool/file-search.ts
|
|
3558
|
-
import {
|
|
3559
|
-
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
|
|
3560
|
-
lazySchema as lazySchema3,
|
|
3561
|
-
zodSchema as zodSchema16
|
|
3562
|
-
} from "@ai-sdk/provider-utils";
|
|
3563
|
-
import { z as z18 } from "zod/v4";
|
|
3564
|
-
var comparisonFilterSchema = z18.object({
|
|
3565
|
-
key: z18.string(),
|
|
3566
|
-
type: z18.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
3567
|
-
value: z18.union([z18.string(), z18.number(), z18.boolean(), z18.array(z18.string())])
|
|
3568
|
-
});
|
|
3569
|
-
var compoundFilterSchema = z18.object({
|
|
3570
|
-
type: z18.enum(["and", "or"]),
|
|
3571
|
-
filters: z18.array(
|
|
3572
|
-
z18.union([comparisonFilterSchema, z18.lazy(() => compoundFilterSchema)])
|
|
3573
|
-
)
|
|
3574
|
-
});
|
|
3575
|
-
var fileSearchArgsSchema = lazySchema3(
|
|
3576
|
-
() => zodSchema16(
|
|
3577
|
-
z18.object({
|
|
3578
|
-
vectorStoreIds: z18.array(z18.string()),
|
|
3579
|
-
maxNumResults: z18.number().optional(),
|
|
3580
|
-
ranking: z18.object({
|
|
3581
|
-
ranker: z18.string().optional(),
|
|
3582
|
-
scoreThreshold: z18.number().optional()
|
|
3583
|
-
}).optional(),
|
|
3584
|
-
filters: z18.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
3585
|
-
})
|
|
3586
|
-
)
|
|
3587
|
-
);
|
|
3588
|
-
var fileSearchOutputSchema = lazySchema3(
|
|
3589
|
-
() => zodSchema16(
|
|
3590
|
-
z18.object({
|
|
3591
|
-
queries: z18.array(z18.string()),
|
|
3592
|
-
results: z18.array(
|
|
3593
|
-
z18.object({
|
|
3594
|
-
attributes: z18.record(z18.string(), z18.unknown()),
|
|
3595
|
-
fileId: z18.string(),
|
|
3596
|
-
filename: z18.string(),
|
|
3597
|
-
score: z18.number(),
|
|
3598
|
-
text: z18.string()
|
|
3599
|
-
})
|
|
3600
|
-
).nullable()
|
|
3601
|
-
})
|
|
3602
|
-
)
|
|
3603
|
-
);
|
|
3604
|
-
var fileSearch = createProviderDefinedToolFactoryWithOutputSchema3({
|
|
3605
|
-
id: "openai.file_search",
|
|
3606
|
-
name: "file_search",
|
|
3607
|
-
inputSchema: z18.object({}),
|
|
3608
|
-
outputSchema: fileSearchOutputSchema
|
|
3609
|
-
});
|
|
3610
|
-
|
|
3611
|
-
// src/tool/web-search.ts
|
|
3612
3687
|
import {
|
|
3613
3688
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
|
|
3614
3689
|
lazySchema as lazySchema4,
|
|
3615
3690
|
zodSchema as zodSchema17
|
|
3616
3691
|
} from "@ai-sdk/provider-utils";
|
|
3617
3692
|
import { z as z19 } from "zod/v4";
|
|
3618
|
-
var
|
|
3693
|
+
var comparisonFilterSchema = z19.object({
|
|
3694
|
+
key: z19.string(),
|
|
3695
|
+
type: z19.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
3696
|
+
value: z19.union([z19.string(), z19.number(), z19.boolean(), z19.array(z19.string())])
|
|
3697
|
+
});
|
|
3698
|
+
var compoundFilterSchema = z19.object({
|
|
3699
|
+
type: z19.enum(["and", "or"]),
|
|
3700
|
+
filters: z19.array(
|
|
3701
|
+
z19.union([comparisonFilterSchema, z19.lazy(() => compoundFilterSchema)])
|
|
3702
|
+
)
|
|
3703
|
+
});
|
|
3704
|
+
var fileSearchArgsSchema = lazySchema4(
|
|
3619
3705
|
() => zodSchema17(
|
|
3620
3706
|
z19.object({
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3707
|
+
vectorStoreIds: z19.array(z19.string()),
|
|
3708
|
+
maxNumResults: z19.number().optional(),
|
|
3709
|
+
ranking: z19.object({
|
|
3710
|
+
ranker: z19.string().optional(),
|
|
3711
|
+
scoreThreshold: z19.number().optional()
|
|
3625
3712
|
}).optional(),
|
|
3626
|
-
|
|
3627
|
-
userLocation: z19.object({
|
|
3628
|
-
type: z19.literal("approximate"),
|
|
3629
|
-
country: z19.string().optional(),
|
|
3630
|
-
city: z19.string().optional(),
|
|
3631
|
-
region: z19.string().optional(),
|
|
3632
|
-
timezone: z19.string().optional()
|
|
3633
|
-
}).optional()
|
|
3713
|
+
filters: z19.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
3634
3714
|
})
|
|
3635
3715
|
)
|
|
3636
3716
|
);
|
|
3637
|
-
var
|
|
3638
|
-
var webSearchOutputSchema = lazySchema4(
|
|
3717
|
+
var fileSearchOutputSchema = lazySchema4(
|
|
3639
3718
|
() => zodSchema17(
|
|
3640
3719
|
z19.object({
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
type: z19.literal("search"),
|
|
3644
|
-
query: z19.string().optional()
|
|
3645
|
-
}),
|
|
3646
|
-
z19.object({
|
|
3647
|
-
type: z19.literal("openPage"),
|
|
3648
|
-
url: z19.string().nullish()
|
|
3649
|
-
}),
|
|
3720
|
+
queries: z19.array(z19.string()),
|
|
3721
|
+
results: z19.array(
|
|
3650
3722
|
z19.object({
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3723
|
+
attributes: z19.record(z19.string(), z19.unknown()),
|
|
3724
|
+
fileId: z19.string(),
|
|
3725
|
+
filename: z19.string(),
|
|
3726
|
+
score: z19.number(),
|
|
3727
|
+
text: z19.string()
|
|
3654
3728
|
})
|
|
3655
|
-
|
|
3656
|
-
sources: z19.array(
|
|
3657
|
-
z19.discriminatedUnion("type", [
|
|
3658
|
-
z19.object({ type: z19.literal("url"), url: z19.string() }),
|
|
3659
|
-
z19.object({ type: z19.literal("api"), name: z19.string() })
|
|
3660
|
-
])
|
|
3661
|
-
).optional()
|
|
3729
|
+
).nullable()
|
|
3662
3730
|
})
|
|
3663
3731
|
)
|
|
3664
3732
|
);
|
|
3665
|
-
var
|
|
3666
|
-
id: "openai.
|
|
3667
|
-
name: "
|
|
3668
|
-
inputSchema:
|
|
3669
|
-
outputSchema:
|
|
3733
|
+
var fileSearch = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
3734
|
+
id: "openai.file_search",
|
|
3735
|
+
name: "file_search",
|
|
3736
|
+
inputSchema: z19.object({}),
|
|
3737
|
+
outputSchema: fileSearchOutputSchema
|
|
3670
3738
|
});
|
|
3671
|
-
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
3672
3739
|
|
|
3673
3740
|
// src/tool/web-search-preview.ts
|
|
3674
3741
|
import {
|
|
@@ -4013,6 +4080,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4013
4080
|
modelCapabilities,
|
|
4014
4081
|
options: openaiOptions
|
|
4015
4082
|
});
|
|
4083
|
+
const webSearchToolName = (_a2 = tools == null ? void 0 : tools.find(
|
|
4084
|
+
(tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4085
|
+
)) == null ? void 0 : _a2.name;
|
|
4016
4086
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
4017
4087
|
prompt,
|
|
4018
4088
|
configurationUpdateUnsupportedReason,
|
|
@@ -4020,8 +4090,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4020
4090
|
systemMessageMode: modelCapabilities.systemMessageMode,
|
|
4021
4091
|
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
4022
4092
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
4023
|
-
store: (
|
|
4024
|
-
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
4093
|
+
store: (_b = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _b : true,
|
|
4094
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
4095
|
+
webSearchToolName
|
|
4025
4096
|
});
|
|
4026
4097
|
warnings.push(...inputWarnings);
|
|
4027
4098
|
let resolvedReasoningEffort = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort;
|
|
@@ -4058,7 +4129,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4058
4129
|
});
|
|
4059
4130
|
}
|
|
4060
4131
|
}
|
|
4061
|
-
const strictJsonSchema = (
|
|
4132
|
+
const strictJsonSchema = (_c = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _c : false;
|
|
4062
4133
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
4063
4134
|
function addInclude(key) {
|
|
4064
4135
|
if (include == null) {
|
|
@@ -4076,9 +4147,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4076
4147
|
if (topLogprobs) {
|
|
4077
4148
|
addInclude("message.output_text.logprobs");
|
|
4078
4149
|
}
|
|
4079
|
-
const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
|
|
4080
|
-
(tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4081
|
-
)) == null ? void 0 : _c.name;
|
|
4082
4150
|
if (webSearchToolName) {
|
|
4083
4151
|
addInclude("web_search_call.action.sources");
|
|
4084
4152
|
}
|