@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.
@@ -2149,8 +2149,8 @@ var OpenAISpeechModel = class {
2149
2149
 
2150
2150
  // src/responses/openai-responses-language-model.ts
2151
2151
  var import_provider8 = require("@ai-sdk/provider");
2152
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
2153
- var import_v416 = require("zod/v4");
2152
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
2153
+ var import_v417 = require("zod/v4");
2154
2154
 
2155
2155
  // src/responses/convert-to-openai-responses-messages.ts
2156
2156
  var import_provider6 = require("@ai-sdk/provider");
@@ -2353,18 +2353,18 @@ var openaiResponsesReasoningProviderOptionsSchema = import_v414.z.object({
2353
2353
  // src/responses/map-openai-responses-finish-reason.ts
2354
2354
  function mapOpenAIResponseFinishReason({
2355
2355
  finishReason,
2356
- hasToolCalls
2356
+ hasFunctionCall
2357
2357
  }) {
2358
2358
  switch (finishReason) {
2359
2359
  case void 0:
2360
2360
  case null:
2361
- return hasToolCalls ? "tool-calls" : "stop";
2361
+ return hasFunctionCall ? "tool-calls" : "stop";
2362
2362
  case "max_output_tokens":
2363
2363
  return "length";
2364
2364
  case "content_filter":
2365
2365
  return "content-filter";
2366
2366
  default:
2367
- return hasToolCalls ? "tool-calls" : "unknown";
2367
+ return hasFunctionCall ? "tool-calls" : "unknown";
2368
2368
  }
2369
2369
  }
2370
2370
 
@@ -2388,6 +2388,44 @@ var codeInterpreter = (0, import_provider_utils13.createProviderDefinedToolFacto
2388
2388
  inputSchema: import_v415.z.object({})
2389
2389
  });
2390
2390
 
2391
+ // src/tool/web-search.ts
2392
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
2393
+ var import_v416 = require("zod/v4");
2394
+ var webSearchArgsSchema = import_v416.z.object({
2395
+ filters: import_v416.z.object({
2396
+ allowedDomains: import_v416.z.array(import_v416.z.string()).optional()
2397
+ }).optional(),
2398
+ searchContextSize: import_v416.z.enum(["low", "medium", "high"]).optional(),
2399
+ userLocation: import_v416.z.object({
2400
+ type: import_v416.z.literal("approximate"),
2401
+ country: import_v416.z.string().optional(),
2402
+ city: import_v416.z.string().optional(),
2403
+ region: import_v416.z.string().optional(),
2404
+ timezone: import_v416.z.string().optional()
2405
+ }).optional()
2406
+ });
2407
+ var factory = (0, import_provider_utils14.createProviderDefinedToolFactory)({
2408
+ id: "openai.web_search",
2409
+ name: "web_search",
2410
+ inputSchema: import_v416.z.object({
2411
+ action: import_v416.z.discriminatedUnion("type", [
2412
+ import_v416.z.object({
2413
+ type: import_v416.z.literal("search"),
2414
+ query: import_v416.z.string().nullish()
2415
+ }),
2416
+ import_v416.z.object({
2417
+ type: import_v416.z.literal("open_page"),
2418
+ url: import_v416.z.string()
2419
+ }),
2420
+ import_v416.z.object({
2421
+ type: import_v416.z.literal("find"),
2422
+ url: import_v416.z.string(),
2423
+ pattern: import_v416.z.string()
2424
+ })
2425
+ ]).nullish()
2426
+ })
2427
+ });
2428
+
2391
2429
  // src/responses/openai-responses-prepare-tools.ts
2392
2430
  function prepareResponsesTools({
2393
2431
  tools,
@@ -2433,6 +2471,16 @@ function prepareResponsesTools({
2433
2471
  });
2434
2472
  break;
2435
2473
  }
2474
+ case "openai.web_search": {
2475
+ const args = webSearchArgsSchema.parse(tool.args);
2476
+ openaiTools.push({
2477
+ type: "web_search",
2478
+ filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
2479
+ search_context_size: args.searchContextSize,
2480
+ user_location: args.userLocation
2481
+ });
2482
+ break;
2483
+ }
2436
2484
  case "openai.code_interpreter": {
2437
2485
  const args = codeInterpreterArgsSchema.parse(tool.args);
2438
2486
  openaiTools.push({
@@ -2465,7 +2513,7 @@ function prepareResponsesTools({
2465
2513
  case "tool":
2466
2514
  return {
2467
2515
  tools: openaiTools,
2468
- toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "web_search_preview" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
2516
+ 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 },
2469
2517
  toolWarnings
2470
2518
  };
2471
2519
  default: {
@@ -2478,35 +2526,35 @@ function prepareResponsesTools({
2478
2526
  }
2479
2527
 
2480
2528
  // src/responses/openai-responses-language-model.ts
2481
- var webSearchCallItem = import_v416.z.object({
2482
- type: import_v416.z.literal("web_search_call"),
2483
- id: import_v416.z.string(),
2484
- status: import_v416.z.string(),
2485
- action: import_v416.z.discriminatedUnion("type", [
2486
- import_v416.z.object({
2487
- type: import_v416.z.literal("search"),
2488
- query: import_v416.z.string().nullish()
2529
+ var webSearchCallItem = import_v417.z.object({
2530
+ type: import_v417.z.literal("web_search_call"),
2531
+ id: import_v417.z.string(),
2532
+ status: import_v417.z.string(),
2533
+ action: import_v417.z.discriminatedUnion("type", [
2534
+ import_v417.z.object({
2535
+ type: import_v417.z.literal("search"),
2536
+ query: import_v417.z.string().nullish()
2489
2537
  }),
2490
- import_v416.z.object({
2491
- type: import_v416.z.literal("open_page"),
2492
- url: import_v416.z.string()
2538
+ import_v417.z.object({
2539
+ type: import_v417.z.literal("open_page"),
2540
+ url: import_v417.z.string()
2493
2541
  }),
2494
- import_v416.z.object({
2495
- type: import_v416.z.literal("find"),
2496
- url: import_v416.z.string(),
2497
- pattern: import_v416.z.string()
2542
+ import_v417.z.object({
2543
+ type: import_v417.z.literal("find"),
2544
+ url: import_v417.z.string(),
2545
+ pattern: import_v417.z.string()
2498
2546
  })
2499
2547
  ]).nullish()
2500
2548
  });
2501
2549
  var TOP_LOGPROBS_MAX = 20;
2502
- var LOGPROBS_SCHEMA = import_v416.z.array(
2503
- import_v416.z.object({
2504
- token: import_v416.z.string(),
2505
- logprob: import_v416.z.number(),
2506
- top_logprobs: import_v416.z.array(
2507
- import_v416.z.object({
2508
- token: import_v416.z.string(),
2509
- logprob: import_v416.z.number()
2550
+ var LOGPROBS_SCHEMA = import_v417.z.array(
2551
+ import_v417.z.object({
2552
+ token: import_v417.z.string(),
2553
+ logprob: import_v417.z.number(),
2554
+ top_logprobs: import_v417.z.array(
2555
+ import_v417.z.object({
2556
+ token: import_v417.z.string(),
2557
+ logprob: import_v417.z.number()
2510
2558
  })
2511
2559
  )
2512
2560
  })
@@ -2569,7 +2617,7 @@ var OpenAIResponsesLanguageModel = class {
2569
2617
  fileIdPrefixes: this.config.fileIdPrefixes
2570
2618
  });
2571
2619
  warnings.push(...messageWarnings);
2572
- const openaiOptions = await (0, import_provider_utils14.parseProviderOptions)({
2620
+ const openaiOptions = await (0, import_provider_utils15.parseProviderOptions)({
2573
2621
  provider: "openai",
2574
2622
  providerOptions,
2575
2623
  schema: openaiResponsesProviderOptionsSchema
@@ -2704,98 +2752,98 @@ var OpenAIResponsesLanguageModel = class {
2704
2752
  responseHeaders,
2705
2753
  value: response,
2706
2754
  rawValue: rawResponse
2707
- } = await (0, import_provider_utils14.postJsonToApi)({
2755
+ } = await (0, import_provider_utils15.postJsonToApi)({
2708
2756
  url,
2709
- headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
2757
+ headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
2710
2758
  body,
2711
2759
  failedResponseHandler: openaiFailedResponseHandler,
2712
- successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
2713
- import_v416.z.object({
2714
- id: import_v416.z.string(),
2715
- created_at: import_v416.z.number(),
2716
- error: import_v416.z.object({
2717
- code: import_v416.z.string(),
2718
- message: import_v416.z.string()
2760
+ successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
2761
+ import_v417.z.object({
2762
+ id: import_v417.z.string(),
2763
+ created_at: import_v417.z.number(),
2764
+ error: import_v417.z.object({
2765
+ code: import_v417.z.string(),
2766
+ message: import_v417.z.string()
2719
2767
  }).nullish(),
2720
- model: import_v416.z.string(),
2721
- output: import_v416.z.array(
2722
- import_v416.z.discriminatedUnion("type", [
2723
- import_v416.z.object({
2724
- type: import_v416.z.literal("message"),
2725
- role: import_v416.z.literal("assistant"),
2726
- id: import_v416.z.string(),
2727
- content: import_v416.z.array(
2728
- import_v416.z.object({
2729
- type: import_v416.z.literal("output_text"),
2730
- text: import_v416.z.string(),
2768
+ model: import_v417.z.string(),
2769
+ output: import_v417.z.array(
2770
+ import_v417.z.discriminatedUnion("type", [
2771
+ import_v417.z.object({
2772
+ type: import_v417.z.literal("message"),
2773
+ role: import_v417.z.literal("assistant"),
2774
+ id: import_v417.z.string(),
2775
+ content: import_v417.z.array(
2776
+ import_v417.z.object({
2777
+ type: import_v417.z.literal("output_text"),
2778
+ text: import_v417.z.string(),
2731
2779
  logprobs: LOGPROBS_SCHEMA.nullish(),
2732
- annotations: import_v416.z.array(
2733
- import_v416.z.discriminatedUnion("type", [
2734
- import_v416.z.object({
2735
- type: import_v416.z.literal("url_citation"),
2736
- start_index: import_v416.z.number(),
2737
- end_index: import_v416.z.number(),
2738
- url: import_v416.z.string(),
2739
- title: import_v416.z.string()
2780
+ annotations: import_v417.z.array(
2781
+ import_v417.z.discriminatedUnion("type", [
2782
+ import_v417.z.object({
2783
+ type: import_v417.z.literal("url_citation"),
2784
+ start_index: import_v417.z.number(),
2785
+ end_index: import_v417.z.number(),
2786
+ url: import_v417.z.string(),
2787
+ title: import_v417.z.string()
2740
2788
  }),
2741
- import_v416.z.object({
2742
- type: import_v416.z.literal("file_citation"),
2743
- file_id: import_v416.z.string(),
2744
- filename: import_v416.z.string().nullish(),
2745
- index: import_v416.z.number().nullish(),
2746
- start_index: import_v416.z.number().nullish(),
2747
- end_index: import_v416.z.number().nullish(),
2748
- quote: import_v416.z.string().nullish()
2789
+ import_v417.z.object({
2790
+ type: import_v417.z.literal("file_citation"),
2791
+ file_id: import_v417.z.string(),
2792
+ filename: import_v417.z.string().nullish(),
2793
+ index: import_v417.z.number().nullish(),
2794
+ start_index: import_v417.z.number().nullish(),
2795
+ end_index: import_v417.z.number().nullish(),
2796
+ quote: import_v417.z.string().nullish()
2749
2797
  })
2750
2798
  ])
2751
2799
  )
2752
2800
  })
2753
2801
  )
2754
2802
  }),
2755
- import_v416.z.object({
2756
- type: import_v416.z.literal("function_call"),
2757
- call_id: import_v416.z.string(),
2758
- name: import_v416.z.string(),
2759
- arguments: import_v416.z.string(),
2760
- id: import_v416.z.string()
2803
+ import_v417.z.object({
2804
+ type: import_v417.z.literal("function_call"),
2805
+ call_id: import_v417.z.string(),
2806
+ name: import_v417.z.string(),
2807
+ arguments: import_v417.z.string(),
2808
+ id: import_v417.z.string()
2761
2809
  }),
2762
2810
  webSearchCallItem,
2763
- import_v416.z.object({
2764
- type: import_v416.z.literal("computer_call"),
2765
- id: import_v416.z.string(),
2766
- status: import_v416.z.string().optional()
2811
+ import_v417.z.object({
2812
+ type: import_v417.z.literal("computer_call"),
2813
+ id: import_v417.z.string(),
2814
+ status: import_v417.z.string().optional()
2767
2815
  }),
2768
- import_v416.z.object({
2769
- type: import_v416.z.literal("file_search_call"),
2770
- id: import_v416.z.string(),
2771
- status: import_v416.z.string().optional(),
2772
- queries: import_v416.z.array(import_v416.z.string()).nullish(),
2773
- results: import_v416.z.array(
2774
- import_v416.z.object({
2775
- attributes: import_v416.z.object({
2776
- file_id: import_v416.z.string(),
2777
- filename: import_v416.z.string(),
2778
- score: import_v416.z.number(),
2779
- text: import_v416.z.string()
2816
+ import_v417.z.object({
2817
+ type: import_v417.z.literal("file_search_call"),
2818
+ id: import_v417.z.string(),
2819
+ status: import_v417.z.string().optional(),
2820
+ queries: import_v417.z.array(import_v417.z.string()).nullish(),
2821
+ results: import_v417.z.array(
2822
+ import_v417.z.object({
2823
+ attributes: import_v417.z.object({
2824
+ file_id: import_v417.z.string(),
2825
+ filename: import_v417.z.string(),
2826
+ score: import_v417.z.number(),
2827
+ text: import_v417.z.string()
2780
2828
  })
2781
2829
  })
2782
2830
  ).nullish()
2783
2831
  }),
2784
- import_v416.z.object({
2785
- type: import_v416.z.literal("reasoning"),
2786
- id: import_v416.z.string(),
2787
- encrypted_content: import_v416.z.string().nullish(),
2788
- summary: import_v416.z.array(
2789
- import_v416.z.object({
2790
- type: import_v416.z.literal("summary_text"),
2791
- text: import_v416.z.string()
2832
+ import_v417.z.object({
2833
+ type: import_v417.z.literal("reasoning"),
2834
+ id: import_v417.z.string(),
2835
+ encrypted_content: import_v417.z.string().nullish(),
2836
+ summary: import_v417.z.array(
2837
+ import_v417.z.object({
2838
+ type: import_v417.z.literal("summary_text"),
2839
+ text: import_v417.z.string()
2792
2840
  })
2793
2841
  )
2794
2842
  })
2795
2843
  ])
2796
2844
  ),
2797
- service_tier: import_v416.z.string().nullish(),
2798
- incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullable(),
2845
+ service_tier: import_v417.z.string().nullish(),
2846
+ incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullable(),
2799
2847
  usage: usageSchema2
2800
2848
  })
2801
2849
  ),
@@ -2815,6 +2863,7 @@ var OpenAIResponsesLanguageModel = class {
2815
2863
  }
2816
2864
  const content = [];
2817
2865
  const logprobs = [];
2866
+ let hasFunctionCall = false;
2818
2867
  for (const part of response.output) {
2819
2868
  switch (part.type) {
2820
2869
  case "reasoning": {
@@ -2854,7 +2903,7 @@ var OpenAIResponsesLanguageModel = class {
2854
2903
  content.push({
2855
2904
  type: "source",
2856
2905
  sourceType: "url",
2857
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils14.generateId)(),
2906
+ id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils15.generateId)(),
2858
2907
  url: annotation.url,
2859
2908
  title: annotation.title
2860
2909
  });
@@ -2862,7 +2911,7 @@ var OpenAIResponsesLanguageModel = class {
2862
2911
  content.push({
2863
2912
  type: "source",
2864
2913
  sourceType: "document",
2865
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils14.generateId)(),
2914
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils15.generateId)(),
2866
2915
  mediaType: "text/plain",
2867
2916
  title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
2868
2917
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id
@@ -2873,6 +2922,7 @@ var OpenAIResponsesLanguageModel = class {
2873
2922
  break;
2874
2923
  }
2875
2924
  case "function_call": {
2925
+ hasFunctionCall = true;
2876
2926
  content.push({
2877
2927
  type: "tool-call",
2878
2928
  toolCallId: part.call_id,
@@ -2960,7 +3010,7 @@ var OpenAIResponsesLanguageModel = class {
2960
3010
  content,
2961
3011
  finishReason: mapOpenAIResponseFinishReason({
2962
3012
  finishReason: (_m = response.incomplete_details) == null ? void 0 : _m.reason,
2963
- hasToolCalls: content.some((part) => part.type === "tool-call")
3013
+ hasFunctionCall
2964
3014
  }),
2965
3015
  usage: {
2966
3016
  inputTokens: response.usage.input_tokens,
@@ -2983,18 +3033,18 @@ var OpenAIResponsesLanguageModel = class {
2983
3033
  }
2984
3034
  async doStream(options) {
2985
3035
  const { args: body, warnings } = await this.getArgs(options);
2986
- const { responseHeaders, value: response } = await (0, import_provider_utils14.postJsonToApi)({
3036
+ const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
2987
3037
  url: this.config.url({
2988
3038
  path: "/responses",
2989
3039
  modelId: this.modelId
2990
3040
  }),
2991
- headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
3041
+ headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
2992
3042
  body: {
2993
3043
  ...body,
2994
3044
  stream: true
2995
3045
  },
2996
3046
  failedResponseHandler: openaiFailedResponseHandler,
2997
- successfulResponseHandler: (0, import_provider_utils14.createEventSourceResponseHandler)(
3047
+ successfulResponseHandler: (0, import_provider_utils15.createEventSourceResponseHandler)(
2998
3048
  openaiResponsesChunkSchema
2999
3049
  ),
3000
3050
  abortSignal: options.abortSignal,
@@ -3010,7 +3060,7 @@ var OpenAIResponsesLanguageModel = class {
3010
3060
  const logprobs = [];
3011
3061
  let responseId = null;
3012
3062
  const ongoingToolCalls = {};
3013
- let hasToolCalls = false;
3063
+ let hasFunctionCall = false;
3014
3064
  const activeReasoning = {};
3015
3065
  let serviceTier;
3016
3066
  return {
@@ -3100,7 +3150,7 @@ var OpenAIResponsesLanguageModel = class {
3100
3150
  } else if (isResponseOutputItemDoneChunk(value)) {
3101
3151
  if (value.item.type === "function_call") {
3102
3152
  ongoingToolCalls[value.output_index] = void 0;
3103
- hasToolCalls = true;
3153
+ hasFunctionCall = true;
3104
3154
  controller.enqueue({
3105
3155
  type: "tool-input-end",
3106
3156
  id: value.item.call_id
@@ -3118,7 +3168,6 @@ var OpenAIResponsesLanguageModel = class {
3118
3168
  });
3119
3169
  } else if (value.item.type === "web_search_call") {
3120
3170
  ongoingToolCalls[value.output_index] = void 0;
3121
- hasToolCalls = true;
3122
3171
  controller.enqueue({
3123
3172
  type: "tool-input-end",
3124
3173
  id: value.item.id
@@ -3126,20 +3175,19 @@ var OpenAIResponsesLanguageModel = class {
3126
3175
  controller.enqueue({
3127
3176
  type: "tool-call",
3128
3177
  toolCallId: value.item.id,
3129
- toolName: "web_search_preview",
3178
+ toolName: "web_search",
3130
3179
  input: JSON.stringify({ action: value.item.action }),
3131
3180
  providerExecuted: true
3132
3181
  });
3133
3182
  controller.enqueue({
3134
3183
  type: "tool-result",
3135
3184
  toolCallId: value.item.id,
3136
- toolName: "web_search_preview",
3185
+ toolName: "web_search",
3137
3186
  result: { status: value.item.status },
3138
3187
  providerExecuted: true
3139
3188
  });
3140
3189
  } else if (value.item.type === "computer_call") {
3141
3190
  ongoingToolCalls[value.output_index] = void 0;
3142
- hasToolCalls = true;
3143
3191
  controller.enqueue({
3144
3192
  type: "tool-input-end",
3145
3193
  id: value.item.id
@@ -3163,7 +3211,6 @@ var OpenAIResponsesLanguageModel = class {
3163
3211
  });
3164
3212
  } else if (value.item.type === "file_search_call") {
3165
3213
  ongoingToolCalls[value.output_index] = void 0;
3166
- hasToolCalls = true;
3167
3214
  controller.enqueue({
3168
3215
  type: "tool-input-end",
3169
3216
  id: value.item.id
@@ -3264,7 +3311,7 @@ var OpenAIResponsesLanguageModel = class {
3264
3311
  } else if (isResponseFinishedChunk(value)) {
3265
3312
  finishReason = mapOpenAIResponseFinishReason({
3266
3313
  finishReason: (_h = value.response.incomplete_details) == null ? void 0 : _h.reason,
3267
- hasToolCalls
3314
+ hasFunctionCall
3268
3315
  });
3269
3316
  usage.inputTokens = value.response.usage.input_tokens;
3270
3317
  usage.outputTokens = value.response.usage.output_tokens;
@@ -3279,7 +3326,7 @@ var OpenAIResponsesLanguageModel = class {
3279
3326
  controller.enqueue({
3280
3327
  type: "source",
3281
3328
  sourceType: "url",
3282
- id: (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils14.generateId)(),
3329
+ id: (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils15.generateId)(),
3283
3330
  url: value.annotation.url,
3284
3331
  title: value.annotation.title
3285
3332
  });
@@ -3287,7 +3334,7 @@ var OpenAIResponsesLanguageModel = class {
3287
3334
  controller.enqueue({
3288
3335
  type: "source",
3289
3336
  sourceType: "document",
3290
- id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils14.generateId)(),
3337
+ id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils15.generateId)(),
3291
3338
  mediaType: "text/plain",
3292
3339
  title: (_t = (_s = value.annotation.quote) != null ? _s : value.annotation.filename) != null ? _t : "Document",
3293
3340
  filename: (_u = value.annotation.filename) != null ? _u : value.annotation.file_id
@@ -3323,176 +3370,176 @@ var OpenAIResponsesLanguageModel = class {
3323
3370
  };
3324
3371
  }
3325
3372
  };
3326
- var usageSchema2 = import_v416.z.object({
3327
- input_tokens: import_v416.z.number(),
3328
- input_tokens_details: import_v416.z.object({ cached_tokens: import_v416.z.number().nullish() }).nullish(),
3329
- output_tokens: import_v416.z.number(),
3330
- output_tokens_details: import_v416.z.object({ reasoning_tokens: import_v416.z.number().nullish() }).nullish()
3373
+ var usageSchema2 = import_v417.z.object({
3374
+ input_tokens: import_v417.z.number(),
3375
+ input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
3376
+ output_tokens: import_v417.z.number(),
3377
+ output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
3331
3378
  });
3332
- var textDeltaChunkSchema = import_v416.z.object({
3333
- type: import_v416.z.literal("response.output_text.delta"),
3334
- item_id: import_v416.z.string(),
3335
- delta: import_v416.z.string(),
3379
+ var textDeltaChunkSchema = import_v417.z.object({
3380
+ type: import_v417.z.literal("response.output_text.delta"),
3381
+ item_id: import_v417.z.string(),
3382
+ delta: import_v417.z.string(),
3336
3383
  logprobs: LOGPROBS_SCHEMA.nullish()
3337
3384
  });
3338
- var errorChunkSchema = import_v416.z.object({
3339
- type: import_v416.z.literal("error"),
3340
- code: import_v416.z.string(),
3341
- message: import_v416.z.string(),
3342
- param: import_v416.z.string().nullish(),
3343
- sequence_number: import_v416.z.number()
3385
+ var errorChunkSchema = import_v417.z.object({
3386
+ type: import_v417.z.literal("error"),
3387
+ code: import_v417.z.string(),
3388
+ message: import_v417.z.string(),
3389
+ param: import_v417.z.string().nullish(),
3390
+ sequence_number: import_v417.z.number()
3344
3391
  });
3345
- var responseFinishedChunkSchema = import_v416.z.object({
3346
- type: import_v416.z.enum(["response.completed", "response.incomplete"]),
3347
- response: import_v416.z.object({
3348
- incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
3392
+ var responseFinishedChunkSchema = import_v417.z.object({
3393
+ type: import_v417.z.enum(["response.completed", "response.incomplete"]),
3394
+ response: import_v417.z.object({
3395
+ incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
3349
3396
  usage: usageSchema2,
3350
- service_tier: import_v416.z.string().nullish()
3397
+ service_tier: import_v417.z.string().nullish()
3351
3398
  })
3352
3399
  });
3353
- var responseCreatedChunkSchema = import_v416.z.object({
3354
- type: import_v416.z.literal("response.created"),
3355
- response: import_v416.z.object({
3356
- id: import_v416.z.string(),
3357
- created_at: import_v416.z.number(),
3358
- model: import_v416.z.string(),
3359
- service_tier: import_v416.z.string().nullish()
3400
+ var responseCreatedChunkSchema = import_v417.z.object({
3401
+ type: import_v417.z.literal("response.created"),
3402
+ response: import_v417.z.object({
3403
+ id: import_v417.z.string(),
3404
+ created_at: import_v417.z.number(),
3405
+ model: import_v417.z.string(),
3406
+ service_tier: import_v417.z.string().nullish()
3360
3407
  })
3361
3408
  });
3362
- var responseOutputItemAddedSchema = import_v416.z.object({
3363
- type: import_v416.z.literal("response.output_item.added"),
3364
- output_index: import_v416.z.number(),
3365
- item: import_v416.z.discriminatedUnion("type", [
3366
- import_v416.z.object({
3367
- type: import_v416.z.literal("message"),
3368
- id: import_v416.z.string()
3409
+ var responseOutputItemAddedSchema = import_v417.z.object({
3410
+ type: import_v417.z.literal("response.output_item.added"),
3411
+ output_index: import_v417.z.number(),
3412
+ item: import_v417.z.discriminatedUnion("type", [
3413
+ import_v417.z.object({
3414
+ type: import_v417.z.literal("message"),
3415
+ id: import_v417.z.string()
3369
3416
  }),
3370
- import_v416.z.object({
3371
- type: import_v416.z.literal("reasoning"),
3372
- id: import_v416.z.string(),
3373
- encrypted_content: import_v416.z.string().nullish()
3417
+ import_v417.z.object({
3418
+ type: import_v417.z.literal("reasoning"),
3419
+ id: import_v417.z.string(),
3420
+ encrypted_content: import_v417.z.string().nullish()
3374
3421
  }),
3375
- import_v416.z.object({
3376
- type: import_v416.z.literal("function_call"),
3377
- id: import_v416.z.string(),
3378
- call_id: import_v416.z.string(),
3379
- name: import_v416.z.string(),
3380
- arguments: import_v416.z.string()
3422
+ import_v417.z.object({
3423
+ type: import_v417.z.literal("function_call"),
3424
+ id: import_v417.z.string(),
3425
+ call_id: import_v417.z.string(),
3426
+ name: import_v417.z.string(),
3427
+ arguments: import_v417.z.string()
3381
3428
  }),
3382
- import_v416.z.object({
3383
- type: import_v416.z.literal("web_search_call"),
3384
- id: import_v416.z.string(),
3385
- status: import_v416.z.string(),
3386
- action: import_v416.z.object({
3387
- type: import_v416.z.literal("search"),
3388
- query: import_v416.z.string().optional()
3429
+ import_v417.z.object({
3430
+ type: import_v417.z.literal("web_search_call"),
3431
+ id: import_v417.z.string(),
3432
+ status: import_v417.z.string(),
3433
+ action: import_v417.z.object({
3434
+ type: import_v417.z.literal("search"),
3435
+ query: import_v417.z.string().optional()
3389
3436
  }).nullish()
3390
3437
  }),
3391
- import_v416.z.object({
3392
- type: import_v416.z.literal("computer_call"),
3393
- id: import_v416.z.string(),
3394
- status: import_v416.z.string()
3438
+ import_v417.z.object({
3439
+ type: import_v417.z.literal("computer_call"),
3440
+ id: import_v417.z.string(),
3441
+ status: import_v417.z.string()
3395
3442
  }),
3396
- import_v416.z.object({
3397
- type: import_v416.z.literal("file_search_call"),
3398
- id: import_v416.z.string(),
3399
- status: import_v416.z.string(),
3400
- queries: import_v416.z.array(import_v416.z.string()).nullish(),
3401
- results: import_v416.z.array(
3402
- import_v416.z.object({
3403
- attributes: import_v416.z.object({
3404
- file_id: import_v416.z.string(),
3405
- filename: import_v416.z.string(),
3406
- score: import_v416.z.number(),
3407
- text: import_v416.z.string()
3443
+ import_v417.z.object({
3444
+ type: import_v417.z.literal("file_search_call"),
3445
+ id: import_v417.z.string(),
3446
+ status: import_v417.z.string(),
3447
+ queries: import_v417.z.array(import_v417.z.string()).nullish(),
3448
+ results: import_v417.z.array(
3449
+ import_v417.z.object({
3450
+ attributes: import_v417.z.object({
3451
+ file_id: import_v417.z.string(),
3452
+ filename: import_v417.z.string(),
3453
+ score: import_v417.z.number(),
3454
+ text: import_v417.z.string()
3408
3455
  })
3409
3456
  })
3410
3457
  ).optional()
3411
3458
  })
3412
3459
  ])
3413
3460
  });
3414
- var responseOutputItemDoneSchema = import_v416.z.object({
3415
- type: import_v416.z.literal("response.output_item.done"),
3416
- output_index: import_v416.z.number(),
3417
- item: import_v416.z.discriminatedUnion("type", [
3418
- import_v416.z.object({
3419
- type: import_v416.z.literal("message"),
3420
- id: import_v416.z.string()
3461
+ var responseOutputItemDoneSchema = import_v417.z.object({
3462
+ type: import_v417.z.literal("response.output_item.done"),
3463
+ output_index: import_v417.z.number(),
3464
+ item: import_v417.z.discriminatedUnion("type", [
3465
+ import_v417.z.object({
3466
+ type: import_v417.z.literal("message"),
3467
+ id: import_v417.z.string()
3421
3468
  }),
3422
- import_v416.z.object({
3423
- type: import_v416.z.literal("reasoning"),
3424
- id: import_v416.z.string(),
3425
- encrypted_content: import_v416.z.string().nullish()
3469
+ import_v417.z.object({
3470
+ type: import_v417.z.literal("reasoning"),
3471
+ id: import_v417.z.string(),
3472
+ encrypted_content: import_v417.z.string().nullish()
3426
3473
  }),
3427
- import_v416.z.object({
3428
- type: import_v416.z.literal("function_call"),
3429
- id: import_v416.z.string(),
3430
- call_id: import_v416.z.string(),
3431
- name: import_v416.z.string(),
3432
- arguments: import_v416.z.string(),
3433
- status: import_v416.z.literal("completed")
3474
+ import_v417.z.object({
3475
+ type: import_v417.z.literal("function_call"),
3476
+ id: import_v417.z.string(),
3477
+ call_id: import_v417.z.string(),
3478
+ name: import_v417.z.string(),
3479
+ arguments: import_v417.z.string(),
3480
+ status: import_v417.z.literal("completed")
3434
3481
  }),
3435
3482
  webSearchCallItem,
3436
- import_v416.z.object({
3437
- type: import_v416.z.literal("computer_call"),
3438
- id: import_v416.z.string(),
3439
- status: import_v416.z.literal("completed")
3483
+ import_v417.z.object({
3484
+ type: import_v417.z.literal("computer_call"),
3485
+ id: import_v417.z.string(),
3486
+ status: import_v417.z.literal("completed")
3440
3487
  }),
3441
- import_v416.z.object({
3442
- type: import_v416.z.literal("file_search_call"),
3443
- id: import_v416.z.string(),
3444
- status: import_v416.z.literal("completed"),
3445
- queries: import_v416.z.array(import_v416.z.string()).nullish(),
3446
- results: import_v416.z.array(
3447
- import_v416.z.object({
3448
- attributes: import_v416.z.object({
3449
- file_id: import_v416.z.string(),
3450
- filename: import_v416.z.string(),
3451
- score: import_v416.z.number(),
3452
- text: import_v416.z.string()
3488
+ import_v417.z.object({
3489
+ type: import_v417.z.literal("file_search_call"),
3490
+ id: import_v417.z.string(),
3491
+ status: import_v417.z.literal("completed"),
3492
+ queries: import_v417.z.array(import_v417.z.string()).nullish(),
3493
+ results: import_v417.z.array(
3494
+ import_v417.z.object({
3495
+ attributes: import_v417.z.object({
3496
+ file_id: import_v417.z.string(),
3497
+ filename: import_v417.z.string(),
3498
+ score: import_v417.z.number(),
3499
+ text: import_v417.z.string()
3453
3500
  })
3454
3501
  })
3455
3502
  ).nullish()
3456
3503
  })
3457
3504
  ])
3458
3505
  });
3459
- var responseFunctionCallArgumentsDeltaSchema = import_v416.z.object({
3460
- type: import_v416.z.literal("response.function_call_arguments.delta"),
3461
- item_id: import_v416.z.string(),
3462
- output_index: import_v416.z.number(),
3463
- delta: import_v416.z.string()
3506
+ var responseFunctionCallArgumentsDeltaSchema = import_v417.z.object({
3507
+ type: import_v417.z.literal("response.function_call_arguments.delta"),
3508
+ item_id: import_v417.z.string(),
3509
+ output_index: import_v417.z.number(),
3510
+ delta: import_v417.z.string()
3464
3511
  });
3465
- var responseAnnotationAddedSchema = import_v416.z.object({
3466
- type: import_v416.z.literal("response.output_text.annotation.added"),
3467
- annotation: import_v416.z.discriminatedUnion("type", [
3468
- import_v416.z.object({
3469
- type: import_v416.z.literal("url_citation"),
3470
- url: import_v416.z.string(),
3471
- title: import_v416.z.string()
3512
+ var responseAnnotationAddedSchema = import_v417.z.object({
3513
+ type: import_v417.z.literal("response.output_text.annotation.added"),
3514
+ annotation: import_v417.z.discriminatedUnion("type", [
3515
+ import_v417.z.object({
3516
+ type: import_v417.z.literal("url_citation"),
3517
+ url: import_v417.z.string(),
3518
+ title: import_v417.z.string()
3472
3519
  }),
3473
- import_v416.z.object({
3474
- type: import_v416.z.literal("file_citation"),
3475
- file_id: import_v416.z.string(),
3476
- filename: import_v416.z.string().nullish(),
3477
- index: import_v416.z.number().nullish(),
3478
- start_index: import_v416.z.number().nullish(),
3479
- end_index: import_v416.z.number().nullish(),
3480
- quote: import_v416.z.string().nullish()
3520
+ import_v417.z.object({
3521
+ type: import_v417.z.literal("file_citation"),
3522
+ file_id: import_v417.z.string(),
3523
+ filename: import_v417.z.string().nullish(),
3524
+ index: import_v417.z.number().nullish(),
3525
+ start_index: import_v417.z.number().nullish(),
3526
+ end_index: import_v417.z.number().nullish(),
3527
+ quote: import_v417.z.string().nullish()
3481
3528
  })
3482
3529
  ])
3483
3530
  });
3484
- var responseReasoningSummaryPartAddedSchema = import_v416.z.object({
3485
- type: import_v416.z.literal("response.reasoning_summary_part.added"),
3486
- item_id: import_v416.z.string(),
3487
- summary_index: import_v416.z.number()
3531
+ var responseReasoningSummaryPartAddedSchema = import_v417.z.object({
3532
+ type: import_v417.z.literal("response.reasoning_summary_part.added"),
3533
+ item_id: import_v417.z.string(),
3534
+ summary_index: import_v417.z.number()
3488
3535
  });
3489
- var responseReasoningSummaryTextDeltaSchema = import_v416.z.object({
3490
- type: import_v416.z.literal("response.reasoning_summary_text.delta"),
3491
- item_id: import_v416.z.string(),
3492
- summary_index: import_v416.z.number(),
3493
- delta: import_v416.z.string()
3536
+ var responseReasoningSummaryTextDeltaSchema = import_v417.z.object({
3537
+ type: import_v417.z.literal("response.reasoning_summary_text.delta"),
3538
+ item_id: import_v417.z.string(),
3539
+ summary_index: import_v417.z.number(),
3540
+ delta: import_v417.z.string()
3494
3541
  });
3495
- var openaiResponsesChunkSchema = import_v416.z.union([
3542
+ var openaiResponsesChunkSchema = import_v417.z.union([
3496
3543
  textDeltaChunkSchema,
3497
3544
  responseFinishedChunkSchema,
3498
3545
  responseCreatedChunkSchema,
@@ -3503,7 +3550,7 @@ var openaiResponsesChunkSchema = import_v416.z.union([
3503
3550
  responseReasoningSummaryPartAddedSchema,
3504
3551
  responseReasoningSummaryTextDeltaSchema,
3505
3552
  errorChunkSchema,
3506
- import_v416.z.object({ type: import_v416.z.string() }).loose()
3553
+ import_v417.z.object({ type: import_v417.z.string() }).loose()
3507
3554
  // fallback for unknown chunks
3508
3555
  ]);
3509
3556
  function isTextDeltaChunk(chunk) {
@@ -3576,27 +3623,27 @@ function getResponsesModelConfig(modelId) {
3576
3623
  isReasoningModel: false
3577
3624
  };
3578
3625
  }
3579
- var openaiResponsesProviderOptionsSchema = import_v416.z.object({
3580
- metadata: import_v416.z.any().nullish(),
3581
- parallelToolCalls: import_v416.z.boolean().nullish(),
3582
- previousResponseId: import_v416.z.string().nullish(),
3583
- store: import_v416.z.boolean().nullish(),
3584
- user: import_v416.z.string().nullish(),
3585
- reasoningEffort: import_v416.z.string().nullish(),
3586
- strictJsonSchema: import_v416.z.boolean().nullish(),
3587
- instructions: import_v416.z.string().nullish(),
3588
- reasoningSummary: import_v416.z.string().nullish(),
3589
- serviceTier: import_v416.z.enum(["auto", "flex", "priority"]).nullish(),
3590
- include: import_v416.z.array(
3591
- import_v416.z.enum([
3626
+ var openaiResponsesProviderOptionsSchema = import_v417.z.object({
3627
+ metadata: import_v417.z.any().nullish(),
3628
+ parallelToolCalls: import_v417.z.boolean().nullish(),
3629
+ previousResponseId: import_v417.z.string().nullish(),
3630
+ store: import_v417.z.boolean().nullish(),
3631
+ user: import_v417.z.string().nullish(),
3632
+ reasoningEffort: import_v417.z.string().nullish(),
3633
+ strictJsonSchema: import_v417.z.boolean().nullish(),
3634
+ instructions: import_v417.z.string().nullish(),
3635
+ reasoningSummary: import_v417.z.string().nullish(),
3636
+ serviceTier: import_v417.z.enum(["auto", "flex", "priority"]).nullish(),
3637
+ include: import_v417.z.array(
3638
+ import_v417.z.enum([
3592
3639
  "reasoning.encrypted_content",
3593
3640
  "file_search_call.results",
3594
3641
  "message.output_text.logprobs"
3595
3642
  ])
3596
3643
  ).nullish(),
3597
- textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
3598
- promptCacheKey: import_v416.z.string().nullish(),
3599
- safetyIdentifier: import_v416.z.string().nullish(),
3644
+ textVerbosity: import_v417.z.enum(["low", "medium", "high"]).nullish(),
3645
+ promptCacheKey: import_v417.z.string().nullish(),
3646
+ safetyIdentifier: import_v417.z.string().nullish(),
3600
3647
  /**
3601
3648
  * Return the log probabilities of the tokens.
3602
3649
  *
@@ -3609,7 +3656,7 @@ var openaiResponsesProviderOptionsSchema = import_v416.z.object({
3609
3656
  * @see https://platform.openai.com/docs/api-reference/responses/create
3610
3657
  * @see https://cookbook.openai.com/examples/using_logprobs
3611
3658
  */
3612
- logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
3659
+ logprobs: import_v417.z.union([import_v417.z.boolean(), import_v417.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
3613
3660
  });
3614
3661
  // Annotate the CommonJS export names for ESM import in node:
3615
3662
  0 && (module.exports = {