@ai-sdk/openai 2.0.25 → 2.0.27
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 +114 -1
- package/dist/index.d.ts +114 -1
- package/dist/index.js +413 -332
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +382 -301
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +310 -275
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +298 -263
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.mjs
CHANGED
|
@@ -353,23 +353,11 @@ var compoundFilterSchema = z3.object({
|
|
|
353
353
|
});
|
|
354
354
|
var filtersSchema = z3.union([comparisonFilterSchema, compoundFilterSchema]);
|
|
355
355
|
var fileSearchArgsSchema = z3.object({
|
|
356
|
-
/**
|
|
357
|
-
* List of vector store IDs to search through. If not provided, searches all available vector stores.
|
|
358
|
-
*/
|
|
359
356
|
vectorStoreIds: z3.array(z3.string()).optional(),
|
|
360
|
-
/**
|
|
361
|
-
* Maximum number of search results to return. Defaults to 10.
|
|
362
|
-
*/
|
|
363
357
|
maxNumResults: z3.number().optional(),
|
|
364
|
-
/**
|
|
365
|
-
* Ranking options for the search.
|
|
366
|
-
*/
|
|
367
358
|
ranking: z3.object({
|
|
368
359
|
ranker: z3.enum(["auto", "default-2024-08-21"]).optional()
|
|
369
360
|
}).optional(),
|
|
370
|
-
/**
|
|
371
|
-
* A filter to apply based on file attributes.
|
|
372
|
-
*/
|
|
373
361
|
filters: filtersSchema.optional()
|
|
374
362
|
});
|
|
375
363
|
var fileSearch = createProviderDefinedToolFactory({
|
|
@@ -2167,7 +2155,7 @@ import {
|
|
|
2167
2155
|
parseProviderOptions as parseProviderOptions7,
|
|
2168
2156
|
postJsonToApi as postJsonToApi6
|
|
2169
2157
|
} from "@ai-sdk/provider-utils";
|
|
2170
|
-
import { z as
|
|
2158
|
+
import { z as z17 } from "zod/v4";
|
|
2171
2159
|
|
|
2172
2160
|
// src/responses/convert-to-openai-responses-messages.ts
|
|
2173
2161
|
import {
|
|
@@ -2372,18 +2360,18 @@ var openaiResponsesReasoningProviderOptionsSchema = z14.object({
|
|
|
2372
2360
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
2373
2361
|
function mapOpenAIResponseFinishReason({
|
|
2374
2362
|
finishReason,
|
|
2375
|
-
|
|
2363
|
+
hasFunctionCall
|
|
2376
2364
|
}) {
|
|
2377
2365
|
switch (finishReason) {
|
|
2378
2366
|
case void 0:
|
|
2379
2367
|
case null:
|
|
2380
|
-
return
|
|
2368
|
+
return hasFunctionCall ? "tool-calls" : "stop";
|
|
2381
2369
|
case "max_output_tokens":
|
|
2382
2370
|
return "length";
|
|
2383
2371
|
case "content_filter":
|
|
2384
2372
|
return "content-filter";
|
|
2385
2373
|
default:
|
|
2386
|
-
return
|
|
2374
|
+
return hasFunctionCall ? "tool-calls" : "unknown";
|
|
2387
2375
|
}
|
|
2388
2376
|
}
|
|
2389
2377
|
|
|
@@ -2409,6 +2397,44 @@ var codeInterpreter = createProviderDefinedToolFactory3({
|
|
|
2409
2397
|
inputSchema: z15.object({})
|
|
2410
2398
|
});
|
|
2411
2399
|
|
|
2400
|
+
// src/tool/web-search.ts
|
|
2401
|
+
import { createProviderDefinedToolFactory as createProviderDefinedToolFactory4 } from "@ai-sdk/provider-utils";
|
|
2402
|
+
import { z as z16 } from "zod/v4";
|
|
2403
|
+
var webSearchArgsSchema = z16.object({
|
|
2404
|
+
filters: z16.object({
|
|
2405
|
+
allowedDomains: z16.array(z16.string()).optional()
|
|
2406
|
+
}).optional(),
|
|
2407
|
+
searchContextSize: z16.enum(["low", "medium", "high"]).optional(),
|
|
2408
|
+
userLocation: z16.object({
|
|
2409
|
+
type: z16.literal("approximate"),
|
|
2410
|
+
country: z16.string().optional(),
|
|
2411
|
+
city: z16.string().optional(),
|
|
2412
|
+
region: z16.string().optional(),
|
|
2413
|
+
timezone: z16.string().optional()
|
|
2414
|
+
}).optional()
|
|
2415
|
+
});
|
|
2416
|
+
var factory = createProviderDefinedToolFactory4({
|
|
2417
|
+
id: "openai.web_search",
|
|
2418
|
+
name: "web_search",
|
|
2419
|
+
inputSchema: z16.object({
|
|
2420
|
+
action: z16.discriminatedUnion("type", [
|
|
2421
|
+
z16.object({
|
|
2422
|
+
type: z16.literal("search"),
|
|
2423
|
+
query: z16.string().nullish()
|
|
2424
|
+
}),
|
|
2425
|
+
z16.object({
|
|
2426
|
+
type: z16.literal("open_page"),
|
|
2427
|
+
url: z16.string()
|
|
2428
|
+
}),
|
|
2429
|
+
z16.object({
|
|
2430
|
+
type: z16.literal("find"),
|
|
2431
|
+
url: z16.string(),
|
|
2432
|
+
pattern: z16.string()
|
|
2433
|
+
})
|
|
2434
|
+
]).nullish()
|
|
2435
|
+
})
|
|
2436
|
+
});
|
|
2437
|
+
|
|
2412
2438
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2413
2439
|
function prepareResponsesTools({
|
|
2414
2440
|
tools,
|
|
@@ -2454,6 +2480,16 @@ function prepareResponsesTools({
|
|
|
2454
2480
|
});
|
|
2455
2481
|
break;
|
|
2456
2482
|
}
|
|
2483
|
+
case "openai.web_search": {
|
|
2484
|
+
const args = webSearchArgsSchema.parse(tool.args);
|
|
2485
|
+
openaiTools.push({
|
|
2486
|
+
type: "web_search",
|
|
2487
|
+
filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
|
|
2488
|
+
search_context_size: args.searchContextSize,
|
|
2489
|
+
user_location: args.userLocation
|
|
2490
|
+
});
|
|
2491
|
+
break;
|
|
2492
|
+
}
|
|
2457
2493
|
case "openai.code_interpreter": {
|
|
2458
2494
|
const args = codeInterpreterArgsSchema.parse(tool.args);
|
|
2459
2495
|
openaiTools.push({
|
|
@@ -2486,7 +2522,7 @@ function prepareResponsesTools({
|
|
|
2486
2522
|
case "tool":
|
|
2487
2523
|
return {
|
|
2488
2524
|
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 },
|
|
2525
|
+
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
2526
|
toolWarnings
|
|
2491
2527
|
};
|
|
2492
2528
|
default: {
|
|
@@ -2499,35 +2535,35 @@ function prepareResponsesTools({
|
|
|
2499
2535
|
}
|
|
2500
2536
|
|
|
2501
2537
|
// src/responses/openai-responses-language-model.ts
|
|
2502
|
-
var webSearchCallItem =
|
|
2503
|
-
type:
|
|
2504
|
-
id:
|
|
2505
|
-
status:
|
|
2506
|
-
action:
|
|
2507
|
-
|
|
2508
|
-
type:
|
|
2509
|
-
query:
|
|
2538
|
+
var webSearchCallItem = z17.object({
|
|
2539
|
+
type: z17.literal("web_search_call"),
|
|
2540
|
+
id: z17.string(),
|
|
2541
|
+
status: z17.string(),
|
|
2542
|
+
action: z17.discriminatedUnion("type", [
|
|
2543
|
+
z17.object({
|
|
2544
|
+
type: z17.literal("search"),
|
|
2545
|
+
query: z17.string().nullish()
|
|
2510
2546
|
}),
|
|
2511
|
-
|
|
2512
|
-
type:
|
|
2513
|
-
url:
|
|
2547
|
+
z17.object({
|
|
2548
|
+
type: z17.literal("open_page"),
|
|
2549
|
+
url: z17.string()
|
|
2514
2550
|
}),
|
|
2515
|
-
|
|
2516
|
-
type:
|
|
2517
|
-
url:
|
|
2518
|
-
pattern:
|
|
2551
|
+
z17.object({
|
|
2552
|
+
type: z17.literal("find"),
|
|
2553
|
+
url: z17.string(),
|
|
2554
|
+
pattern: z17.string()
|
|
2519
2555
|
})
|
|
2520
2556
|
]).nullish()
|
|
2521
2557
|
});
|
|
2522
2558
|
var TOP_LOGPROBS_MAX = 20;
|
|
2523
|
-
var LOGPROBS_SCHEMA =
|
|
2524
|
-
|
|
2525
|
-
token:
|
|
2526
|
-
logprob:
|
|
2527
|
-
top_logprobs:
|
|
2528
|
-
|
|
2529
|
-
token:
|
|
2530
|
-
logprob:
|
|
2559
|
+
var LOGPROBS_SCHEMA = z17.array(
|
|
2560
|
+
z17.object({
|
|
2561
|
+
token: z17.string(),
|
|
2562
|
+
logprob: z17.number(),
|
|
2563
|
+
top_logprobs: z17.array(
|
|
2564
|
+
z17.object({
|
|
2565
|
+
token: z17.string(),
|
|
2566
|
+
logprob: z17.number()
|
|
2531
2567
|
})
|
|
2532
2568
|
)
|
|
2533
2569
|
})
|
|
@@ -2731,92 +2767,92 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2731
2767
|
body,
|
|
2732
2768
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2733
2769
|
successfulResponseHandler: createJsonResponseHandler6(
|
|
2734
|
-
|
|
2735
|
-
id:
|
|
2736
|
-
created_at:
|
|
2737
|
-
error:
|
|
2738
|
-
code:
|
|
2739
|
-
message:
|
|
2770
|
+
z17.object({
|
|
2771
|
+
id: z17.string(),
|
|
2772
|
+
created_at: z17.number(),
|
|
2773
|
+
error: z17.object({
|
|
2774
|
+
code: z17.string(),
|
|
2775
|
+
message: z17.string()
|
|
2740
2776
|
}).nullish(),
|
|
2741
|
-
model:
|
|
2742
|
-
output:
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
type:
|
|
2746
|
-
role:
|
|
2747
|
-
id:
|
|
2748
|
-
content:
|
|
2749
|
-
|
|
2750
|
-
type:
|
|
2751
|
-
text:
|
|
2777
|
+
model: z17.string(),
|
|
2778
|
+
output: z17.array(
|
|
2779
|
+
z17.discriminatedUnion("type", [
|
|
2780
|
+
z17.object({
|
|
2781
|
+
type: z17.literal("message"),
|
|
2782
|
+
role: z17.literal("assistant"),
|
|
2783
|
+
id: z17.string(),
|
|
2784
|
+
content: z17.array(
|
|
2785
|
+
z17.object({
|
|
2786
|
+
type: z17.literal("output_text"),
|
|
2787
|
+
text: z17.string(),
|
|
2752
2788
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2753
|
-
annotations:
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
type:
|
|
2757
|
-
start_index:
|
|
2758
|
-
end_index:
|
|
2759
|
-
url:
|
|
2760
|
-
title:
|
|
2789
|
+
annotations: z17.array(
|
|
2790
|
+
z17.discriminatedUnion("type", [
|
|
2791
|
+
z17.object({
|
|
2792
|
+
type: z17.literal("url_citation"),
|
|
2793
|
+
start_index: z17.number(),
|
|
2794
|
+
end_index: z17.number(),
|
|
2795
|
+
url: z17.string(),
|
|
2796
|
+
title: z17.string()
|
|
2761
2797
|
}),
|
|
2762
|
-
|
|
2763
|
-
type:
|
|
2764
|
-
file_id:
|
|
2765
|
-
filename:
|
|
2766
|
-
index:
|
|
2767
|
-
start_index:
|
|
2768
|
-
end_index:
|
|
2769
|
-
quote:
|
|
2798
|
+
z17.object({
|
|
2799
|
+
type: z17.literal("file_citation"),
|
|
2800
|
+
file_id: z17.string(),
|
|
2801
|
+
filename: z17.string().nullish(),
|
|
2802
|
+
index: z17.number().nullish(),
|
|
2803
|
+
start_index: z17.number().nullish(),
|
|
2804
|
+
end_index: z17.number().nullish(),
|
|
2805
|
+
quote: z17.string().nullish()
|
|
2770
2806
|
})
|
|
2771
2807
|
])
|
|
2772
2808
|
)
|
|
2773
2809
|
})
|
|
2774
2810
|
)
|
|
2775
2811
|
}),
|
|
2776
|
-
|
|
2777
|
-
type:
|
|
2778
|
-
call_id:
|
|
2779
|
-
name:
|
|
2780
|
-
arguments:
|
|
2781
|
-
id:
|
|
2812
|
+
z17.object({
|
|
2813
|
+
type: z17.literal("function_call"),
|
|
2814
|
+
call_id: z17.string(),
|
|
2815
|
+
name: z17.string(),
|
|
2816
|
+
arguments: z17.string(),
|
|
2817
|
+
id: z17.string()
|
|
2782
2818
|
}),
|
|
2783
2819
|
webSearchCallItem,
|
|
2784
|
-
|
|
2785
|
-
type:
|
|
2786
|
-
id:
|
|
2787
|
-
status:
|
|
2820
|
+
z17.object({
|
|
2821
|
+
type: z17.literal("computer_call"),
|
|
2822
|
+
id: z17.string(),
|
|
2823
|
+
status: z17.string().optional()
|
|
2788
2824
|
}),
|
|
2789
|
-
|
|
2790
|
-
type:
|
|
2791
|
-
id:
|
|
2792
|
-
status:
|
|
2793
|
-
queries:
|
|
2794
|
-
results:
|
|
2795
|
-
|
|
2796
|
-
attributes:
|
|
2797
|
-
file_id:
|
|
2798
|
-
filename:
|
|
2799
|
-
score:
|
|
2800
|
-
text:
|
|
2825
|
+
z17.object({
|
|
2826
|
+
type: z17.literal("file_search_call"),
|
|
2827
|
+
id: z17.string(),
|
|
2828
|
+
status: z17.string().optional(),
|
|
2829
|
+
queries: z17.array(z17.string()).nullish(),
|
|
2830
|
+
results: z17.array(
|
|
2831
|
+
z17.object({
|
|
2832
|
+
attributes: z17.object({
|
|
2833
|
+
file_id: z17.string(),
|
|
2834
|
+
filename: z17.string(),
|
|
2835
|
+
score: z17.number(),
|
|
2836
|
+
text: z17.string()
|
|
2801
2837
|
})
|
|
2802
2838
|
})
|
|
2803
2839
|
).nullish()
|
|
2804
2840
|
}),
|
|
2805
|
-
|
|
2806
|
-
type:
|
|
2807
|
-
id:
|
|
2808
|
-
encrypted_content:
|
|
2809
|
-
summary:
|
|
2810
|
-
|
|
2811
|
-
type:
|
|
2812
|
-
text:
|
|
2841
|
+
z17.object({
|
|
2842
|
+
type: z17.literal("reasoning"),
|
|
2843
|
+
id: z17.string(),
|
|
2844
|
+
encrypted_content: z17.string().nullish(),
|
|
2845
|
+
summary: z17.array(
|
|
2846
|
+
z17.object({
|
|
2847
|
+
type: z17.literal("summary_text"),
|
|
2848
|
+
text: z17.string()
|
|
2813
2849
|
})
|
|
2814
2850
|
)
|
|
2815
2851
|
})
|
|
2816
2852
|
])
|
|
2817
2853
|
),
|
|
2818
|
-
service_tier:
|
|
2819
|
-
incomplete_details:
|
|
2854
|
+
service_tier: z17.string().nullish(),
|
|
2855
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullable(),
|
|
2820
2856
|
usage: usageSchema2
|
|
2821
2857
|
})
|
|
2822
2858
|
),
|
|
@@ -2836,6 +2872,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2836
2872
|
}
|
|
2837
2873
|
const content = [];
|
|
2838
2874
|
const logprobs = [];
|
|
2875
|
+
let hasFunctionCall = false;
|
|
2839
2876
|
for (const part of response.output) {
|
|
2840
2877
|
switch (part.type) {
|
|
2841
2878
|
case "reasoning": {
|
|
@@ -2894,6 +2931,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2894
2931
|
break;
|
|
2895
2932
|
}
|
|
2896
2933
|
case "function_call": {
|
|
2934
|
+
hasFunctionCall = true;
|
|
2897
2935
|
content.push({
|
|
2898
2936
|
type: "tool-call",
|
|
2899
2937
|
toolCallId: part.call_id,
|
|
@@ -2981,7 +3019,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2981
3019
|
content,
|
|
2982
3020
|
finishReason: mapOpenAIResponseFinishReason({
|
|
2983
3021
|
finishReason: (_m = response.incomplete_details) == null ? void 0 : _m.reason,
|
|
2984
|
-
|
|
3022
|
+
hasFunctionCall
|
|
2985
3023
|
}),
|
|
2986
3024
|
usage: {
|
|
2987
3025
|
inputTokens: response.usage.input_tokens,
|
|
@@ -3031,7 +3069,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3031
3069
|
const logprobs = [];
|
|
3032
3070
|
let responseId = null;
|
|
3033
3071
|
const ongoingToolCalls = {};
|
|
3034
|
-
let
|
|
3072
|
+
let hasFunctionCall = false;
|
|
3035
3073
|
const activeReasoning = {};
|
|
3036
3074
|
let serviceTier;
|
|
3037
3075
|
return {
|
|
@@ -3121,7 +3159,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3121
3159
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
3122
3160
|
if (value.item.type === "function_call") {
|
|
3123
3161
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3124
|
-
|
|
3162
|
+
hasFunctionCall = true;
|
|
3125
3163
|
controller.enqueue({
|
|
3126
3164
|
type: "tool-input-end",
|
|
3127
3165
|
id: value.item.call_id
|
|
@@ -3139,7 +3177,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3139
3177
|
});
|
|
3140
3178
|
} else if (value.item.type === "web_search_call") {
|
|
3141
3179
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3142
|
-
hasToolCalls = true;
|
|
3143
3180
|
controller.enqueue({
|
|
3144
3181
|
type: "tool-input-end",
|
|
3145
3182
|
id: value.item.id
|
|
@@ -3147,20 +3184,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3147
3184
|
controller.enqueue({
|
|
3148
3185
|
type: "tool-call",
|
|
3149
3186
|
toolCallId: value.item.id,
|
|
3150
|
-
toolName: "
|
|
3187
|
+
toolName: "web_search",
|
|
3151
3188
|
input: JSON.stringify({ action: value.item.action }),
|
|
3152
3189
|
providerExecuted: true
|
|
3153
3190
|
});
|
|
3154
3191
|
controller.enqueue({
|
|
3155
3192
|
type: "tool-result",
|
|
3156
3193
|
toolCallId: value.item.id,
|
|
3157
|
-
toolName: "
|
|
3194
|
+
toolName: "web_search",
|
|
3158
3195
|
result: { status: value.item.status },
|
|
3159
3196
|
providerExecuted: true
|
|
3160
3197
|
});
|
|
3161
3198
|
} else if (value.item.type === "computer_call") {
|
|
3162
3199
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3163
|
-
hasToolCalls = true;
|
|
3164
3200
|
controller.enqueue({
|
|
3165
3201
|
type: "tool-input-end",
|
|
3166
3202
|
id: value.item.id
|
|
@@ -3184,7 +3220,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3184
3220
|
});
|
|
3185
3221
|
} else if (value.item.type === "file_search_call") {
|
|
3186
3222
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3187
|
-
hasToolCalls = true;
|
|
3188
3223
|
controller.enqueue({
|
|
3189
3224
|
type: "tool-input-end",
|
|
3190
3225
|
id: value.item.id
|
|
@@ -3285,7 +3320,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3285
3320
|
} else if (isResponseFinishedChunk(value)) {
|
|
3286
3321
|
finishReason = mapOpenAIResponseFinishReason({
|
|
3287
3322
|
finishReason: (_h = value.response.incomplete_details) == null ? void 0 : _h.reason,
|
|
3288
|
-
|
|
3323
|
+
hasFunctionCall
|
|
3289
3324
|
});
|
|
3290
3325
|
usage.inputTokens = value.response.usage.input_tokens;
|
|
3291
3326
|
usage.outputTokens = value.response.usage.output_tokens;
|
|
@@ -3344,176 +3379,176 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3344
3379
|
};
|
|
3345
3380
|
}
|
|
3346
3381
|
};
|
|
3347
|
-
var usageSchema2 =
|
|
3348
|
-
input_tokens:
|
|
3349
|
-
input_tokens_details:
|
|
3350
|
-
output_tokens:
|
|
3351
|
-
output_tokens_details:
|
|
3382
|
+
var usageSchema2 = z17.object({
|
|
3383
|
+
input_tokens: z17.number(),
|
|
3384
|
+
input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
|
|
3385
|
+
output_tokens: z17.number(),
|
|
3386
|
+
output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
|
|
3352
3387
|
});
|
|
3353
|
-
var textDeltaChunkSchema =
|
|
3354
|
-
type:
|
|
3355
|
-
item_id:
|
|
3356
|
-
delta:
|
|
3388
|
+
var textDeltaChunkSchema = z17.object({
|
|
3389
|
+
type: z17.literal("response.output_text.delta"),
|
|
3390
|
+
item_id: z17.string(),
|
|
3391
|
+
delta: z17.string(),
|
|
3357
3392
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3358
3393
|
});
|
|
3359
|
-
var errorChunkSchema =
|
|
3360
|
-
type:
|
|
3361
|
-
code:
|
|
3362
|
-
message:
|
|
3363
|
-
param:
|
|
3364
|
-
sequence_number:
|
|
3394
|
+
var errorChunkSchema = z17.object({
|
|
3395
|
+
type: z17.literal("error"),
|
|
3396
|
+
code: z17.string(),
|
|
3397
|
+
message: z17.string(),
|
|
3398
|
+
param: z17.string().nullish(),
|
|
3399
|
+
sequence_number: z17.number()
|
|
3365
3400
|
});
|
|
3366
|
-
var responseFinishedChunkSchema =
|
|
3367
|
-
type:
|
|
3368
|
-
response:
|
|
3369
|
-
incomplete_details:
|
|
3401
|
+
var responseFinishedChunkSchema = z17.object({
|
|
3402
|
+
type: z17.enum(["response.completed", "response.incomplete"]),
|
|
3403
|
+
response: z17.object({
|
|
3404
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
3370
3405
|
usage: usageSchema2,
|
|
3371
|
-
service_tier:
|
|
3406
|
+
service_tier: z17.string().nullish()
|
|
3372
3407
|
})
|
|
3373
3408
|
});
|
|
3374
|
-
var responseCreatedChunkSchema =
|
|
3375
|
-
type:
|
|
3376
|
-
response:
|
|
3377
|
-
id:
|
|
3378
|
-
created_at:
|
|
3379
|
-
model:
|
|
3380
|
-
service_tier:
|
|
3409
|
+
var responseCreatedChunkSchema = z17.object({
|
|
3410
|
+
type: z17.literal("response.created"),
|
|
3411
|
+
response: z17.object({
|
|
3412
|
+
id: z17.string(),
|
|
3413
|
+
created_at: z17.number(),
|
|
3414
|
+
model: z17.string(),
|
|
3415
|
+
service_tier: z17.string().nullish()
|
|
3381
3416
|
})
|
|
3382
3417
|
});
|
|
3383
|
-
var responseOutputItemAddedSchema =
|
|
3384
|
-
type:
|
|
3385
|
-
output_index:
|
|
3386
|
-
item:
|
|
3387
|
-
|
|
3388
|
-
type:
|
|
3389
|
-
id:
|
|
3418
|
+
var responseOutputItemAddedSchema = z17.object({
|
|
3419
|
+
type: z17.literal("response.output_item.added"),
|
|
3420
|
+
output_index: z17.number(),
|
|
3421
|
+
item: z17.discriminatedUnion("type", [
|
|
3422
|
+
z17.object({
|
|
3423
|
+
type: z17.literal("message"),
|
|
3424
|
+
id: z17.string()
|
|
3390
3425
|
}),
|
|
3391
|
-
|
|
3392
|
-
type:
|
|
3393
|
-
id:
|
|
3394
|
-
encrypted_content:
|
|
3426
|
+
z17.object({
|
|
3427
|
+
type: z17.literal("reasoning"),
|
|
3428
|
+
id: z17.string(),
|
|
3429
|
+
encrypted_content: z17.string().nullish()
|
|
3395
3430
|
}),
|
|
3396
|
-
|
|
3397
|
-
type:
|
|
3398
|
-
id:
|
|
3399
|
-
call_id:
|
|
3400
|
-
name:
|
|
3401
|
-
arguments:
|
|
3431
|
+
z17.object({
|
|
3432
|
+
type: z17.literal("function_call"),
|
|
3433
|
+
id: z17.string(),
|
|
3434
|
+
call_id: z17.string(),
|
|
3435
|
+
name: z17.string(),
|
|
3436
|
+
arguments: z17.string()
|
|
3402
3437
|
}),
|
|
3403
|
-
|
|
3404
|
-
type:
|
|
3405
|
-
id:
|
|
3406
|
-
status:
|
|
3407
|
-
action:
|
|
3408
|
-
type:
|
|
3409
|
-
query:
|
|
3438
|
+
z17.object({
|
|
3439
|
+
type: z17.literal("web_search_call"),
|
|
3440
|
+
id: z17.string(),
|
|
3441
|
+
status: z17.string(),
|
|
3442
|
+
action: z17.object({
|
|
3443
|
+
type: z17.literal("search"),
|
|
3444
|
+
query: z17.string().optional()
|
|
3410
3445
|
}).nullish()
|
|
3411
3446
|
}),
|
|
3412
|
-
|
|
3413
|
-
type:
|
|
3414
|
-
id:
|
|
3415
|
-
status:
|
|
3447
|
+
z17.object({
|
|
3448
|
+
type: z17.literal("computer_call"),
|
|
3449
|
+
id: z17.string(),
|
|
3450
|
+
status: z17.string()
|
|
3416
3451
|
}),
|
|
3417
|
-
|
|
3418
|
-
type:
|
|
3419
|
-
id:
|
|
3420
|
-
status:
|
|
3421
|
-
queries:
|
|
3422
|
-
results:
|
|
3423
|
-
|
|
3424
|
-
attributes:
|
|
3425
|
-
file_id:
|
|
3426
|
-
filename:
|
|
3427
|
-
score:
|
|
3428
|
-
text:
|
|
3452
|
+
z17.object({
|
|
3453
|
+
type: z17.literal("file_search_call"),
|
|
3454
|
+
id: z17.string(),
|
|
3455
|
+
status: z17.string(),
|
|
3456
|
+
queries: z17.array(z17.string()).nullish(),
|
|
3457
|
+
results: z17.array(
|
|
3458
|
+
z17.object({
|
|
3459
|
+
attributes: z17.object({
|
|
3460
|
+
file_id: z17.string(),
|
|
3461
|
+
filename: z17.string(),
|
|
3462
|
+
score: z17.number(),
|
|
3463
|
+
text: z17.string()
|
|
3429
3464
|
})
|
|
3430
3465
|
})
|
|
3431
3466
|
).optional()
|
|
3432
3467
|
})
|
|
3433
3468
|
])
|
|
3434
3469
|
});
|
|
3435
|
-
var responseOutputItemDoneSchema =
|
|
3436
|
-
type:
|
|
3437
|
-
output_index:
|
|
3438
|
-
item:
|
|
3439
|
-
|
|
3440
|
-
type:
|
|
3441
|
-
id:
|
|
3470
|
+
var responseOutputItemDoneSchema = z17.object({
|
|
3471
|
+
type: z17.literal("response.output_item.done"),
|
|
3472
|
+
output_index: z17.number(),
|
|
3473
|
+
item: z17.discriminatedUnion("type", [
|
|
3474
|
+
z17.object({
|
|
3475
|
+
type: z17.literal("message"),
|
|
3476
|
+
id: z17.string()
|
|
3442
3477
|
}),
|
|
3443
|
-
|
|
3444
|
-
type:
|
|
3445
|
-
id:
|
|
3446
|
-
encrypted_content:
|
|
3478
|
+
z17.object({
|
|
3479
|
+
type: z17.literal("reasoning"),
|
|
3480
|
+
id: z17.string(),
|
|
3481
|
+
encrypted_content: z17.string().nullish()
|
|
3447
3482
|
}),
|
|
3448
|
-
|
|
3449
|
-
type:
|
|
3450
|
-
id:
|
|
3451
|
-
call_id:
|
|
3452
|
-
name:
|
|
3453
|
-
arguments:
|
|
3454
|
-
status:
|
|
3483
|
+
z17.object({
|
|
3484
|
+
type: z17.literal("function_call"),
|
|
3485
|
+
id: z17.string(),
|
|
3486
|
+
call_id: z17.string(),
|
|
3487
|
+
name: z17.string(),
|
|
3488
|
+
arguments: z17.string(),
|
|
3489
|
+
status: z17.literal("completed")
|
|
3455
3490
|
}),
|
|
3456
3491
|
webSearchCallItem,
|
|
3457
|
-
|
|
3458
|
-
type:
|
|
3459
|
-
id:
|
|
3460
|
-
status:
|
|
3492
|
+
z17.object({
|
|
3493
|
+
type: z17.literal("computer_call"),
|
|
3494
|
+
id: z17.string(),
|
|
3495
|
+
status: z17.literal("completed")
|
|
3461
3496
|
}),
|
|
3462
|
-
|
|
3463
|
-
type:
|
|
3464
|
-
id:
|
|
3465
|
-
status:
|
|
3466
|
-
queries:
|
|
3467
|
-
results:
|
|
3468
|
-
|
|
3469
|
-
attributes:
|
|
3470
|
-
file_id:
|
|
3471
|
-
filename:
|
|
3472
|
-
score:
|
|
3473
|
-
text:
|
|
3497
|
+
z17.object({
|
|
3498
|
+
type: z17.literal("file_search_call"),
|
|
3499
|
+
id: z17.string(),
|
|
3500
|
+
status: z17.literal("completed"),
|
|
3501
|
+
queries: z17.array(z17.string()).nullish(),
|
|
3502
|
+
results: z17.array(
|
|
3503
|
+
z17.object({
|
|
3504
|
+
attributes: z17.object({
|
|
3505
|
+
file_id: z17.string(),
|
|
3506
|
+
filename: z17.string(),
|
|
3507
|
+
score: z17.number(),
|
|
3508
|
+
text: z17.string()
|
|
3474
3509
|
})
|
|
3475
3510
|
})
|
|
3476
3511
|
).nullish()
|
|
3477
3512
|
})
|
|
3478
3513
|
])
|
|
3479
3514
|
});
|
|
3480
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3481
|
-
type:
|
|
3482
|
-
item_id:
|
|
3483
|
-
output_index:
|
|
3484
|
-
delta:
|
|
3515
|
+
var responseFunctionCallArgumentsDeltaSchema = z17.object({
|
|
3516
|
+
type: z17.literal("response.function_call_arguments.delta"),
|
|
3517
|
+
item_id: z17.string(),
|
|
3518
|
+
output_index: z17.number(),
|
|
3519
|
+
delta: z17.string()
|
|
3485
3520
|
});
|
|
3486
|
-
var responseAnnotationAddedSchema =
|
|
3487
|
-
type:
|
|
3488
|
-
annotation:
|
|
3489
|
-
|
|
3490
|
-
type:
|
|
3491
|
-
url:
|
|
3492
|
-
title:
|
|
3521
|
+
var responseAnnotationAddedSchema = z17.object({
|
|
3522
|
+
type: z17.literal("response.output_text.annotation.added"),
|
|
3523
|
+
annotation: z17.discriminatedUnion("type", [
|
|
3524
|
+
z17.object({
|
|
3525
|
+
type: z17.literal("url_citation"),
|
|
3526
|
+
url: z17.string(),
|
|
3527
|
+
title: z17.string()
|
|
3493
3528
|
}),
|
|
3494
|
-
|
|
3495
|
-
type:
|
|
3496
|
-
file_id:
|
|
3497
|
-
filename:
|
|
3498
|
-
index:
|
|
3499
|
-
start_index:
|
|
3500
|
-
end_index:
|
|
3501
|
-
quote:
|
|
3529
|
+
z17.object({
|
|
3530
|
+
type: z17.literal("file_citation"),
|
|
3531
|
+
file_id: z17.string(),
|
|
3532
|
+
filename: z17.string().nullish(),
|
|
3533
|
+
index: z17.number().nullish(),
|
|
3534
|
+
start_index: z17.number().nullish(),
|
|
3535
|
+
end_index: z17.number().nullish(),
|
|
3536
|
+
quote: z17.string().nullish()
|
|
3502
3537
|
})
|
|
3503
3538
|
])
|
|
3504
3539
|
});
|
|
3505
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3506
|
-
type:
|
|
3507
|
-
item_id:
|
|
3508
|
-
summary_index:
|
|
3540
|
+
var responseReasoningSummaryPartAddedSchema = z17.object({
|
|
3541
|
+
type: z17.literal("response.reasoning_summary_part.added"),
|
|
3542
|
+
item_id: z17.string(),
|
|
3543
|
+
summary_index: z17.number()
|
|
3509
3544
|
});
|
|
3510
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3511
|
-
type:
|
|
3512
|
-
item_id:
|
|
3513
|
-
summary_index:
|
|
3514
|
-
delta:
|
|
3545
|
+
var responseReasoningSummaryTextDeltaSchema = z17.object({
|
|
3546
|
+
type: z17.literal("response.reasoning_summary_text.delta"),
|
|
3547
|
+
item_id: z17.string(),
|
|
3548
|
+
summary_index: z17.number(),
|
|
3549
|
+
delta: z17.string()
|
|
3515
3550
|
});
|
|
3516
|
-
var openaiResponsesChunkSchema =
|
|
3551
|
+
var openaiResponsesChunkSchema = z17.union([
|
|
3517
3552
|
textDeltaChunkSchema,
|
|
3518
3553
|
responseFinishedChunkSchema,
|
|
3519
3554
|
responseCreatedChunkSchema,
|
|
@@ -3524,7 +3559,7 @@ var openaiResponsesChunkSchema = z16.union([
|
|
|
3524
3559
|
responseReasoningSummaryPartAddedSchema,
|
|
3525
3560
|
responseReasoningSummaryTextDeltaSchema,
|
|
3526
3561
|
errorChunkSchema,
|
|
3527
|
-
|
|
3562
|
+
z17.object({ type: z17.string() }).loose()
|
|
3528
3563
|
// fallback for unknown chunks
|
|
3529
3564
|
]);
|
|
3530
3565
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3597,27 +3632,27 @@ function getResponsesModelConfig(modelId) {
|
|
|
3597
3632
|
isReasoningModel: false
|
|
3598
3633
|
};
|
|
3599
3634
|
}
|
|
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
|
-
|
|
3635
|
+
var openaiResponsesProviderOptionsSchema = z17.object({
|
|
3636
|
+
metadata: z17.any().nullish(),
|
|
3637
|
+
parallelToolCalls: z17.boolean().nullish(),
|
|
3638
|
+
previousResponseId: z17.string().nullish(),
|
|
3639
|
+
store: z17.boolean().nullish(),
|
|
3640
|
+
user: z17.string().nullish(),
|
|
3641
|
+
reasoningEffort: z17.string().nullish(),
|
|
3642
|
+
strictJsonSchema: z17.boolean().nullish(),
|
|
3643
|
+
instructions: z17.string().nullish(),
|
|
3644
|
+
reasoningSummary: z17.string().nullish(),
|
|
3645
|
+
serviceTier: z17.enum(["auto", "flex", "priority"]).nullish(),
|
|
3646
|
+
include: z17.array(
|
|
3647
|
+
z17.enum([
|
|
3613
3648
|
"reasoning.encrypted_content",
|
|
3614
3649
|
"file_search_call.results",
|
|
3615
3650
|
"message.output_text.logprobs"
|
|
3616
3651
|
])
|
|
3617
3652
|
).nullish(),
|
|
3618
|
-
textVerbosity:
|
|
3619
|
-
promptCacheKey:
|
|
3620
|
-
safetyIdentifier:
|
|
3653
|
+
textVerbosity: z17.enum(["low", "medium", "high"]).nullish(),
|
|
3654
|
+
promptCacheKey: z17.string().nullish(),
|
|
3655
|
+
safetyIdentifier: z17.string().nullish(),
|
|
3621
3656
|
/**
|
|
3622
3657
|
* Return the log probabilities of the tokens.
|
|
3623
3658
|
*
|
|
@@ -3630,7 +3665,7 @@ var openaiResponsesProviderOptionsSchema = z16.object({
|
|
|
3630
3665
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3631
3666
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3632
3667
|
*/
|
|
3633
|
-
logprobs:
|
|
3668
|
+
logprobs: z17.union([z17.boolean(), z17.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
|
|
3634
3669
|
});
|
|
3635
3670
|
export {
|
|
3636
3671
|
OpenAIChatLanguageModel,
|