@ai-sdk/openai 2.0.133 → 2.0.135
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 +14 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +86 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -13
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +580 -507
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +578 -504
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
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;
|
|
@@ -2606,10 +2719,12 @@ async function convertToOpenAIResponsesInput({
|
|
|
2606
2719
|
explicitMessageItemType = false,
|
|
2607
2720
|
fileIdPrefixes,
|
|
2608
2721
|
store,
|
|
2722
|
+
isReasoningModel = false,
|
|
2609
2723
|
configurationUpdateUnsupportedReason,
|
|
2610
|
-
hasLocalShellTool = false
|
|
2724
|
+
hasLocalShellTool = false,
|
|
2725
|
+
webSearchToolName
|
|
2611
2726
|
}) {
|
|
2612
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
2727
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2613
2728
|
let input = [];
|
|
2614
2729
|
const warnings = [];
|
|
2615
2730
|
for (const { role, content, providerOptions } of prompt) {
|
|
@@ -2758,12 +2873,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2758
2873
|
case "assistant": {
|
|
2759
2874
|
const reasoningMessages = {};
|
|
2760
2875
|
const toolCallParts = {};
|
|
2876
|
+
let hasPrecedingReasoning = false;
|
|
2761
2877
|
for (const part of content) {
|
|
2762
2878
|
switch (part.type) {
|
|
2763
2879
|
case "text": {
|
|
2764
2880
|
const id = (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.itemId;
|
|
2765
2881
|
const phase = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.phase;
|
|
2766
|
-
|
|
2882
|
+
const canUseItemId = id != null && (!isReasoningModel || hasPrecedingReasoning);
|
|
2883
|
+
if (store && canUseItemId) {
|
|
2767
2884
|
input.push({ type: "item_reference", id });
|
|
2768
2885
|
break;
|
|
2769
2886
|
}
|
|
@@ -2771,7 +2888,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2771
2888
|
...explicitMessageItemType && { type: "message" },
|
|
2772
2889
|
role: "assistant",
|
|
2773
2890
|
content: [{ type: "output_text", text: part.text }],
|
|
2774
|
-
id,
|
|
2891
|
+
id: canUseItemId ? id : void 0,
|
|
2775
2892
|
...phase != null && { phase }
|
|
2776
2893
|
});
|
|
2777
2894
|
break;
|
|
@@ -2783,7 +2900,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2783
2900
|
}
|
|
2784
2901
|
const id = (_f = (_e = part.providerOptions) == null ? void 0 : _e.openai) == null ? void 0 : _f.itemId;
|
|
2785
2902
|
const isAsync = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.async;
|
|
2786
|
-
|
|
2903
|
+
const canUseItemId = id != null && (!isReasoningModel || hasPrecedingReasoning);
|
|
2904
|
+
if (store && canUseItemId) {
|
|
2787
2905
|
input.push({ type: "item_reference", id });
|
|
2788
2906
|
break;
|
|
2789
2907
|
}
|
|
@@ -2813,12 +2931,27 @@ async function convertToOpenAIResponsesInput({
|
|
|
2813
2931
|
name: part.toolName,
|
|
2814
2932
|
arguments: JSON.stringify(part.input),
|
|
2815
2933
|
...isAsync != null && { async: isAsync },
|
|
2816
|
-
id
|
|
2934
|
+
id: canUseItemId ? id : void 0
|
|
2817
2935
|
});
|
|
2818
2936
|
break;
|
|
2819
2937
|
}
|
|
2820
2938
|
// assistant tool result parts are from provider-executed tools:
|
|
2821
2939
|
case "tool-result": {
|
|
2940
|
+
if (part.toolName === "web_search" || part.toolName === "web_search_preview" || part.toolName === webSearchToolName) {
|
|
2941
|
+
const itemId = (_k = (_j = (_i = part.providerOptions) == null ? void 0 : _i[providerOptionsName]) == null ? void 0 : _j.itemId) != null ? _k : part.toolCallId;
|
|
2942
|
+
if (store) {
|
|
2943
|
+
input.push({ type: "item_reference", id: itemId });
|
|
2944
|
+
break;
|
|
2945
|
+
}
|
|
2946
|
+
const webSearchCall = await convertWebSearchToolResultOutput({
|
|
2947
|
+
output: part.output,
|
|
2948
|
+
id: itemId
|
|
2949
|
+
});
|
|
2950
|
+
if (webSearchCall != null) {
|
|
2951
|
+
input.push(webSearchCall);
|
|
2952
|
+
break;
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2822
2955
|
if (store) {
|
|
2823
2956
|
input.push({ type: "item_reference", id: part.toolCallId });
|
|
2824
2957
|
} else {
|
|
@@ -2830,6 +2963,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2830
2963
|
break;
|
|
2831
2964
|
}
|
|
2832
2965
|
case "reasoning": {
|
|
2966
|
+
hasPrecedingReasoning = true;
|
|
2833
2967
|
const providerOptions2 = await parseProviderOptions7({
|
|
2834
2968
|
provider: "openai",
|
|
2835
2969
|
providerOptions: part.providerOptions,
|
|
@@ -2987,9 +3121,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2987
3121
|
}
|
|
2988
3122
|
return { input, warnings };
|
|
2989
3123
|
}
|
|
2990
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2991
|
-
itemId:
|
|
2992
|
-
reasoningEncryptedContent:
|
|
3124
|
+
var openaiResponsesReasoningProviderOptionsSchema = z16.object({
|
|
3125
|
+
itemId: z16.string().nullish(),
|
|
3126
|
+
reasoningEncryptedContent: z16.string().nullish()
|
|
2993
3127
|
});
|
|
2994
3128
|
|
|
2995
3129
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3013,289 +3147,289 @@ function mapOpenAIResponseFinishReason({
|
|
|
3013
3147
|
// src/responses/openai-responses-api.ts
|
|
3014
3148
|
import {
|
|
3015
3149
|
lazyValidator as lazyValidator13,
|
|
3016
|
-
zodSchema as
|
|
3150
|
+
zodSchema as zodSchema15
|
|
3017
3151
|
} from "@ai-sdk/provider-utils";
|
|
3018
|
-
import { z as
|
|
3152
|
+
import { z as z17 } from "zod/v4";
|
|
3019
3153
|
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:
|
|
3154
|
+
() => zodSchema15(
|
|
3155
|
+
z17.union([
|
|
3156
|
+
z17.object({
|
|
3157
|
+
type: z17.literal("response.output_text.delta"),
|
|
3158
|
+
item_id: z17.string(),
|
|
3159
|
+
delta: z17.string(),
|
|
3160
|
+
logprobs: z17.array(
|
|
3161
|
+
z17.object({
|
|
3162
|
+
token: z17.string(),
|
|
3163
|
+
logprob: z17.number(),
|
|
3164
|
+
top_logprobs: z17.array(
|
|
3165
|
+
z17.object({
|
|
3166
|
+
token: z17.string(),
|
|
3167
|
+
logprob: z17.number()
|
|
3034
3168
|
})
|
|
3035
3169
|
)
|
|
3036
3170
|
})
|
|
3037
3171
|
).nullish()
|
|
3038
3172
|
}),
|
|
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:
|
|
3173
|
+
z17.object({
|
|
3174
|
+
type: z17.enum(["response.completed", "response.incomplete"]),
|
|
3175
|
+
response: z17.object({
|
|
3176
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
3177
|
+
usage: z17.object({
|
|
3178
|
+
input_tokens: z17.number(),
|
|
3179
|
+
input_tokens_details: z17.object({
|
|
3180
|
+
cached_tokens: z17.number().nullish(),
|
|
3181
|
+
cache_write_tokens: z17.number().nullish(),
|
|
3182
|
+
orchestration_input_tokens: z17.number().nullish(),
|
|
3183
|
+
orchestration_input_cached_tokens: z17.number().nullish()
|
|
3050
3184
|
}).nullish(),
|
|
3051
|
-
output_tokens:
|
|
3052
|
-
output_tokens_details:
|
|
3053
|
-
reasoning_tokens:
|
|
3054
|
-
orchestration_output_tokens:
|
|
3185
|
+
output_tokens: z17.number(),
|
|
3186
|
+
output_tokens_details: z17.object({
|
|
3187
|
+
reasoning_tokens: z17.number().nullish(),
|
|
3188
|
+
orchestration_output_tokens: z17.number().nullish()
|
|
3055
3189
|
}).nullish()
|
|
3056
3190
|
}),
|
|
3057
|
-
reasoning:
|
|
3058
|
-
context:
|
|
3191
|
+
reasoning: z17.object({
|
|
3192
|
+
context: z17.string().nullish()
|
|
3059
3193
|
}).nullish(),
|
|
3060
|
-
service_tier:
|
|
3194
|
+
service_tier: z17.string().nullish()
|
|
3061
3195
|
})
|
|
3062
3196
|
}),
|
|
3063
|
-
|
|
3064
|
-
type:
|
|
3065
|
-
response:
|
|
3066
|
-
id:
|
|
3067
|
-
created_at:
|
|
3068
|
-
model:
|
|
3069
|
-
service_tier:
|
|
3197
|
+
z17.object({
|
|
3198
|
+
type: z17.literal("response.created"),
|
|
3199
|
+
response: z17.object({
|
|
3200
|
+
id: z17.string(),
|
|
3201
|
+
created_at: z17.number(),
|
|
3202
|
+
model: z17.string(),
|
|
3203
|
+
service_tier: z17.string().nullish()
|
|
3070
3204
|
})
|
|
3071
3205
|
}),
|
|
3072
|
-
|
|
3073
|
-
type:
|
|
3074
|
-
output_index:
|
|
3075
|
-
item:
|
|
3076
|
-
|
|
3077
|
-
type:
|
|
3078
|
-
id:
|
|
3079
|
-
phase:
|
|
3206
|
+
z17.object({
|
|
3207
|
+
type: z17.literal("response.output_item.added"),
|
|
3208
|
+
output_index: z17.number(),
|
|
3209
|
+
item: z17.discriminatedUnion("type", [
|
|
3210
|
+
z17.object({
|
|
3211
|
+
type: z17.literal("message"),
|
|
3212
|
+
id: z17.string(),
|
|
3213
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish()
|
|
3080
3214
|
}),
|
|
3081
|
-
|
|
3082
|
-
type:
|
|
3083
|
-
id:
|
|
3084
|
-
encrypted_content:
|
|
3215
|
+
z17.object({
|
|
3216
|
+
type: z17.literal("reasoning"),
|
|
3217
|
+
id: z17.string(),
|
|
3218
|
+
encrypted_content: z17.string().nullish()
|
|
3085
3219
|
}),
|
|
3086
|
-
|
|
3087
|
-
type:
|
|
3088
|
-
id:
|
|
3089
|
-
call_id:
|
|
3090
|
-
name:
|
|
3091
|
-
arguments:
|
|
3092
|
-
async:
|
|
3220
|
+
z17.object({
|
|
3221
|
+
type: z17.literal("function_call"),
|
|
3222
|
+
id: z17.string(),
|
|
3223
|
+
call_id: z17.string(),
|
|
3224
|
+
name: z17.string(),
|
|
3225
|
+
arguments: z17.string(),
|
|
3226
|
+
async: z17.boolean().nullish()
|
|
3093
3227
|
}),
|
|
3094
|
-
|
|
3095
|
-
type:
|
|
3096
|
-
id:
|
|
3097
|
-
status:
|
|
3228
|
+
z17.object({
|
|
3229
|
+
type: z17.literal("web_search_call"),
|
|
3230
|
+
id: z17.string(),
|
|
3231
|
+
status: z17.string()
|
|
3098
3232
|
}),
|
|
3099
|
-
|
|
3100
|
-
type:
|
|
3101
|
-
id:
|
|
3102
|
-
status:
|
|
3233
|
+
z17.object({
|
|
3234
|
+
type: z17.literal("computer_call"),
|
|
3235
|
+
id: z17.string(),
|
|
3236
|
+
status: z17.string()
|
|
3103
3237
|
}),
|
|
3104
|
-
|
|
3105
|
-
type:
|
|
3106
|
-
id:
|
|
3238
|
+
z17.object({
|
|
3239
|
+
type: z17.literal("file_search_call"),
|
|
3240
|
+
id: z17.string()
|
|
3107
3241
|
}),
|
|
3108
|
-
|
|
3109
|
-
type:
|
|
3110
|
-
id:
|
|
3242
|
+
z17.object({
|
|
3243
|
+
type: z17.literal("image_generation_call"),
|
|
3244
|
+
id: z17.string()
|
|
3111
3245
|
}),
|
|
3112
|
-
|
|
3113
|
-
type:
|
|
3114
|
-
id:
|
|
3115
|
-
container_id:
|
|
3116
|
-
code:
|
|
3117
|
-
outputs:
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3246
|
+
z17.object({
|
|
3247
|
+
type: z17.literal("code_interpreter_call"),
|
|
3248
|
+
id: z17.string(),
|
|
3249
|
+
container_id: z17.string(),
|
|
3250
|
+
code: z17.string().nullable(),
|
|
3251
|
+
outputs: z17.array(
|
|
3252
|
+
z17.discriminatedUnion("type", [
|
|
3253
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3254
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3121
3255
|
])
|
|
3122
3256
|
).nullable(),
|
|
3123
|
-
status:
|
|
3257
|
+
status: z17.string()
|
|
3124
3258
|
})
|
|
3125
3259
|
])
|
|
3126
3260
|
}),
|
|
3127
|
-
|
|
3128
|
-
type:
|
|
3129
|
-
output_index:
|
|
3130
|
-
item:
|
|
3131
|
-
|
|
3132
|
-
type:
|
|
3133
|
-
id:
|
|
3134
|
-
phase:
|
|
3261
|
+
z17.object({
|
|
3262
|
+
type: z17.literal("response.output_item.done"),
|
|
3263
|
+
output_index: z17.number(),
|
|
3264
|
+
item: z17.discriminatedUnion("type", [
|
|
3265
|
+
z17.object({
|
|
3266
|
+
type: z17.literal("message"),
|
|
3267
|
+
id: z17.string(),
|
|
3268
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish()
|
|
3135
3269
|
}),
|
|
3136
|
-
|
|
3137
|
-
type:
|
|
3138
|
-
id:
|
|
3139
|
-
encrypted_content:
|
|
3270
|
+
z17.object({
|
|
3271
|
+
type: z17.literal("reasoning"),
|
|
3272
|
+
id: z17.string(),
|
|
3273
|
+
encrypted_content: z17.string().nullish()
|
|
3140
3274
|
}),
|
|
3141
|
-
|
|
3142
|
-
type:
|
|
3143
|
-
id:
|
|
3144
|
-
call_id:
|
|
3145
|
-
name:
|
|
3146
|
-
arguments:
|
|
3147
|
-
async:
|
|
3148
|
-
status:
|
|
3275
|
+
z17.object({
|
|
3276
|
+
type: z17.literal("function_call"),
|
|
3277
|
+
id: z17.string(),
|
|
3278
|
+
call_id: z17.string(),
|
|
3279
|
+
name: z17.string(),
|
|
3280
|
+
arguments: z17.string(),
|
|
3281
|
+
async: z17.boolean().nullish(),
|
|
3282
|
+
status: z17.enum(["in_progress", "completed", "incomplete"])
|
|
3149
3283
|
}),
|
|
3150
|
-
|
|
3151
|
-
type:
|
|
3152
|
-
id:
|
|
3153
|
-
code:
|
|
3154
|
-
container_id:
|
|
3155
|
-
outputs:
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3284
|
+
z17.object({
|
|
3285
|
+
type: z17.literal("code_interpreter_call"),
|
|
3286
|
+
id: z17.string(),
|
|
3287
|
+
code: z17.string().nullable(),
|
|
3288
|
+
container_id: z17.string(),
|
|
3289
|
+
outputs: z17.array(
|
|
3290
|
+
z17.discriminatedUnion("type", [
|
|
3291
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3292
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3159
3293
|
])
|
|
3160
3294
|
).nullable()
|
|
3161
3295
|
}),
|
|
3162
|
-
|
|
3163
|
-
type:
|
|
3164
|
-
id:
|
|
3165
|
-
result:
|
|
3296
|
+
z17.object({
|
|
3297
|
+
type: z17.literal("image_generation_call"),
|
|
3298
|
+
id: z17.string(),
|
|
3299
|
+
result: z17.string()
|
|
3166
3300
|
}),
|
|
3167
|
-
|
|
3168
|
-
type:
|
|
3169
|
-
id:
|
|
3170
|
-
status:
|
|
3171
|
-
action:
|
|
3172
|
-
|
|
3173
|
-
type:
|
|
3174
|
-
query:
|
|
3175
|
-
sources:
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3301
|
+
z17.object({
|
|
3302
|
+
type: z17.literal("web_search_call"),
|
|
3303
|
+
id: z17.string(),
|
|
3304
|
+
status: z17.string(),
|
|
3305
|
+
action: z17.discriminatedUnion("type", [
|
|
3306
|
+
z17.object({
|
|
3307
|
+
type: z17.literal("search"),
|
|
3308
|
+
query: z17.string().nullish(),
|
|
3309
|
+
sources: z17.array(
|
|
3310
|
+
z17.discriminatedUnion("type", [
|
|
3311
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
3312
|
+
z17.object({ type: z17.literal("api"), name: z17.string() })
|
|
3179
3313
|
])
|
|
3180
3314
|
).nullish()
|
|
3181
3315
|
}),
|
|
3182
|
-
|
|
3183
|
-
type:
|
|
3184
|
-
url:
|
|
3316
|
+
z17.object({
|
|
3317
|
+
type: z17.literal("open_page"),
|
|
3318
|
+
url: z17.string().nullish()
|
|
3185
3319
|
}),
|
|
3186
|
-
|
|
3187
|
-
type:
|
|
3188
|
-
url:
|
|
3189
|
-
pattern:
|
|
3320
|
+
z17.object({
|
|
3321
|
+
type: z17.literal("find_in_page"),
|
|
3322
|
+
url: z17.string().nullish(),
|
|
3323
|
+
pattern: z17.string().nullish()
|
|
3190
3324
|
})
|
|
3191
3325
|
]).nullish()
|
|
3192
3326
|
}),
|
|
3193
|
-
|
|
3194
|
-
type:
|
|
3195
|
-
id:
|
|
3196
|
-
queries:
|
|
3197
|
-
results:
|
|
3198
|
-
|
|
3199
|
-
attributes:
|
|
3200
|
-
file_id:
|
|
3201
|
-
filename:
|
|
3202
|
-
score:
|
|
3203
|
-
text:
|
|
3327
|
+
z17.object({
|
|
3328
|
+
type: z17.literal("file_search_call"),
|
|
3329
|
+
id: z17.string(),
|
|
3330
|
+
queries: z17.array(z17.string()),
|
|
3331
|
+
results: z17.array(
|
|
3332
|
+
z17.object({
|
|
3333
|
+
attributes: z17.record(z17.string(), z17.unknown()),
|
|
3334
|
+
file_id: z17.string(),
|
|
3335
|
+
filename: z17.string(),
|
|
3336
|
+
score: z17.number(),
|
|
3337
|
+
text: z17.string()
|
|
3204
3338
|
})
|
|
3205
3339
|
).nullish()
|
|
3206
3340
|
}),
|
|
3207
|
-
|
|
3208
|
-
type:
|
|
3209
|
-
id:
|
|
3210
|
-
call_id:
|
|
3211
|
-
action:
|
|
3212
|
-
type:
|
|
3213
|
-
command:
|
|
3214
|
-
timeout_ms:
|
|
3215
|
-
user:
|
|
3216
|
-
working_directory:
|
|
3217
|
-
env:
|
|
3341
|
+
z17.object({
|
|
3342
|
+
type: z17.literal("local_shell_call"),
|
|
3343
|
+
id: z17.string(),
|
|
3344
|
+
call_id: z17.string(),
|
|
3345
|
+
action: z17.object({
|
|
3346
|
+
type: z17.literal("exec"),
|
|
3347
|
+
command: z17.array(z17.string()),
|
|
3348
|
+
timeout_ms: z17.number().optional(),
|
|
3349
|
+
user: z17.string().optional(),
|
|
3350
|
+
working_directory: z17.string().optional(),
|
|
3351
|
+
env: z17.record(z17.string(), z17.string()).optional()
|
|
3218
3352
|
})
|
|
3219
3353
|
}),
|
|
3220
|
-
|
|
3221
|
-
type:
|
|
3222
|
-
id:
|
|
3223
|
-
status:
|
|
3354
|
+
z17.object({
|
|
3355
|
+
type: z17.literal("computer_call"),
|
|
3356
|
+
id: z17.string(),
|
|
3357
|
+
status: z17.literal("completed")
|
|
3224
3358
|
})
|
|
3225
3359
|
])
|
|
3226
3360
|
}),
|
|
3227
|
-
|
|
3228
|
-
type:
|
|
3229
|
-
item_id:
|
|
3230
|
-
output_index:
|
|
3231
|
-
delta:
|
|
3361
|
+
z17.object({
|
|
3362
|
+
type: z17.literal("response.function_call_arguments.delta"),
|
|
3363
|
+
item_id: z17.string(),
|
|
3364
|
+
output_index: z17.number(),
|
|
3365
|
+
delta: z17.string()
|
|
3232
3366
|
}),
|
|
3233
|
-
|
|
3234
|
-
type:
|
|
3235
|
-
item_id:
|
|
3236
|
-
output_index:
|
|
3237
|
-
partial_image_b64:
|
|
3367
|
+
z17.object({
|
|
3368
|
+
type: z17.literal("response.image_generation_call.partial_image"),
|
|
3369
|
+
item_id: z17.string(),
|
|
3370
|
+
output_index: z17.number(),
|
|
3371
|
+
partial_image_b64: z17.string()
|
|
3238
3372
|
}),
|
|
3239
|
-
|
|
3240
|
-
type:
|
|
3241
|
-
item_id:
|
|
3242
|
-
output_index:
|
|
3243
|
-
delta:
|
|
3373
|
+
z17.object({
|
|
3374
|
+
type: z17.literal("response.code_interpreter_call_code.delta"),
|
|
3375
|
+
item_id: z17.string(),
|
|
3376
|
+
output_index: z17.number(),
|
|
3377
|
+
delta: z17.string()
|
|
3244
3378
|
}),
|
|
3245
|
-
|
|
3246
|
-
type:
|
|
3247
|
-
item_id:
|
|
3248
|
-
output_index:
|
|
3249
|
-
code:
|
|
3379
|
+
z17.object({
|
|
3380
|
+
type: z17.literal("response.code_interpreter_call_code.done"),
|
|
3381
|
+
item_id: z17.string(),
|
|
3382
|
+
output_index: z17.number(),
|
|
3383
|
+
code: z17.string()
|
|
3250
3384
|
}),
|
|
3251
|
-
|
|
3252
|
-
type:
|
|
3253
|
-
annotation:
|
|
3254
|
-
|
|
3255
|
-
type:
|
|
3256
|
-
start_index:
|
|
3257
|
-
end_index:
|
|
3258
|
-
url:
|
|
3259
|
-
title:
|
|
3385
|
+
z17.object({
|
|
3386
|
+
type: z17.literal("response.output_text.annotation.added"),
|
|
3387
|
+
annotation: z17.discriminatedUnion("type", [
|
|
3388
|
+
z17.object({
|
|
3389
|
+
type: z17.literal("url_citation"),
|
|
3390
|
+
start_index: z17.number(),
|
|
3391
|
+
end_index: z17.number(),
|
|
3392
|
+
url: z17.string(),
|
|
3393
|
+
title: z17.string()
|
|
3260
3394
|
}),
|
|
3261
|
-
|
|
3262
|
-
type:
|
|
3263
|
-
file_id:
|
|
3264
|
-
filename:
|
|
3265
|
-
index:
|
|
3266
|
-
start_index:
|
|
3267
|
-
end_index:
|
|
3268
|
-
quote:
|
|
3395
|
+
z17.object({
|
|
3396
|
+
type: z17.literal("file_citation"),
|
|
3397
|
+
file_id: z17.string(),
|
|
3398
|
+
filename: z17.string().nullish(),
|
|
3399
|
+
index: z17.number().nullish(),
|
|
3400
|
+
start_index: z17.number().nullish(),
|
|
3401
|
+
end_index: z17.number().nullish(),
|
|
3402
|
+
quote: z17.string().nullish()
|
|
3269
3403
|
})
|
|
3270
3404
|
])
|
|
3271
3405
|
}),
|
|
3272
|
-
|
|
3273
|
-
type:
|
|
3274
|
-
item_id:
|
|
3275
|
-
summary_index:
|
|
3406
|
+
z17.object({
|
|
3407
|
+
type: z17.literal("response.reasoning_summary_part.added"),
|
|
3408
|
+
item_id: z17.string(),
|
|
3409
|
+
summary_index: z17.number()
|
|
3276
3410
|
}),
|
|
3277
|
-
|
|
3278
|
-
type:
|
|
3279
|
-
item_id:
|
|
3280
|
-
summary_index:
|
|
3281
|
-
delta:
|
|
3411
|
+
z17.object({
|
|
3412
|
+
type: z17.literal("response.reasoning_summary_text.delta"),
|
|
3413
|
+
item_id: z17.string(),
|
|
3414
|
+
summary_index: z17.number(),
|
|
3415
|
+
delta: z17.string()
|
|
3282
3416
|
}),
|
|
3283
|
-
|
|
3284
|
-
type:
|
|
3285
|
-
item_id:
|
|
3286
|
-
summary_index:
|
|
3417
|
+
z17.object({
|
|
3418
|
+
type: z17.literal("response.reasoning_summary_part.done"),
|
|
3419
|
+
item_id: z17.string(),
|
|
3420
|
+
summary_index: z17.number()
|
|
3287
3421
|
}),
|
|
3288
|
-
|
|
3289
|
-
type:
|
|
3290
|
-
sequence_number:
|
|
3291
|
-
error:
|
|
3292
|
-
type:
|
|
3293
|
-
code:
|
|
3294
|
-
message:
|
|
3295
|
-
param:
|
|
3422
|
+
z17.object({
|
|
3423
|
+
type: z17.literal("error"),
|
|
3424
|
+
sequence_number: z17.number(),
|
|
3425
|
+
error: z17.object({
|
|
3426
|
+
type: z17.string(),
|
|
3427
|
+
code: z17.string(),
|
|
3428
|
+
message: z17.string(),
|
|
3429
|
+
param: z17.string().nullish()
|
|
3296
3430
|
})
|
|
3297
3431
|
}),
|
|
3298
|
-
|
|
3432
|
+
z17.object({ type: z17.string() }).loose().transform((value) => ({
|
|
3299
3433
|
type: "unknown_chunk",
|
|
3300
3434
|
message: value.type
|
|
3301
3435
|
}))
|
|
@@ -3304,196 +3438,196 @@ var openaiResponsesChunkSchema = lazyValidator13(
|
|
|
3304
3438
|
)
|
|
3305
3439
|
);
|
|
3306
3440
|
var openaiResponsesResponseSchema = lazyValidator13(
|
|
3307
|
-
() =>
|
|
3308
|
-
|
|
3309
|
-
id:
|
|
3310
|
-
created_at:
|
|
3311
|
-
error:
|
|
3312
|
-
message:
|
|
3313
|
-
type:
|
|
3314
|
-
param:
|
|
3315
|
-
code:
|
|
3441
|
+
() => zodSchema15(
|
|
3442
|
+
z17.object({
|
|
3443
|
+
id: z17.string().optional(),
|
|
3444
|
+
created_at: z17.number().optional(),
|
|
3445
|
+
error: z17.object({
|
|
3446
|
+
message: z17.string(),
|
|
3447
|
+
type: z17.string(),
|
|
3448
|
+
param: z17.string().nullish(),
|
|
3449
|
+
code: z17.string()
|
|
3316
3450
|
}).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:
|
|
3451
|
+
model: z17.string().optional(),
|
|
3452
|
+
output: z17.array(
|
|
3453
|
+
z17.discriminatedUnion("type", [
|
|
3454
|
+
z17.object({
|
|
3455
|
+
type: z17.literal("message"),
|
|
3456
|
+
role: z17.literal("assistant"),
|
|
3457
|
+
id: z17.string(),
|
|
3458
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish(),
|
|
3459
|
+
content: z17.array(
|
|
3460
|
+
z17.object({
|
|
3461
|
+
type: z17.literal("output_text"),
|
|
3462
|
+
text: z17.string(),
|
|
3463
|
+
logprobs: z17.array(
|
|
3464
|
+
z17.object({
|
|
3465
|
+
token: z17.string(),
|
|
3466
|
+
logprob: z17.number(),
|
|
3467
|
+
top_logprobs: z17.array(
|
|
3468
|
+
z17.object({
|
|
3469
|
+
token: z17.string(),
|
|
3470
|
+
logprob: z17.number()
|
|
3337
3471
|
})
|
|
3338
3472
|
)
|
|
3339
3473
|
})
|
|
3340
3474
|
).nullish(),
|
|
3341
|
-
annotations:
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
type:
|
|
3345
|
-
start_index:
|
|
3346
|
-
end_index:
|
|
3347
|
-
url:
|
|
3348
|
-
title:
|
|
3475
|
+
annotations: z17.array(
|
|
3476
|
+
z17.discriminatedUnion("type", [
|
|
3477
|
+
z17.object({
|
|
3478
|
+
type: z17.literal("url_citation"),
|
|
3479
|
+
start_index: z17.number(),
|
|
3480
|
+
end_index: z17.number(),
|
|
3481
|
+
url: z17.string(),
|
|
3482
|
+
title: z17.string()
|
|
3349
3483
|
}),
|
|
3350
|
-
|
|
3351
|
-
type:
|
|
3352
|
-
file_id:
|
|
3353
|
-
filename:
|
|
3354
|
-
index:
|
|
3355
|
-
start_index:
|
|
3356
|
-
end_index:
|
|
3357
|
-
quote:
|
|
3484
|
+
z17.object({
|
|
3485
|
+
type: z17.literal("file_citation"),
|
|
3486
|
+
file_id: z17.string(),
|
|
3487
|
+
filename: z17.string().nullish(),
|
|
3488
|
+
index: z17.number().nullish(),
|
|
3489
|
+
start_index: z17.number().nullish(),
|
|
3490
|
+
end_index: z17.number().nullish(),
|
|
3491
|
+
quote: z17.string().nullish()
|
|
3358
3492
|
}),
|
|
3359
|
-
|
|
3360
|
-
type:
|
|
3361
|
-
container_id:
|
|
3362
|
-
file_id:
|
|
3363
|
-
filename:
|
|
3364
|
-
start_index:
|
|
3365
|
-
end_index:
|
|
3366
|
-
index:
|
|
3493
|
+
z17.object({
|
|
3494
|
+
type: z17.literal("container_file_citation"),
|
|
3495
|
+
container_id: z17.string(),
|
|
3496
|
+
file_id: z17.string(),
|
|
3497
|
+
filename: z17.string().nullish(),
|
|
3498
|
+
start_index: z17.number().nullish(),
|
|
3499
|
+
end_index: z17.number().nullish(),
|
|
3500
|
+
index: z17.number().nullish()
|
|
3367
3501
|
}),
|
|
3368
|
-
|
|
3369
|
-
type:
|
|
3370
|
-
file_id:
|
|
3371
|
-
index:
|
|
3502
|
+
z17.object({
|
|
3503
|
+
type: z17.literal("file_path"),
|
|
3504
|
+
file_id: z17.string(),
|
|
3505
|
+
index: z17.number().nullish()
|
|
3372
3506
|
})
|
|
3373
3507
|
])
|
|
3374
3508
|
)
|
|
3375
3509
|
})
|
|
3376
3510
|
)
|
|
3377
3511
|
}),
|
|
3378
|
-
|
|
3379
|
-
type:
|
|
3380
|
-
id:
|
|
3381
|
-
status:
|
|
3382
|
-
action:
|
|
3383
|
-
|
|
3384
|
-
type:
|
|
3385
|
-
query:
|
|
3386
|
-
sources:
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
type:
|
|
3391
|
-
name:
|
|
3512
|
+
z17.object({
|
|
3513
|
+
type: z17.literal("web_search_call"),
|
|
3514
|
+
id: z17.string(),
|
|
3515
|
+
status: z17.string(),
|
|
3516
|
+
action: z17.discriminatedUnion("type", [
|
|
3517
|
+
z17.object({
|
|
3518
|
+
type: z17.literal("search"),
|
|
3519
|
+
query: z17.string().nullish(),
|
|
3520
|
+
sources: z17.array(
|
|
3521
|
+
z17.discriminatedUnion("type", [
|
|
3522
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
3523
|
+
z17.object({
|
|
3524
|
+
type: z17.literal("api"),
|
|
3525
|
+
name: z17.string()
|
|
3392
3526
|
})
|
|
3393
3527
|
])
|
|
3394
3528
|
).nullish()
|
|
3395
3529
|
}),
|
|
3396
|
-
|
|
3397
|
-
type:
|
|
3398
|
-
url:
|
|
3530
|
+
z17.object({
|
|
3531
|
+
type: z17.literal("open_page"),
|
|
3532
|
+
url: z17.string().nullish()
|
|
3399
3533
|
}),
|
|
3400
|
-
|
|
3401
|
-
type:
|
|
3402
|
-
url:
|
|
3403
|
-
pattern:
|
|
3534
|
+
z17.object({
|
|
3535
|
+
type: z17.literal("find_in_page"),
|
|
3536
|
+
url: z17.string().nullish(),
|
|
3537
|
+
pattern: z17.string().nullish()
|
|
3404
3538
|
})
|
|
3405
3539
|
]).nullish()
|
|
3406
3540
|
}),
|
|
3407
|
-
|
|
3408
|
-
type:
|
|
3409
|
-
id:
|
|
3410
|
-
queries:
|
|
3411
|
-
results:
|
|
3412
|
-
|
|
3413
|
-
attributes:
|
|
3414
|
-
|
|
3415
|
-
|
|
3541
|
+
z17.object({
|
|
3542
|
+
type: z17.literal("file_search_call"),
|
|
3543
|
+
id: z17.string(),
|
|
3544
|
+
queries: z17.array(z17.string()),
|
|
3545
|
+
results: z17.array(
|
|
3546
|
+
z17.object({
|
|
3547
|
+
attributes: z17.record(
|
|
3548
|
+
z17.string(),
|
|
3549
|
+
z17.union([z17.string(), z17.number(), z17.boolean()])
|
|
3416
3550
|
),
|
|
3417
|
-
file_id:
|
|
3418
|
-
filename:
|
|
3419
|
-
score:
|
|
3420
|
-
text:
|
|
3551
|
+
file_id: z17.string(),
|
|
3552
|
+
filename: z17.string(),
|
|
3553
|
+
score: z17.number(),
|
|
3554
|
+
text: z17.string()
|
|
3421
3555
|
})
|
|
3422
3556
|
).nullish()
|
|
3423
3557
|
}),
|
|
3424
|
-
|
|
3425
|
-
type:
|
|
3426
|
-
id:
|
|
3427
|
-
code:
|
|
3428
|
-
container_id:
|
|
3429
|
-
outputs:
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3558
|
+
z17.object({
|
|
3559
|
+
type: z17.literal("code_interpreter_call"),
|
|
3560
|
+
id: z17.string(),
|
|
3561
|
+
code: z17.string().nullable(),
|
|
3562
|
+
container_id: z17.string(),
|
|
3563
|
+
outputs: z17.array(
|
|
3564
|
+
z17.discriminatedUnion("type", [
|
|
3565
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3566
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3433
3567
|
])
|
|
3434
3568
|
).nullable()
|
|
3435
3569
|
}),
|
|
3436
|
-
|
|
3437
|
-
type:
|
|
3438
|
-
id:
|
|
3439
|
-
result:
|
|
3570
|
+
z17.object({
|
|
3571
|
+
type: z17.literal("image_generation_call"),
|
|
3572
|
+
id: z17.string(),
|
|
3573
|
+
result: z17.string()
|
|
3440
3574
|
}),
|
|
3441
|
-
|
|
3442
|
-
type:
|
|
3443
|
-
id:
|
|
3444
|
-
call_id:
|
|
3445
|
-
action:
|
|
3446
|
-
type:
|
|
3447
|
-
command:
|
|
3448
|
-
timeout_ms:
|
|
3449
|
-
user:
|
|
3450
|
-
working_directory:
|
|
3451
|
-
env:
|
|
3575
|
+
z17.object({
|
|
3576
|
+
type: z17.literal("local_shell_call"),
|
|
3577
|
+
id: z17.string(),
|
|
3578
|
+
call_id: z17.string(),
|
|
3579
|
+
action: z17.object({
|
|
3580
|
+
type: z17.literal("exec"),
|
|
3581
|
+
command: z17.array(z17.string()),
|
|
3582
|
+
timeout_ms: z17.number().optional(),
|
|
3583
|
+
user: z17.string().optional(),
|
|
3584
|
+
working_directory: z17.string().optional(),
|
|
3585
|
+
env: z17.record(z17.string(), z17.string()).optional()
|
|
3452
3586
|
})
|
|
3453
3587
|
}),
|
|
3454
|
-
|
|
3455
|
-
type:
|
|
3456
|
-
call_id:
|
|
3457
|
-
name:
|
|
3458
|
-
arguments:
|
|
3459
|
-
id:
|
|
3460
|
-
async:
|
|
3588
|
+
z17.object({
|
|
3589
|
+
type: z17.literal("function_call"),
|
|
3590
|
+
call_id: z17.string(),
|
|
3591
|
+
name: z17.string(),
|
|
3592
|
+
arguments: z17.string(),
|
|
3593
|
+
id: z17.string(),
|
|
3594
|
+
async: z17.boolean().nullish()
|
|
3461
3595
|
}),
|
|
3462
|
-
|
|
3463
|
-
type:
|
|
3464
|
-
id:
|
|
3465
|
-
status:
|
|
3596
|
+
z17.object({
|
|
3597
|
+
type: z17.literal("computer_call"),
|
|
3598
|
+
id: z17.string(),
|
|
3599
|
+
status: z17.string().optional()
|
|
3466
3600
|
}),
|
|
3467
|
-
|
|
3468
|
-
type:
|
|
3469
|
-
id:
|
|
3470
|
-
encrypted_content:
|
|
3471
|
-
summary:
|
|
3472
|
-
|
|
3473
|
-
type:
|
|
3474
|
-
text:
|
|
3601
|
+
z17.object({
|
|
3602
|
+
type: z17.literal("reasoning"),
|
|
3603
|
+
id: z17.string(),
|
|
3604
|
+
encrypted_content: z17.string().nullish(),
|
|
3605
|
+
summary: z17.array(
|
|
3606
|
+
z17.object({
|
|
3607
|
+
type: z17.literal("summary_text"),
|
|
3608
|
+
text: z17.string()
|
|
3475
3609
|
})
|
|
3476
3610
|
)
|
|
3477
3611
|
})
|
|
3478
3612
|
])
|
|
3479
3613
|
).optional(),
|
|
3480
|
-
service_tier:
|
|
3481
|
-
reasoning:
|
|
3482
|
-
context:
|
|
3614
|
+
service_tier: z17.string().nullish(),
|
|
3615
|
+
reasoning: z17.object({
|
|
3616
|
+
context: z17.string().nullish()
|
|
3483
3617
|
}).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:
|
|
3618
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
3619
|
+
usage: z17.object({
|
|
3620
|
+
input_tokens: z17.number(),
|
|
3621
|
+
input_tokens_details: z17.object({
|
|
3622
|
+
cached_tokens: z17.number().nullish(),
|
|
3623
|
+
cache_write_tokens: z17.number().nullish(),
|
|
3624
|
+
orchestration_input_tokens: z17.number().nullish(),
|
|
3625
|
+
orchestration_input_cached_tokens: z17.number().nullish()
|
|
3492
3626
|
}).nullish(),
|
|
3493
|
-
output_tokens:
|
|
3494
|
-
output_tokens_details:
|
|
3495
|
-
reasoning_tokens:
|
|
3496
|
-
orchestration_output_tokens:
|
|
3627
|
+
output_tokens: z17.number(),
|
|
3628
|
+
output_tokens_details: z17.object({
|
|
3629
|
+
reasoning_tokens: z17.number().nullish(),
|
|
3630
|
+
orchestration_output_tokens: z17.number().nullish()
|
|
3497
3631
|
}).nullish()
|
|
3498
3632
|
}).optional()
|
|
3499
3633
|
})
|
|
@@ -3507,44 +3641,44 @@ import {
|
|
|
3507
3641
|
|
|
3508
3642
|
// src/tool/code-interpreter.ts
|
|
3509
3643
|
import {
|
|
3510
|
-
createProviderDefinedToolFactoryWithOutputSchema as
|
|
3511
|
-
lazySchema as
|
|
3512
|
-
zodSchema as
|
|
3644
|
+
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
|
|
3645
|
+
lazySchema as lazySchema3,
|
|
3646
|
+
zodSchema as zodSchema16
|
|
3513
3647
|
} from "@ai-sdk/provider-utils";
|
|
3514
|
-
import { z as
|
|
3515
|
-
var codeInterpreterInputSchema =
|
|
3516
|
-
() =>
|
|
3517
|
-
|
|
3518
|
-
code:
|
|
3519
|
-
containerId:
|
|
3648
|
+
import { z as z18 } from "zod/v4";
|
|
3649
|
+
var codeInterpreterInputSchema = lazySchema3(
|
|
3650
|
+
() => zodSchema16(
|
|
3651
|
+
z18.object({
|
|
3652
|
+
code: z18.string().nullish(),
|
|
3653
|
+
containerId: z18.string()
|
|
3520
3654
|
})
|
|
3521
3655
|
)
|
|
3522
3656
|
);
|
|
3523
|
-
var codeInterpreterOutputSchema =
|
|
3524
|
-
() =>
|
|
3525
|
-
|
|
3526
|
-
outputs:
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3657
|
+
var codeInterpreterOutputSchema = lazySchema3(
|
|
3658
|
+
() => zodSchema16(
|
|
3659
|
+
z18.object({
|
|
3660
|
+
outputs: z18.array(
|
|
3661
|
+
z18.discriminatedUnion("type", [
|
|
3662
|
+
z18.object({ type: z18.literal("logs"), logs: z18.string() }),
|
|
3663
|
+
z18.object({ type: z18.literal("image"), url: z18.string() })
|
|
3530
3664
|
])
|
|
3531
3665
|
).nullish()
|
|
3532
3666
|
})
|
|
3533
3667
|
)
|
|
3534
3668
|
);
|
|
3535
|
-
var codeInterpreterArgsSchema =
|
|
3536
|
-
() =>
|
|
3537
|
-
|
|
3538
|
-
container:
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
fileIds:
|
|
3669
|
+
var codeInterpreterArgsSchema = lazySchema3(
|
|
3670
|
+
() => zodSchema16(
|
|
3671
|
+
z18.object({
|
|
3672
|
+
container: z18.union([
|
|
3673
|
+
z18.string(),
|
|
3674
|
+
z18.object({
|
|
3675
|
+
fileIds: z18.array(z18.string()).optional()
|
|
3542
3676
|
})
|
|
3543
3677
|
]).optional()
|
|
3544
3678
|
})
|
|
3545
3679
|
)
|
|
3546
3680
|
);
|
|
3547
|
-
var codeInterpreterToolFactory =
|
|
3681
|
+
var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
|
|
3548
3682
|
id: "openai.code_interpreter",
|
|
3549
3683
|
name: "code_interpreter",
|
|
3550
3684
|
inputSchema: codeInterpreterInputSchema,
|
|
@@ -3555,120 +3689,58 @@ var codeInterpreter = (args = {}) => {
|
|
|
3555
3689
|
};
|
|
3556
3690
|
|
|
3557
3691
|
// 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
3692
|
import {
|
|
3613
3693
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
|
|
3614
3694
|
lazySchema as lazySchema4,
|
|
3615
3695
|
zodSchema as zodSchema17
|
|
3616
3696
|
} from "@ai-sdk/provider-utils";
|
|
3617
3697
|
import { z as z19 } from "zod/v4";
|
|
3618
|
-
var
|
|
3698
|
+
var comparisonFilterSchema = z19.object({
|
|
3699
|
+
key: z19.string(),
|
|
3700
|
+
type: z19.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
3701
|
+
value: z19.union([z19.string(), z19.number(), z19.boolean(), z19.array(z19.string())])
|
|
3702
|
+
});
|
|
3703
|
+
var compoundFilterSchema = z19.object({
|
|
3704
|
+
type: z19.enum(["and", "or"]),
|
|
3705
|
+
filters: z19.array(
|
|
3706
|
+
z19.union([comparisonFilterSchema, z19.lazy(() => compoundFilterSchema)])
|
|
3707
|
+
)
|
|
3708
|
+
});
|
|
3709
|
+
var fileSearchArgsSchema = lazySchema4(
|
|
3619
3710
|
() => zodSchema17(
|
|
3620
3711
|
z19.object({
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3712
|
+
vectorStoreIds: z19.array(z19.string()),
|
|
3713
|
+
maxNumResults: z19.number().optional(),
|
|
3714
|
+
ranking: z19.object({
|
|
3715
|
+
ranker: z19.string().optional(),
|
|
3716
|
+
scoreThreshold: z19.number().optional()
|
|
3625
3717
|
}).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()
|
|
3718
|
+
filters: z19.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
3634
3719
|
})
|
|
3635
3720
|
)
|
|
3636
3721
|
);
|
|
3637
|
-
var
|
|
3638
|
-
var webSearchOutputSchema = lazySchema4(
|
|
3722
|
+
var fileSearchOutputSchema = lazySchema4(
|
|
3639
3723
|
() => zodSchema17(
|
|
3640
3724
|
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
|
-
}),
|
|
3725
|
+
queries: z19.array(z19.string()),
|
|
3726
|
+
results: z19.array(
|
|
3650
3727
|
z19.object({
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3728
|
+
attributes: z19.record(z19.string(), z19.unknown()),
|
|
3729
|
+
fileId: z19.string(),
|
|
3730
|
+
filename: z19.string(),
|
|
3731
|
+
score: z19.number(),
|
|
3732
|
+
text: z19.string()
|
|
3654
3733
|
})
|
|
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()
|
|
3734
|
+
).nullable()
|
|
3662
3735
|
})
|
|
3663
3736
|
)
|
|
3664
3737
|
);
|
|
3665
|
-
var
|
|
3666
|
-
id: "openai.
|
|
3667
|
-
name: "
|
|
3668
|
-
inputSchema:
|
|
3669
|
-
outputSchema:
|
|
3738
|
+
var fileSearch = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
3739
|
+
id: "openai.file_search",
|
|
3740
|
+
name: "file_search",
|
|
3741
|
+
inputSchema: z19.object({}),
|
|
3742
|
+
outputSchema: fileSearchOutputSchema
|
|
3670
3743
|
});
|
|
3671
|
-
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
3672
3744
|
|
|
3673
3745
|
// src/tool/web-search-preview.ts
|
|
3674
3746
|
import {
|
|
@@ -4013,6 +4085,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4013
4085
|
modelCapabilities,
|
|
4014
4086
|
options: openaiOptions
|
|
4015
4087
|
});
|
|
4088
|
+
const webSearchToolName = (_a2 = tools == null ? void 0 : tools.find(
|
|
4089
|
+
(tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4090
|
+
)) == null ? void 0 : _a2.name;
|
|
4016
4091
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
4017
4092
|
prompt,
|
|
4018
4093
|
configurationUpdateUnsupportedReason,
|
|
@@ -4020,8 +4095,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4020
4095
|
systemMessageMode: modelCapabilities.systemMessageMode,
|
|
4021
4096
|
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
4022
4097
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
4023
|
-
store: (
|
|
4024
|
-
|
|
4098
|
+
store: (_b = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _b : true,
|
|
4099
|
+
isReasoningModel: modelCapabilities.isReasoningModel,
|
|
4100
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
4101
|
+
webSearchToolName
|
|
4025
4102
|
});
|
|
4026
4103
|
warnings.push(...inputWarnings);
|
|
4027
4104
|
let resolvedReasoningEffort = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort;
|
|
@@ -4058,7 +4135,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4058
4135
|
});
|
|
4059
4136
|
}
|
|
4060
4137
|
}
|
|
4061
|
-
const strictJsonSchema = (
|
|
4138
|
+
const strictJsonSchema = (_c = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _c : false;
|
|
4062
4139
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
4063
4140
|
function addInclude(key) {
|
|
4064
4141
|
if (include == null) {
|
|
@@ -4076,9 +4153,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4076
4153
|
if (topLogprobs) {
|
|
4077
4154
|
addInclude("message.output_text.logprobs");
|
|
4078
4155
|
}
|
|
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
4156
|
if (webSearchToolName) {
|
|
4083
4157
|
addInclude("web_search_call.action.sources");
|
|
4084
4158
|
}
|