@ai-sdk/openai 2.0.25 → 2.0.26
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 +7 -0
- package/dist/index.d.mts +47 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +371 -320
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +340 -289
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +310 -263
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +298 -251
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.mjs
CHANGED
|
@@ -2167,7 +2167,7 @@ import {
|
|
|
2167
2167
|
parseProviderOptions as parseProviderOptions7,
|
|
2168
2168
|
postJsonToApi as postJsonToApi6
|
|
2169
2169
|
} from "@ai-sdk/provider-utils";
|
|
2170
|
-
import { z as
|
|
2170
|
+
import { z as z17 } from "zod/v4";
|
|
2171
2171
|
|
|
2172
2172
|
// src/responses/convert-to-openai-responses-messages.ts
|
|
2173
2173
|
import {
|
|
@@ -2372,18 +2372,18 @@ var openaiResponsesReasoningProviderOptionsSchema = z14.object({
|
|
|
2372
2372
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
2373
2373
|
function mapOpenAIResponseFinishReason({
|
|
2374
2374
|
finishReason,
|
|
2375
|
-
|
|
2375
|
+
hasFunctionCall
|
|
2376
2376
|
}) {
|
|
2377
2377
|
switch (finishReason) {
|
|
2378
2378
|
case void 0:
|
|
2379
2379
|
case null:
|
|
2380
|
-
return
|
|
2380
|
+
return hasFunctionCall ? "tool-calls" : "stop";
|
|
2381
2381
|
case "max_output_tokens":
|
|
2382
2382
|
return "length";
|
|
2383
2383
|
case "content_filter":
|
|
2384
2384
|
return "content-filter";
|
|
2385
2385
|
default:
|
|
2386
|
-
return
|
|
2386
|
+
return hasFunctionCall ? "tool-calls" : "unknown";
|
|
2387
2387
|
}
|
|
2388
2388
|
}
|
|
2389
2389
|
|
|
@@ -2409,6 +2409,44 @@ var codeInterpreter = createProviderDefinedToolFactory3({
|
|
|
2409
2409
|
inputSchema: z15.object({})
|
|
2410
2410
|
});
|
|
2411
2411
|
|
|
2412
|
+
// src/tool/web-search.ts
|
|
2413
|
+
import { createProviderDefinedToolFactory as createProviderDefinedToolFactory4 } from "@ai-sdk/provider-utils";
|
|
2414
|
+
import { z as z16 } from "zod/v4";
|
|
2415
|
+
var webSearchArgsSchema = z16.object({
|
|
2416
|
+
filters: z16.object({
|
|
2417
|
+
allowedDomains: z16.array(z16.string()).optional()
|
|
2418
|
+
}).optional(),
|
|
2419
|
+
searchContextSize: z16.enum(["low", "medium", "high"]).optional(),
|
|
2420
|
+
userLocation: z16.object({
|
|
2421
|
+
type: z16.literal("approximate"),
|
|
2422
|
+
country: z16.string().optional(),
|
|
2423
|
+
city: z16.string().optional(),
|
|
2424
|
+
region: z16.string().optional(),
|
|
2425
|
+
timezone: z16.string().optional()
|
|
2426
|
+
}).optional()
|
|
2427
|
+
});
|
|
2428
|
+
var factory = createProviderDefinedToolFactory4({
|
|
2429
|
+
id: "openai.web_search",
|
|
2430
|
+
name: "web_search",
|
|
2431
|
+
inputSchema: z16.object({
|
|
2432
|
+
action: z16.discriminatedUnion("type", [
|
|
2433
|
+
z16.object({
|
|
2434
|
+
type: z16.literal("search"),
|
|
2435
|
+
query: z16.string().nullish()
|
|
2436
|
+
}),
|
|
2437
|
+
z16.object({
|
|
2438
|
+
type: z16.literal("open_page"),
|
|
2439
|
+
url: z16.string()
|
|
2440
|
+
}),
|
|
2441
|
+
z16.object({
|
|
2442
|
+
type: z16.literal("find"),
|
|
2443
|
+
url: z16.string(),
|
|
2444
|
+
pattern: z16.string()
|
|
2445
|
+
})
|
|
2446
|
+
]).nullish()
|
|
2447
|
+
})
|
|
2448
|
+
});
|
|
2449
|
+
|
|
2412
2450
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2413
2451
|
function prepareResponsesTools({
|
|
2414
2452
|
tools,
|
|
@@ -2454,6 +2492,16 @@ function prepareResponsesTools({
|
|
|
2454
2492
|
});
|
|
2455
2493
|
break;
|
|
2456
2494
|
}
|
|
2495
|
+
case "openai.web_search": {
|
|
2496
|
+
const args = webSearchArgsSchema.parse(tool.args);
|
|
2497
|
+
openaiTools.push({
|
|
2498
|
+
type: "web_search",
|
|
2499
|
+
filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
|
|
2500
|
+
search_context_size: args.searchContextSize,
|
|
2501
|
+
user_location: args.userLocation
|
|
2502
|
+
});
|
|
2503
|
+
break;
|
|
2504
|
+
}
|
|
2457
2505
|
case "openai.code_interpreter": {
|
|
2458
2506
|
const args = codeInterpreterArgsSchema.parse(tool.args);
|
|
2459
2507
|
openaiTools.push({
|
|
@@ -2486,7 +2534,7 @@ function prepareResponsesTools({
|
|
|
2486
2534
|
case "tool":
|
|
2487
2535
|
return {
|
|
2488
2536
|
tools: openaiTools,
|
|
2489
|
-
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "web_search_preview" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
2537
|
+
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
2490
2538
|
toolWarnings
|
|
2491
2539
|
};
|
|
2492
2540
|
default: {
|
|
@@ -2499,35 +2547,35 @@ function prepareResponsesTools({
|
|
|
2499
2547
|
}
|
|
2500
2548
|
|
|
2501
2549
|
// src/responses/openai-responses-language-model.ts
|
|
2502
|
-
var webSearchCallItem =
|
|
2503
|
-
type:
|
|
2504
|
-
id:
|
|
2505
|
-
status:
|
|
2506
|
-
action:
|
|
2507
|
-
|
|
2508
|
-
type:
|
|
2509
|
-
query:
|
|
2550
|
+
var webSearchCallItem = z17.object({
|
|
2551
|
+
type: z17.literal("web_search_call"),
|
|
2552
|
+
id: z17.string(),
|
|
2553
|
+
status: z17.string(),
|
|
2554
|
+
action: z17.discriminatedUnion("type", [
|
|
2555
|
+
z17.object({
|
|
2556
|
+
type: z17.literal("search"),
|
|
2557
|
+
query: z17.string().nullish()
|
|
2510
2558
|
}),
|
|
2511
|
-
|
|
2512
|
-
type:
|
|
2513
|
-
url:
|
|
2559
|
+
z17.object({
|
|
2560
|
+
type: z17.literal("open_page"),
|
|
2561
|
+
url: z17.string()
|
|
2514
2562
|
}),
|
|
2515
|
-
|
|
2516
|
-
type:
|
|
2517
|
-
url:
|
|
2518
|
-
pattern:
|
|
2563
|
+
z17.object({
|
|
2564
|
+
type: z17.literal("find"),
|
|
2565
|
+
url: z17.string(),
|
|
2566
|
+
pattern: z17.string()
|
|
2519
2567
|
})
|
|
2520
2568
|
]).nullish()
|
|
2521
2569
|
});
|
|
2522
2570
|
var TOP_LOGPROBS_MAX = 20;
|
|
2523
|
-
var LOGPROBS_SCHEMA =
|
|
2524
|
-
|
|
2525
|
-
token:
|
|
2526
|
-
logprob:
|
|
2527
|
-
top_logprobs:
|
|
2528
|
-
|
|
2529
|
-
token:
|
|
2530
|
-
logprob:
|
|
2571
|
+
var LOGPROBS_SCHEMA = z17.array(
|
|
2572
|
+
z17.object({
|
|
2573
|
+
token: z17.string(),
|
|
2574
|
+
logprob: z17.number(),
|
|
2575
|
+
top_logprobs: z17.array(
|
|
2576
|
+
z17.object({
|
|
2577
|
+
token: z17.string(),
|
|
2578
|
+
logprob: z17.number()
|
|
2531
2579
|
})
|
|
2532
2580
|
)
|
|
2533
2581
|
})
|
|
@@ -2731,92 +2779,92 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2731
2779
|
body,
|
|
2732
2780
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2733
2781
|
successfulResponseHandler: createJsonResponseHandler6(
|
|
2734
|
-
|
|
2735
|
-
id:
|
|
2736
|
-
created_at:
|
|
2737
|
-
error:
|
|
2738
|
-
code:
|
|
2739
|
-
message:
|
|
2782
|
+
z17.object({
|
|
2783
|
+
id: z17.string(),
|
|
2784
|
+
created_at: z17.number(),
|
|
2785
|
+
error: z17.object({
|
|
2786
|
+
code: z17.string(),
|
|
2787
|
+
message: z17.string()
|
|
2740
2788
|
}).nullish(),
|
|
2741
|
-
model:
|
|
2742
|
-
output:
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
type:
|
|
2746
|
-
role:
|
|
2747
|
-
id:
|
|
2748
|
-
content:
|
|
2749
|
-
|
|
2750
|
-
type:
|
|
2751
|
-
text:
|
|
2789
|
+
model: z17.string(),
|
|
2790
|
+
output: z17.array(
|
|
2791
|
+
z17.discriminatedUnion("type", [
|
|
2792
|
+
z17.object({
|
|
2793
|
+
type: z17.literal("message"),
|
|
2794
|
+
role: z17.literal("assistant"),
|
|
2795
|
+
id: z17.string(),
|
|
2796
|
+
content: z17.array(
|
|
2797
|
+
z17.object({
|
|
2798
|
+
type: z17.literal("output_text"),
|
|
2799
|
+
text: z17.string(),
|
|
2752
2800
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2753
|
-
annotations:
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
type:
|
|
2757
|
-
start_index:
|
|
2758
|
-
end_index:
|
|
2759
|
-
url:
|
|
2760
|
-
title:
|
|
2801
|
+
annotations: z17.array(
|
|
2802
|
+
z17.discriminatedUnion("type", [
|
|
2803
|
+
z17.object({
|
|
2804
|
+
type: z17.literal("url_citation"),
|
|
2805
|
+
start_index: z17.number(),
|
|
2806
|
+
end_index: z17.number(),
|
|
2807
|
+
url: z17.string(),
|
|
2808
|
+
title: z17.string()
|
|
2761
2809
|
}),
|
|
2762
|
-
|
|
2763
|
-
type:
|
|
2764
|
-
file_id:
|
|
2765
|
-
filename:
|
|
2766
|
-
index:
|
|
2767
|
-
start_index:
|
|
2768
|
-
end_index:
|
|
2769
|
-
quote:
|
|
2810
|
+
z17.object({
|
|
2811
|
+
type: z17.literal("file_citation"),
|
|
2812
|
+
file_id: z17.string(),
|
|
2813
|
+
filename: z17.string().nullish(),
|
|
2814
|
+
index: z17.number().nullish(),
|
|
2815
|
+
start_index: z17.number().nullish(),
|
|
2816
|
+
end_index: z17.number().nullish(),
|
|
2817
|
+
quote: z17.string().nullish()
|
|
2770
2818
|
})
|
|
2771
2819
|
])
|
|
2772
2820
|
)
|
|
2773
2821
|
})
|
|
2774
2822
|
)
|
|
2775
2823
|
}),
|
|
2776
|
-
|
|
2777
|
-
type:
|
|
2778
|
-
call_id:
|
|
2779
|
-
name:
|
|
2780
|
-
arguments:
|
|
2781
|
-
id:
|
|
2824
|
+
z17.object({
|
|
2825
|
+
type: z17.literal("function_call"),
|
|
2826
|
+
call_id: z17.string(),
|
|
2827
|
+
name: z17.string(),
|
|
2828
|
+
arguments: z17.string(),
|
|
2829
|
+
id: z17.string()
|
|
2782
2830
|
}),
|
|
2783
2831
|
webSearchCallItem,
|
|
2784
|
-
|
|
2785
|
-
type:
|
|
2786
|
-
id:
|
|
2787
|
-
status:
|
|
2832
|
+
z17.object({
|
|
2833
|
+
type: z17.literal("computer_call"),
|
|
2834
|
+
id: z17.string(),
|
|
2835
|
+
status: z17.string().optional()
|
|
2788
2836
|
}),
|
|
2789
|
-
|
|
2790
|
-
type:
|
|
2791
|
-
id:
|
|
2792
|
-
status:
|
|
2793
|
-
queries:
|
|
2794
|
-
results:
|
|
2795
|
-
|
|
2796
|
-
attributes:
|
|
2797
|
-
file_id:
|
|
2798
|
-
filename:
|
|
2799
|
-
score:
|
|
2800
|
-
text:
|
|
2837
|
+
z17.object({
|
|
2838
|
+
type: z17.literal("file_search_call"),
|
|
2839
|
+
id: z17.string(),
|
|
2840
|
+
status: z17.string().optional(),
|
|
2841
|
+
queries: z17.array(z17.string()).nullish(),
|
|
2842
|
+
results: z17.array(
|
|
2843
|
+
z17.object({
|
|
2844
|
+
attributes: z17.object({
|
|
2845
|
+
file_id: z17.string(),
|
|
2846
|
+
filename: z17.string(),
|
|
2847
|
+
score: z17.number(),
|
|
2848
|
+
text: z17.string()
|
|
2801
2849
|
})
|
|
2802
2850
|
})
|
|
2803
2851
|
).nullish()
|
|
2804
2852
|
}),
|
|
2805
|
-
|
|
2806
|
-
type:
|
|
2807
|
-
id:
|
|
2808
|
-
encrypted_content:
|
|
2809
|
-
summary:
|
|
2810
|
-
|
|
2811
|
-
type:
|
|
2812
|
-
text:
|
|
2853
|
+
z17.object({
|
|
2854
|
+
type: z17.literal("reasoning"),
|
|
2855
|
+
id: z17.string(),
|
|
2856
|
+
encrypted_content: z17.string().nullish(),
|
|
2857
|
+
summary: z17.array(
|
|
2858
|
+
z17.object({
|
|
2859
|
+
type: z17.literal("summary_text"),
|
|
2860
|
+
text: z17.string()
|
|
2813
2861
|
})
|
|
2814
2862
|
)
|
|
2815
2863
|
})
|
|
2816
2864
|
])
|
|
2817
2865
|
),
|
|
2818
|
-
service_tier:
|
|
2819
|
-
incomplete_details:
|
|
2866
|
+
service_tier: z17.string().nullish(),
|
|
2867
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullable(),
|
|
2820
2868
|
usage: usageSchema2
|
|
2821
2869
|
})
|
|
2822
2870
|
),
|
|
@@ -2836,6 +2884,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2836
2884
|
}
|
|
2837
2885
|
const content = [];
|
|
2838
2886
|
const logprobs = [];
|
|
2887
|
+
let hasFunctionCall = false;
|
|
2839
2888
|
for (const part of response.output) {
|
|
2840
2889
|
switch (part.type) {
|
|
2841
2890
|
case "reasoning": {
|
|
@@ -2894,6 +2943,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2894
2943
|
break;
|
|
2895
2944
|
}
|
|
2896
2945
|
case "function_call": {
|
|
2946
|
+
hasFunctionCall = true;
|
|
2897
2947
|
content.push({
|
|
2898
2948
|
type: "tool-call",
|
|
2899
2949
|
toolCallId: part.call_id,
|
|
@@ -2981,7 +3031,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2981
3031
|
content,
|
|
2982
3032
|
finishReason: mapOpenAIResponseFinishReason({
|
|
2983
3033
|
finishReason: (_m = response.incomplete_details) == null ? void 0 : _m.reason,
|
|
2984
|
-
|
|
3034
|
+
hasFunctionCall
|
|
2985
3035
|
}),
|
|
2986
3036
|
usage: {
|
|
2987
3037
|
inputTokens: response.usage.input_tokens,
|
|
@@ -3031,7 +3081,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3031
3081
|
const logprobs = [];
|
|
3032
3082
|
let responseId = null;
|
|
3033
3083
|
const ongoingToolCalls = {};
|
|
3034
|
-
let
|
|
3084
|
+
let hasFunctionCall = false;
|
|
3035
3085
|
const activeReasoning = {};
|
|
3036
3086
|
let serviceTier;
|
|
3037
3087
|
return {
|
|
@@ -3121,7 +3171,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3121
3171
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
3122
3172
|
if (value.item.type === "function_call") {
|
|
3123
3173
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3124
|
-
|
|
3174
|
+
hasFunctionCall = true;
|
|
3125
3175
|
controller.enqueue({
|
|
3126
3176
|
type: "tool-input-end",
|
|
3127
3177
|
id: value.item.call_id
|
|
@@ -3139,7 +3189,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3139
3189
|
});
|
|
3140
3190
|
} else if (value.item.type === "web_search_call") {
|
|
3141
3191
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3142
|
-
hasToolCalls = true;
|
|
3143
3192
|
controller.enqueue({
|
|
3144
3193
|
type: "tool-input-end",
|
|
3145
3194
|
id: value.item.id
|
|
@@ -3147,20 +3196,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3147
3196
|
controller.enqueue({
|
|
3148
3197
|
type: "tool-call",
|
|
3149
3198
|
toolCallId: value.item.id,
|
|
3150
|
-
toolName: "
|
|
3199
|
+
toolName: "web_search",
|
|
3151
3200
|
input: JSON.stringify({ action: value.item.action }),
|
|
3152
3201
|
providerExecuted: true
|
|
3153
3202
|
});
|
|
3154
3203
|
controller.enqueue({
|
|
3155
3204
|
type: "tool-result",
|
|
3156
3205
|
toolCallId: value.item.id,
|
|
3157
|
-
toolName: "
|
|
3206
|
+
toolName: "web_search",
|
|
3158
3207
|
result: { status: value.item.status },
|
|
3159
3208
|
providerExecuted: true
|
|
3160
3209
|
});
|
|
3161
3210
|
} else if (value.item.type === "computer_call") {
|
|
3162
3211
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3163
|
-
hasToolCalls = true;
|
|
3164
3212
|
controller.enqueue({
|
|
3165
3213
|
type: "tool-input-end",
|
|
3166
3214
|
id: value.item.id
|
|
@@ -3184,7 +3232,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3184
3232
|
});
|
|
3185
3233
|
} else if (value.item.type === "file_search_call") {
|
|
3186
3234
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3187
|
-
hasToolCalls = true;
|
|
3188
3235
|
controller.enqueue({
|
|
3189
3236
|
type: "tool-input-end",
|
|
3190
3237
|
id: value.item.id
|
|
@@ -3285,7 +3332,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3285
3332
|
} else if (isResponseFinishedChunk(value)) {
|
|
3286
3333
|
finishReason = mapOpenAIResponseFinishReason({
|
|
3287
3334
|
finishReason: (_h = value.response.incomplete_details) == null ? void 0 : _h.reason,
|
|
3288
|
-
|
|
3335
|
+
hasFunctionCall
|
|
3289
3336
|
});
|
|
3290
3337
|
usage.inputTokens = value.response.usage.input_tokens;
|
|
3291
3338
|
usage.outputTokens = value.response.usage.output_tokens;
|
|
@@ -3344,176 +3391,176 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3344
3391
|
};
|
|
3345
3392
|
}
|
|
3346
3393
|
};
|
|
3347
|
-
var usageSchema2 =
|
|
3348
|
-
input_tokens:
|
|
3349
|
-
input_tokens_details:
|
|
3350
|
-
output_tokens:
|
|
3351
|
-
output_tokens_details:
|
|
3394
|
+
var usageSchema2 = z17.object({
|
|
3395
|
+
input_tokens: z17.number(),
|
|
3396
|
+
input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
|
|
3397
|
+
output_tokens: z17.number(),
|
|
3398
|
+
output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
|
|
3352
3399
|
});
|
|
3353
|
-
var textDeltaChunkSchema =
|
|
3354
|
-
type:
|
|
3355
|
-
item_id:
|
|
3356
|
-
delta:
|
|
3400
|
+
var textDeltaChunkSchema = z17.object({
|
|
3401
|
+
type: z17.literal("response.output_text.delta"),
|
|
3402
|
+
item_id: z17.string(),
|
|
3403
|
+
delta: z17.string(),
|
|
3357
3404
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3358
3405
|
});
|
|
3359
|
-
var errorChunkSchema =
|
|
3360
|
-
type:
|
|
3361
|
-
code:
|
|
3362
|
-
message:
|
|
3363
|
-
param:
|
|
3364
|
-
sequence_number:
|
|
3406
|
+
var errorChunkSchema = z17.object({
|
|
3407
|
+
type: z17.literal("error"),
|
|
3408
|
+
code: z17.string(),
|
|
3409
|
+
message: z17.string(),
|
|
3410
|
+
param: z17.string().nullish(),
|
|
3411
|
+
sequence_number: z17.number()
|
|
3365
3412
|
});
|
|
3366
|
-
var responseFinishedChunkSchema =
|
|
3367
|
-
type:
|
|
3368
|
-
response:
|
|
3369
|
-
incomplete_details:
|
|
3413
|
+
var responseFinishedChunkSchema = z17.object({
|
|
3414
|
+
type: z17.enum(["response.completed", "response.incomplete"]),
|
|
3415
|
+
response: z17.object({
|
|
3416
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
3370
3417
|
usage: usageSchema2,
|
|
3371
|
-
service_tier:
|
|
3418
|
+
service_tier: z17.string().nullish()
|
|
3372
3419
|
})
|
|
3373
3420
|
});
|
|
3374
|
-
var responseCreatedChunkSchema =
|
|
3375
|
-
type:
|
|
3376
|
-
response:
|
|
3377
|
-
id:
|
|
3378
|
-
created_at:
|
|
3379
|
-
model:
|
|
3380
|
-
service_tier:
|
|
3421
|
+
var responseCreatedChunkSchema = z17.object({
|
|
3422
|
+
type: z17.literal("response.created"),
|
|
3423
|
+
response: z17.object({
|
|
3424
|
+
id: z17.string(),
|
|
3425
|
+
created_at: z17.number(),
|
|
3426
|
+
model: z17.string(),
|
|
3427
|
+
service_tier: z17.string().nullish()
|
|
3381
3428
|
})
|
|
3382
3429
|
});
|
|
3383
|
-
var responseOutputItemAddedSchema =
|
|
3384
|
-
type:
|
|
3385
|
-
output_index:
|
|
3386
|
-
item:
|
|
3387
|
-
|
|
3388
|
-
type:
|
|
3389
|
-
id:
|
|
3430
|
+
var responseOutputItemAddedSchema = z17.object({
|
|
3431
|
+
type: z17.literal("response.output_item.added"),
|
|
3432
|
+
output_index: z17.number(),
|
|
3433
|
+
item: z17.discriminatedUnion("type", [
|
|
3434
|
+
z17.object({
|
|
3435
|
+
type: z17.literal("message"),
|
|
3436
|
+
id: z17.string()
|
|
3390
3437
|
}),
|
|
3391
|
-
|
|
3392
|
-
type:
|
|
3393
|
-
id:
|
|
3394
|
-
encrypted_content:
|
|
3438
|
+
z17.object({
|
|
3439
|
+
type: z17.literal("reasoning"),
|
|
3440
|
+
id: z17.string(),
|
|
3441
|
+
encrypted_content: z17.string().nullish()
|
|
3395
3442
|
}),
|
|
3396
|
-
|
|
3397
|
-
type:
|
|
3398
|
-
id:
|
|
3399
|
-
call_id:
|
|
3400
|
-
name:
|
|
3401
|
-
arguments:
|
|
3443
|
+
z17.object({
|
|
3444
|
+
type: z17.literal("function_call"),
|
|
3445
|
+
id: z17.string(),
|
|
3446
|
+
call_id: z17.string(),
|
|
3447
|
+
name: z17.string(),
|
|
3448
|
+
arguments: z17.string()
|
|
3402
3449
|
}),
|
|
3403
|
-
|
|
3404
|
-
type:
|
|
3405
|
-
id:
|
|
3406
|
-
status:
|
|
3407
|
-
action:
|
|
3408
|
-
type:
|
|
3409
|
-
query:
|
|
3450
|
+
z17.object({
|
|
3451
|
+
type: z17.literal("web_search_call"),
|
|
3452
|
+
id: z17.string(),
|
|
3453
|
+
status: z17.string(),
|
|
3454
|
+
action: z17.object({
|
|
3455
|
+
type: z17.literal("search"),
|
|
3456
|
+
query: z17.string().optional()
|
|
3410
3457
|
}).nullish()
|
|
3411
3458
|
}),
|
|
3412
|
-
|
|
3413
|
-
type:
|
|
3414
|
-
id:
|
|
3415
|
-
status:
|
|
3459
|
+
z17.object({
|
|
3460
|
+
type: z17.literal("computer_call"),
|
|
3461
|
+
id: z17.string(),
|
|
3462
|
+
status: z17.string()
|
|
3416
3463
|
}),
|
|
3417
|
-
|
|
3418
|
-
type:
|
|
3419
|
-
id:
|
|
3420
|
-
status:
|
|
3421
|
-
queries:
|
|
3422
|
-
results:
|
|
3423
|
-
|
|
3424
|
-
attributes:
|
|
3425
|
-
file_id:
|
|
3426
|
-
filename:
|
|
3427
|
-
score:
|
|
3428
|
-
text:
|
|
3464
|
+
z17.object({
|
|
3465
|
+
type: z17.literal("file_search_call"),
|
|
3466
|
+
id: z17.string(),
|
|
3467
|
+
status: z17.string(),
|
|
3468
|
+
queries: z17.array(z17.string()).nullish(),
|
|
3469
|
+
results: z17.array(
|
|
3470
|
+
z17.object({
|
|
3471
|
+
attributes: z17.object({
|
|
3472
|
+
file_id: z17.string(),
|
|
3473
|
+
filename: z17.string(),
|
|
3474
|
+
score: z17.number(),
|
|
3475
|
+
text: z17.string()
|
|
3429
3476
|
})
|
|
3430
3477
|
})
|
|
3431
3478
|
).optional()
|
|
3432
3479
|
})
|
|
3433
3480
|
])
|
|
3434
3481
|
});
|
|
3435
|
-
var responseOutputItemDoneSchema =
|
|
3436
|
-
type:
|
|
3437
|
-
output_index:
|
|
3438
|
-
item:
|
|
3439
|
-
|
|
3440
|
-
type:
|
|
3441
|
-
id:
|
|
3482
|
+
var responseOutputItemDoneSchema = z17.object({
|
|
3483
|
+
type: z17.literal("response.output_item.done"),
|
|
3484
|
+
output_index: z17.number(),
|
|
3485
|
+
item: z17.discriminatedUnion("type", [
|
|
3486
|
+
z17.object({
|
|
3487
|
+
type: z17.literal("message"),
|
|
3488
|
+
id: z17.string()
|
|
3442
3489
|
}),
|
|
3443
|
-
|
|
3444
|
-
type:
|
|
3445
|
-
id:
|
|
3446
|
-
encrypted_content:
|
|
3490
|
+
z17.object({
|
|
3491
|
+
type: z17.literal("reasoning"),
|
|
3492
|
+
id: z17.string(),
|
|
3493
|
+
encrypted_content: z17.string().nullish()
|
|
3447
3494
|
}),
|
|
3448
|
-
|
|
3449
|
-
type:
|
|
3450
|
-
id:
|
|
3451
|
-
call_id:
|
|
3452
|
-
name:
|
|
3453
|
-
arguments:
|
|
3454
|
-
status:
|
|
3495
|
+
z17.object({
|
|
3496
|
+
type: z17.literal("function_call"),
|
|
3497
|
+
id: z17.string(),
|
|
3498
|
+
call_id: z17.string(),
|
|
3499
|
+
name: z17.string(),
|
|
3500
|
+
arguments: z17.string(),
|
|
3501
|
+
status: z17.literal("completed")
|
|
3455
3502
|
}),
|
|
3456
3503
|
webSearchCallItem,
|
|
3457
|
-
|
|
3458
|
-
type:
|
|
3459
|
-
id:
|
|
3460
|
-
status:
|
|
3504
|
+
z17.object({
|
|
3505
|
+
type: z17.literal("computer_call"),
|
|
3506
|
+
id: z17.string(),
|
|
3507
|
+
status: z17.literal("completed")
|
|
3461
3508
|
}),
|
|
3462
|
-
|
|
3463
|
-
type:
|
|
3464
|
-
id:
|
|
3465
|
-
status:
|
|
3466
|
-
queries:
|
|
3467
|
-
results:
|
|
3468
|
-
|
|
3469
|
-
attributes:
|
|
3470
|
-
file_id:
|
|
3471
|
-
filename:
|
|
3472
|
-
score:
|
|
3473
|
-
text:
|
|
3509
|
+
z17.object({
|
|
3510
|
+
type: z17.literal("file_search_call"),
|
|
3511
|
+
id: z17.string(),
|
|
3512
|
+
status: z17.literal("completed"),
|
|
3513
|
+
queries: z17.array(z17.string()).nullish(),
|
|
3514
|
+
results: z17.array(
|
|
3515
|
+
z17.object({
|
|
3516
|
+
attributes: z17.object({
|
|
3517
|
+
file_id: z17.string(),
|
|
3518
|
+
filename: z17.string(),
|
|
3519
|
+
score: z17.number(),
|
|
3520
|
+
text: z17.string()
|
|
3474
3521
|
})
|
|
3475
3522
|
})
|
|
3476
3523
|
).nullish()
|
|
3477
3524
|
})
|
|
3478
3525
|
])
|
|
3479
3526
|
});
|
|
3480
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3481
|
-
type:
|
|
3482
|
-
item_id:
|
|
3483
|
-
output_index:
|
|
3484
|
-
delta:
|
|
3527
|
+
var responseFunctionCallArgumentsDeltaSchema = z17.object({
|
|
3528
|
+
type: z17.literal("response.function_call_arguments.delta"),
|
|
3529
|
+
item_id: z17.string(),
|
|
3530
|
+
output_index: z17.number(),
|
|
3531
|
+
delta: z17.string()
|
|
3485
3532
|
});
|
|
3486
|
-
var responseAnnotationAddedSchema =
|
|
3487
|
-
type:
|
|
3488
|
-
annotation:
|
|
3489
|
-
|
|
3490
|
-
type:
|
|
3491
|
-
url:
|
|
3492
|
-
title:
|
|
3533
|
+
var responseAnnotationAddedSchema = z17.object({
|
|
3534
|
+
type: z17.literal("response.output_text.annotation.added"),
|
|
3535
|
+
annotation: z17.discriminatedUnion("type", [
|
|
3536
|
+
z17.object({
|
|
3537
|
+
type: z17.literal("url_citation"),
|
|
3538
|
+
url: z17.string(),
|
|
3539
|
+
title: z17.string()
|
|
3493
3540
|
}),
|
|
3494
|
-
|
|
3495
|
-
type:
|
|
3496
|
-
file_id:
|
|
3497
|
-
filename:
|
|
3498
|
-
index:
|
|
3499
|
-
start_index:
|
|
3500
|
-
end_index:
|
|
3501
|
-
quote:
|
|
3541
|
+
z17.object({
|
|
3542
|
+
type: z17.literal("file_citation"),
|
|
3543
|
+
file_id: z17.string(),
|
|
3544
|
+
filename: z17.string().nullish(),
|
|
3545
|
+
index: z17.number().nullish(),
|
|
3546
|
+
start_index: z17.number().nullish(),
|
|
3547
|
+
end_index: z17.number().nullish(),
|
|
3548
|
+
quote: z17.string().nullish()
|
|
3502
3549
|
})
|
|
3503
3550
|
])
|
|
3504
3551
|
});
|
|
3505
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3506
|
-
type:
|
|
3507
|
-
item_id:
|
|
3508
|
-
summary_index:
|
|
3552
|
+
var responseReasoningSummaryPartAddedSchema = z17.object({
|
|
3553
|
+
type: z17.literal("response.reasoning_summary_part.added"),
|
|
3554
|
+
item_id: z17.string(),
|
|
3555
|
+
summary_index: z17.number()
|
|
3509
3556
|
});
|
|
3510
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3511
|
-
type:
|
|
3512
|
-
item_id:
|
|
3513
|
-
summary_index:
|
|
3514
|
-
delta:
|
|
3557
|
+
var responseReasoningSummaryTextDeltaSchema = z17.object({
|
|
3558
|
+
type: z17.literal("response.reasoning_summary_text.delta"),
|
|
3559
|
+
item_id: z17.string(),
|
|
3560
|
+
summary_index: z17.number(),
|
|
3561
|
+
delta: z17.string()
|
|
3515
3562
|
});
|
|
3516
|
-
var openaiResponsesChunkSchema =
|
|
3563
|
+
var openaiResponsesChunkSchema = z17.union([
|
|
3517
3564
|
textDeltaChunkSchema,
|
|
3518
3565
|
responseFinishedChunkSchema,
|
|
3519
3566
|
responseCreatedChunkSchema,
|
|
@@ -3524,7 +3571,7 @@ var openaiResponsesChunkSchema = z16.union([
|
|
|
3524
3571
|
responseReasoningSummaryPartAddedSchema,
|
|
3525
3572
|
responseReasoningSummaryTextDeltaSchema,
|
|
3526
3573
|
errorChunkSchema,
|
|
3527
|
-
|
|
3574
|
+
z17.object({ type: z17.string() }).loose()
|
|
3528
3575
|
// fallback for unknown chunks
|
|
3529
3576
|
]);
|
|
3530
3577
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3597,27 +3644,27 @@ function getResponsesModelConfig(modelId) {
|
|
|
3597
3644
|
isReasoningModel: false
|
|
3598
3645
|
};
|
|
3599
3646
|
}
|
|
3600
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3601
|
-
metadata:
|
|
3602
|
-
parallelToolCalls:
|
|
3603
|
-
previousResponseId:
|
|
3604
|
-
store:
|
|
3605
|
-
user:
|
|
3606
|
-
reasoningEffort:
|
|
3607
|
-
strictJsonSchema:
|
|
3608
|
-
instructions:
|
|
3609
|
-
reasoningSummary:
|
|
3610
|
-
serviceTier:
|
|
3611
|
-
include:
|
|
3612
|
-
|
|
3647
|
+
var openaiResponsesProviderOptionsSchema = z17.object({
|
|
3648
|
+
metadata: z17.any().nullish(),
|
|
3649
|
+
parallelToolCalls: z17.boolean().nullish(),
|
|
3650
|
+
previousResponseId: z17.string().nullish(),
|
|
3651
|
+
store: z17.boolean().nullish(),
|
|
3652
|
+
user: z17.string().nullish(),
|
|
3653
|
+
reasoningEffort: z17.string().nullish(),
|
|
3654
|
+
strictJsonSchema: z17.boolean().nullish(),
|
|
3655
|
+
instructions: z17.string().nullish(),
|
|
3656
|
+
reasoningSummary: z17.string().nullish(),
|
|
3657
|
+
serviceTier: z17.enum(["auto", "flex", "priority"]).nullish(),
|
|
3658
|
+
include: z17.array(
|
|
3659
|
+
z17.enum([
|
|
3613
3660
|
"reasoning.encrypted_content",
|
|
3614
3661
|
"file_search_call.results",
|
|
3615
3662
|
"message.output_text.logprobs"
|
|
3616
3663
|
])
|
|
3617
3664
|
).nullish(),
|
|
3618
|
-
textVerbosity:
|
|
3619
|
-
promptCacheKey:
|
|
3620
|
-
safetyIdentifier:
|
|
3665
|
+
textVerbosity: z17.enum(["low", "medium", "high"]).nullish(),
|
|
3666
|
+
promptCacheKey: z17.string().nullish(),
|
|
3667
|
+
safetyIdentifier: z17.string().nullish(),
|
|
3621
3668
|
/**
|
|
3622
3669
|
* Return the log probabilities of the tokens.
|
|
3623
3670
|
*
|
|
@@ -3630,7 +3677,7 @@ var openaiResponsesProviderOptionsSchema = z16.object({
|
|
|
3630
3677
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3631
3678
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3632
3679
|
*/
|
|
3633
|
-
logprobs:
|
|
3680
|
+
logprobs: z17.union([z17.boolean(), z17.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
|
|
3634
3681
|
});
|
|
3635
3682
|
export {
|
|
3636
3683
|
OpenAIChatLanguageModel,
|