@ai-sdk/openai 2.0.24 → 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 +13 -0
- package/dist/index.d.mts +47 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +378 -321
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +347 -290
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +317 -264
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +305 -252
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.mjs
CHANGED
|
@@ -1955,7 +1955,13 @@ var OpenAITranscriptionModel = class {
|
|
|
1955
1955
|
};
|
|
1956
1956
|
for (const [key, value] of Object.entries(transcriptionModelOptions)) {
|
|
1957
1957
|
if (value != null) {
|
|
1958
|
-
|
|
1958
|
+
if (Array.isArray(value)) {
|
|
1959
|
+
for (const item of value) {
|
|
1960
|
+
formData.append(`${key}[]`, String(item));
|
|
1961
|
+
}
|
|
1962
|
+
} else {
|
|
1963
|
+
formData.append(key, String(value));
|
|
1964
|
+
}
|
|
1959
1965
|
}
|
|
1960
1966
|
}
|
|
1961
1967
|
}
|
|
@@ -2161,7 +2167,7 @@ import {
|
|
|
2161
2167
|
parseProviderOptions as parseProviderOptions7,
|
|
2162
2168
|
postJsonToApi as postJsonToApi6
|
|
2163
2169
|
} from "@ai-sdk/provider-utils";
|
|
2164
|
-
import { z as
|
|
2170
|
+
import { z as z17 } from "zod/v4";
|
|
2165
2171
|
|
|
2166
2172
|
// src/responses/convert-to-openai-responses-messages.ts
|
|
2167
2173
|
import {
|
|
@@ -2366,18 +2372,18 @@ var openaiResponsesReasoningProviderOptionsSchema = z14.object({
|
|
|
2366
2372
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
2367
2373
|
function mapOpenAIResponseFinishReason({
|
|
2368
2374
|
finishReason,
|
|
2369
|
-
|
|
2375
|
+
hasFunctionCall
|
|
2370
2376
|
}) {
|
|
2371
2377
|
switch (finishReason) {
|
|
2372
2378
|
case void 0:
|
|
2373
2379
|
case null:
|
|
2374
|
-
return
|
|
2380
|
+
return hasFunctionCall ? "tool-calls" : "stop";
|
|
2375
2381
|
case "max_output_tokens":
|
|
2376
2382
|
return "length";
|
|
2377
2383
|
case "content_filter":
|
|
2378
2384
|
return "content-filter";
|
|
2379
2385
|
default:
|
|
2380
|
-
return
|
|
2386
|
+
return hasFunctionCall ? "tool-calls" : "unknown";
|
|
2381
2387
|
}
|
|
2382
2388
|
}
|
|
2383
2389
|
|
|
@@ -2403,6 +2409,44 @@ var codeInterpreter = createProviderDefinedToolFactory3({
|
|
|
2403
2409
|
inputSchema: z15.object({})
|
|
2404
2410
|
});
|
|
2405
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
|
+
|
|
2406
2450
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2407
2451
|
function prepareResponsesTools({
|
|
2408
2452
|
tools,
|
|
@@ -2448,6 +2492,16 @@ function prepareResponsesTools({
|
|
|
2448
2492
|
});
|
|
2449
2493
|
break;
|
|
2450
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
|
+
}
|
|
2451
2505
|
case "openai.code_interpreter": {
|
|
2452
2506
|
const args = codeInterpreterArgsSchema.parse(tool.args);
|
|
2453
2507
|
openaiTools.push({
|
|
@@ -2480,7 +2534,7 @@ function prepareResponsesTools({
|
|
|
2480
2534
|
case "tool":
|
|
2481
2535
|
return {
|
|
2482
2536
|
tools: openaiTools,
|
|
2483
|
-
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 },
|
|
2484
2538
|
toolWarnings
|
|
2485
2539
|
};
|
|
2486
2540
|
default: {
|
|
@@ -2493,35 +2547,35 @@ function prepareResponsesTools({
|
|
|
2493
2547
|
}
|
|
2494
2548
|
|
|
2495
2549
|
// src/responses/openai-responses-language-model.ts
|
|
2496
|
-
var webSearchCallItem =
|
|
2497
|
-
type:
|
|
2498
|
-
id:
|
|
2499
|
-
status:
|
|
2500
|
-
action:
|
|
2501
|
-
|
|
2502
|
-
type:
|
|
2503
|
-
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()
|
|
2504
2558
|
}),
|
|
2505
|
-
|
|
2506
|
-
type:
|
|
2507
|
-
url:
|
|
2559
|
+
z17.object({
|
|
2560
|
+
type: z17.literal("open_page"),
|
|
2561
|
+
url: z17.string()
|
|
2508
2562
|
}),
|
|
2509
|
-
|
|
2510
|
-
type:
|
|
2511
|
-
url:
|
|
2512
|
-
pattern:
|
|
2563
|
+
z17.object({
|
|
2564
|
+
type: z17.literal("find"),
|
|
2565
|
+
url: z17.string(),
|
|
2566
|
+
pattern: z17.string()
|
|
2513
2567
|
})
|
|
2514
2568
|
]).nullish()
|
|
2515
2569
|
});
|
|
2516
2570
|
var TOP_LOGPROBS_MAX = 20;
|
|
2517
|
-
var LOGPROBS_SCHEMA =
|
|
2518
|
-
|
|
2519
|
-
token:
|
|
2520
|
-
logprob:
|
|
2521
|
-
top_logprobs:
|
|
2522
|
-
|
|
2523
|
-
token:
|
|
2524
|
-
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()
|
|
2525
2579
|
})
|
|
2526
2580
|
)
|
|
2527
2581
|
})
|
|
@@ -2725,92 +2779,92 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2725
2779
|
body,
|
|
2726
2780
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2727
2781
|
successfulResponseHandler: createJsonResponseHandler6(
|
|
2728
|
-
|
|
2729
|
-
id:
|
|
2730
|
-
created_at:
|
|
2731
|
-
error:
|
|
2732
|
-
code:
|
|
2733
|
-
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()
|
|
2734
2788
|
}).nullish(),
|
|
2735
|
-
model:
|
|
2736
|
-
output:
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
type:
|
|
2740
|
-
role:
|
|
2741
|
-
id:
|
|
2742
|
-
content:
|
|
2743
|
-
|
|
2744
|
-
type:
|
|
2745
|
-
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(),
|
|
2746
2800
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2747
|
-
annotations:
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
type:
|
|
2751
|
-
start_index:
|
|
2752
|
-
end_index:
|
|
2753
|
-
url:
|
|
2754
|
-
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()
|
|
2755
2809
|
}),
|
|
2756
|
-
|
|
2757
|
-
type:
|
|
2758
|
-
file_id:
|
|
2759
|
-
filename:
|
|
2760
|
-
index:
|
|
2761
|
-
start_index:
|
|
2762
|
-
end_index:
|
|
2763
|
-
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()
|
|
2764
2818
|
})
|
|
2765
2819
|
])
|
|
2766
2820
|
)
|
|
2767
2821
|
})
|
|
2768
2822
|
)
|
|
2769
2823
|
}),
|
|
2770
|
-
|
|
2771
|
-
type:
|
|
2772
|
-
call_id:
|
|
2773
|
-
name:
|
|
2774
|
-
arguments:
|
|
2775
|
-
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()
|
|
2776
2830
|
}),
|
|
2777
2831
|
webSearchCallItem,
|
|
2778
|
-
|
|
2779
|
-
type:
|
|
2780
|
-
id:
|
|
2781
|
-
status:
|
|
2832
|
+
z17.object({
|
|
2833
|
+
type: z17.literal("computer_call"),
|
|
2834
|
+
id: z17.string(),
|
|
2835
|
+
status: z17.string().optional()
|
|
2782
2836
|
}),
|
|
2783
|
-
|
|
2784
|
-
type:
|
|
2785
|
-
id:
|
|
2786
|
-
status:
|
|
2787
|
-
queries:
|
|
2788
|
-
results:
|
|
2789
|
-
|
|
2790
|
-
attributes:
|
|
2791
|
-
file_id:
|
|
2792
|
-
filename:
|
|
2793
|
-
score:
|
|
2794
|
-
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()
|
|
2795
2849
|
})
|
|
2796
2850
|
})
|
|
2797
2851
|
).nullish()
|
|
2798
2852
|
}),
|
|
2799
|
-
|
|
2800
|
-
type:
|
|
2801
|
-
id:
|
|
2802
|
-
encrypted_content:
|
|
2803
|
-
summary:
|
|
2804
|
-
|
|
2805
|
-
type:
|
|
2806
|
-
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()
|
|
2807
2861
|
})
|
|
2808
2862
|
)
|
|
2809
2863
|
})
|
|
2810
2864
|
])
|
|
2811
2865
|
),
|
|
2812
|
-
service_tier:
|
|
2813
|
-
incomplete_details:
|
|
2866
|
+
service_tier: z17.string().nullish(),
|
|
2867
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullable(),
|
|
2814
2868
|
usage: usageSchema2
|
|
2815
2869
|
})
|
|
2816
2870
|
),
|
|
@@ -2830,6 +2884,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2830
2884
|
}
|
|
2831
2885
|
const content = [];
|
|
2832
2886
|
const logprobs = [];
|
|
2887
|
+
let hasFunctionCall = false;
|
|
2833
2888
|
for (const part of response.output) {
|
|
2834
2889
|
switch (part.type) {
|
|
2835
2890
|
case "reasoning": {
|
|
@@ -2888,6 +2943,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2888
2943
|
break;
|
|
2889
2944
|
}
|
|
2890
2945
|
case "function_call": {
|
|
2946
|
+
hasFunctionCall = true;
|
|
2891
2947
|
content.push({
|
|
2892
2948
|
type: "tool-call",
|
|
2893
2949
|
toolCallId: part.call_id,
|
|
@@ -2975,7 +3031,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2975
3031
|
content,
|
|
2976
3032
|
finishReason: mapOpenAIResponseFinishReason({
|
|
2977
3033
|
finishReason: (_m = response.incomplete_details) == null ? void 0 : _m.reason,
|
|
2978
|
-
|
|
3034
|
+
hasFunctionCall
|
|
2979
3035
|
}),
|
|
2980
3036
|
usage: {
|
|
2981
3037
|
inputTokens: response.usage.input_tokens,
|
|
@@ -3025,7 +3081,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3025
3081
|
const logprobs = [];
|
|
3026
3082
|
let responseId = null;
|
|
3027
3083
|
const ongoingToolCalls = {};
|
|
3028
|
-
let
|
|
3084
|
+
let hasFunctionCall = false;
|
|
3029
3085
|
const activeReasoning = {};
|
|
3030
3086
|
let serviceTier;
|
|
3031
3087
|
return {
|
|
@@ -3115,7 +3171,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3115
3171
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
3116
3172
|
if (value.item.type === "function_call") {
|
|
3117
3173
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3118
|
-
|
|
3174
|
+
hasFunctionCall = true;
|
|
3119
3175
|
controller.enqueue({
|
|
3120
3176
|
type: "tool-input-end",
|
|
3121
3177
|
id: value.item.call_id
|
|
@@ -3133,7 +3189,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3133
3189
|
});
|
|
3134
3190
|
} else if (value.item.type === "web_search_call") {
|
|
3135
3191
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3136
|
-
hasToolCalls = true;
|
|
3137
3192
|
controller.enqueue({
|
|
3138
3193
|
type: "tool-input-end",
|
|
3139
3194
|
id: value.item.id
|
|
@@ -3141,20 +3196,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3141
3196
|
controller.enqueue({
|
|
3142
3197
|
type: "tool-call",
|
|
3143
3198
|
toolCallId: value.item.id,
|
|
3144
|
-
toolName: "
|
|
3199
|
+
toolName: "web_search",
|
|
3145
3200
|
input: JSON.stringify({ action: value.item.action }),
|
|
3146
3201
|
providerExecuted: true
|
|
3147
3202
|
});
|
|
3148
3203
|
controller.enqueue({
|
|
3149
3204
|
type: "tool-result",
|
|
3150
3205
|
toolCallId: value.item.id,
|
|
3151
|
-
toolName: "
|
|
3206
|
+
toolName: "web_search",
|
|
3152
3207
|
result: { status: value.item.status },
|
|
3153
3208
|
providerExecuted: true
|
|
3154
3209
|
});
|
|
3155
3210
|
} else if (value.item.type === "computer_call") {
|
|
3156
3211
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3157
|
-
hasToolCalls = true;
|
|
3158
3212
|
controller.enqueue({
|
|
3159
3213
|
type: "tool-input-end",
|
|
3160
3214
|
id: value.item.id
|
|
@@ -3178,7 +3232,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3178
3232
|
});
|
|
3179
3233
|
} else if (value.item.type === "file_search_call") {
|
|
3180
3234
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3181
|
-
hasToolCalls = true;
|
|
3182
3235
|
controller.enqueue({
|
|
3183
3236
|
type: "tool-input-end",
|
|
3184
3237
|
id: value.item.id
|
|
@@ -3279,7 +3332,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3279
3332
|
} else if (isResponseFinishedChunk(value)) {
|
|
3280
3333
|
finishReason = mapOpenAIResponseFinishReason({
|
|
3281
3334
|
finishReason: (_h = value.response.incomplete_details) == null ? void 0 : _h.reason,
|
|
3282
|
-
|
|
3335
|
+
hasFunctionCall
|
|
3283
3336
|
});
|
|
3284
3337
|
usage.inputTokens = value.response.usage.input_tokens;
|
|
3285
3338
|
usage.outputTokens = value.response.usage.output_tokens;
|
|
@@ -3338,176 +3391,176 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3338
3391
|
};
|
|
3339
3392
|
}
|
|
3340
3393
|
};
|
|
3341
|
-
var usageSchema2 =
|
|
3342
|
-
input_tokens:
|
|
3343
|
-
input_tokens_details:
|
|
3344
|
-
output_tokens:
|
|
3345
|
-
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()
|
|
3346
3399
|
});
|
|
3347
|
-
var textDeltaChunkSchema =
|
|
3348
|
-
type:
|
|
3349
|
-
item_id:
|
|
3350
|
-
delta:
|
|
3400
|
+
var textDeltaChunkSchema = z17.object({
|
|
3401
|
+
type: z17.literal("response.output_text.delta"),
|
|
3402
|
+
item_id: z17.string(),
|
|
3403
|
+
delta: z17.string(),
|
|
3351
3404
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3352
3405
|
});
|
|
3353
|
-
var errorChunkSchema =
|
|
3354
|
-
type:
|
|
3355
|
-
code:
|
|
3356
|
-
message:
|
|
3357
|
-
param:
|
|
3358
|
-
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()
|
|
3359
3412
|
});
|
|
3360
|
-
var responseFinishedChunkSchema =
|
|
3361
|
-
type:
|
|
3362
|
-
response:
|
|
3363
|
-
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(),
|
|
3364
3417
|
usage: usageSchema2,
|
|
3365
|
-
service_tier:
|
|
3418
|
+
service_tier: z17.string().nullish()
|
|
3366
3419
|
})
|
|
3367
3420
|
});
|
|
3368
|
-
var responseCreatedChunkSchema =
|
|
3369
|
-
type:
|
|
3370
|
-
response:
|
|
3371
|
-
id:
|
|
3372
|
-
created_at:
|
|
3373
|
-
model:
|
|
3374
|
-
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()
|
|
3375
3428
|
})
|
|
3376
3429
|
});
|
|
3377
|
-
var responseOutputItemAddedSchema =
|
|
3378
|
-
type:
|
|
3379
|
-
output_index:
|
|
3380
|
-
item:
|
|
3381
|
-
|
|
3382
|
-
type:
|
|
3383
|
-
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()
|
|
3384
3437
|
}),
|
|
3385
|
-
|
|
3386
|
-
type:
|
|
3387
|
-
id:
|
|
3388
|
-
encrypted_content:
|
|
3438
|
+
z17.object({
|
|
3439
|
+
type: z17.literal("reasoning"),
|
|
3440
|
+
id: z17.string(),
|
|
3441
|
+
encrypted_content: z17.string().nullish()
|
|
3389
3442
|
}),
|
|
3390
|
-
|
|
3391
|
-
type:
|
|
3392
|
-
id:
|
|
3393
|
-
call_id:
|
|
3394
|
-
name:
|
|
3395
|
-
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()
|
|
3396
3449
|
}),
|
|
3397
|
-
|
|
3398
|
-
type:
|
|
3399
|
-
id:
|
|
3400
|
-
status:
|
|
3401
|
-
action:
|
|
3402
|
-
type:
|
|
3403
|
-
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()
|
|
3404
3457
|
}).nullish()
|
|
3405
3458
|
}),
|
|
3406
|
-
|
|
3407
|
-
type:
|
|
3408
|
-
id:
|
|
3409
|
-
status:
|
|
3459
|
+
z17.object({
|
|
3460
|
+
type: z17.literal("computer_call"),
|
|
3461
|
+
id: z17.string(),
|
|
3462
|
+
status: z17.string()
|
|
3410
3463
|
}),
|
|
3411
|
-
|
|
3412
|
-
type:
|
|
3413
|
-
id:
|
|
3414
|
-
status:
|
|
3415
|
-
queries:
|
|
3416
|
-
results:
|
|
3417
|
-
|
|
3418
|
-
attributes:
|
|
3419
|
-
file_id:
|
|
3420
|
-
filename:
|
|
3421
|
-
score:
|
|
3422
|
-
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()
|
|
3423
3476
|
})
|
|
3424
3477
|
})
|
|
3425
3478
|
).optional()
|
|
3426
3479
|
})
|
|
3427
3480
|
])
|
|
3428
3481
|
});
|
|
3429
|
-
var responseOutputItemDoneSchema =
|
|
3430
|
-
type:
|
|
3431
|
-
output_index:
|
|
3432
|
-
item:
|
|
3433
|
-
|
|
3434
|
-
type:
|
|
3435
|
-
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()
|
|
3436
3489
|
}),
|
|
3437
|
-
|
|
3438
|
-
type:
|
|
3439
|
-
id:
|
|
3440
|
-
encrypted_content:
|
|
3490
|
+
z17.object({
|
|
3491
|
+
type: z17.literal("reasoning"),
|
|
3492
|
+
id: z17.string(),
|
|
3493
|
+
encrypted_content: z17.string().nullish()
|
|
3441
3494
|
}),
|
|
3442
|
-
|
|
3443
|
-
type:
|
|
3444
|
-
id:
|
|
3445
|
-
call_id:
|
|
3446
|
-
name:
|
|
3447
|
-
arguments:
|
|
3448
|
-
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")
|
|
3449
3502
|
}),
|
|
3450
3503
|
webSearchCallItem,
|
|
3451
|
-
|
|
3452
|
-
type:
|
|
3453
|
-
id:
|
|
3454
|
-
status:
|
|
3504
|
+
z17.object({
|
|
3505
|
+
type: z17.literal("computer_call"),
|
|
3506
|
+
id: z17.string(),
|
|
3507
|
+
status: z17.literal("completed")
|
|
3455
3508
|
}),
|
|
3456
|
-
|
|
3457
|
-
type:
|
|
3458
|
-
id:
|
|
3459
|
-
status:
|
|
3460
|
-
queries:
|
|
3461
|
-
results:
|
|
3462
|
-
|
|
3463
|
-
attributes:
|
|
3464
|
-
file_id:
|
|
3465
|
-
filename:
|
|
3466
|
-
score:
|
|
3467
|
-
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()
|
|
3468
3521
|
})
|
|
3469
3522
|
})
|
|
3470
3523
|
).nullish()
|
|
3471
3524
|
})
|
|
3472
3525
|
])
|
|
3473
3526
|
});
|
|
3474
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3475
|
-
type:
|
|
3476
|
-
item_id:
|
|
3477
|
-
output_index:
|
|
3478
|
-
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()
|
|
3479
3532
|
});
|
|
3480
|
-
var responseAnnotationAddedSchema =
|
|
3481
|
-
type:
|
|
3482
|
-
annotation:
|
|
3483
|
-
|
|
3484
|
-
type:
|
|
3485
|
-
url:
|
|
3486
|
-
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()
|
|
3487
3540
|
}),
|
|
3488
|
-
|
|
3489
|
-
type:
|
|
3490
|
-
file_id:
|
|
3491
|
-
filename:
|
|
3492
|
-
index:
|
|
3493
|
-
start_index:
|
|
3494
|
-
end_index:
|
|
3495
|
-
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()
|
|
3496
3549
|
})
|
|
3497
3550
|
])
|
|
3498
3551
|
});
|
|
3499
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3500
|
-
type:
|
|
3501
|
-
item_id:
|
|
3502
|
-
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()
|
|
3503
3556
|
});
|
|
3504
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3505
|
-
type:
|
|
3506
|
-
item_id:
|
|
3507
|
-
summary_index:
|
|
3508
|
-
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()
|
|
3509
3562
|
});
|
|
3510
|
-
var openaiResponsesChunkSchema =
|
|
3563
|
+
var openaiResponsesChunkSchema = z17.union([
|
|
3511
3564
|
textDeltaChunkSchema,
|
|
3512
3565
|
responseFinishedChunkSchema,
|
|
3513
3566
|
responseCreatedChunkSchema,
|
|
@@ -3518,7 +3571,7 @@ var openaiResponsesChunkSchema = z16.union([
|
|
|
3518
3571
|
responseReasoningSummaryPartAddedSchema,
|
|
3519
3572
|
responseReasoningSummaryTextDeltaSchema,
|
|
3520
3573
|
errorChunkSchema,
|
|
3521
|
-
|
|
3574
|
+
z17.object({ type: z17.string() }).loose()
|
|
3522
3575
|
// fallback for unknown chunks
|
|
3523
3576
|
]);
|
|
3524
3577
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3591,27 +3644,27 @@ function getResponsesModelConfig(modelId) {
|
|
|
3591
3644
|
isReasoningModel: false
|
|
3592
3645
|
};
|
|
3593
3646
|
}
|
|
3594
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3595
|
-
metadata:
|
|
3596
|
-
parallelToolCalls:
|
|
3597
|
-
previousResponseId:
|
|
3598
|
-
store:
|
|
3599
|
-
user:
|
|
3600
|
-
reasoningEffort:
|
|
3601
|
-
strictJsonSchema:
|
|
3602
|
-
instructions:
|
|
3603
|
-
reasoningSummary:
|
|
3604
|
-
serviceTier:
|
|
3605
|
-
include:
|
|
3606
|
-
|
|
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([
|
|
3607
3660
|
"reasoning.encrypted_content",
|
|
3608
3661
|
"file_search_call.results",
|
|
3609
3662
|
"message.output_text.logprobs"
|
|
3610
3663
|
])
|
|
3611
3664
|
).nullish(),
|
|
3612
|
-
textVerbosity:
|
|
3613
|
-
promptCacheKey:
|
|
3614
|
-
safetyIdentifier:
|
|
3665
|
+
textVerbosity: z17.enum(["low", "medium", "high"]).nullish(),
|
|
3666
|
+
promptCacheKey: z17.string().nullish(),
|
|
3667
|
+
safetyIdentifier: z17.string().nullish(),
|
|
3615
3668
|
/**
|
|
3616
3669
|
* Return the log probabilities of the tokens.
|
|
3617
3670
|
*
|
|
@@ -3624,7 +3677,7 @@ var openaiResponsesProviderOptionsSchema = z16.object({
|
|
|
3624
3677
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3625
3678
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3626
3679
|
*/
|
|
3627
|
-
logprobs:
|
|
3680
|
+
logprobs: z17.union([z17.boolean(), z17.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
|
|
3628
3681
|
});
|
|
3629
3682
|
export {
|
|
3630
3683
|
OpenAIChatLanguageModel,
|