@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.
@@ -377,23 +377,11 @@ var compoundFilterSchema = import_v43.z.object({
377
377
  });
378
378
  var filtersSchema = import_v43.z.union([comparisonFilterSchema, compoundFilterSchema]);
379
379
  var fileSearchArgsSchema = import_v43.z.object({
380
- /**
381
- * List of vector store IDs to search through. If not provided, searches all available vector stores.
382
- */
383
380
  vectorStoreIds: import_v43.z.array(import_v43.z.string()).optional(),
384
- /**
385
- * Maximum number of search results to return. Defaults to 10.
386
- */
387
381
  maxNumResults: import_v43.z.number().optional(),
388
- /**
389
- * Ranking options for the search.
390
- */
391
382
  ranking: import_v43.z.object({
392
383
  ranker: import_v43.z.enum(["auto", "default-2024-08-21"]).optional()
393
384
  }).optional(),
394
- /**
395
- * A filter to apply based on file attributes.
396
- */
397
385
  filters: filtersSchema.optional()
398
386
  });
399
387
  var fileSearch = (0, import_provider_utils3.createProviderDefinedToolFactory)({
@@ -2149,8 +2137,8 @@ var OpenAISpeechModel = class {
2149
2137
 
2150
2138
  // src/responses/openai-responses-language-model.ts
2151
2139
  var import_provider8 = require("@ai-sdk/provider");
2152
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
2153
- var import_v416 = require("zod/v4");
2140
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
2141
+ var import_v417 = require("zod/v4");
2154
2142
 
2155
2143
  // src/responses/convert-to-openai-responses-messages.ts
2156
2144
  var import_provider6 = require("@ai-sdk/provider");
@@ -2353,18 +2341,18 @@ var openaiResponsesReasoningProviderOptionsSchema = import_v414.z.object({
2353
2341
  // src/responses/map-openai-responses-finish-reason.ts
2354
2342
  function mapOpenAIResponseFinishReason({
2355
2343
  finishReason,
2356
- hasToolCalls
2344
+ hasFunctionCall
2357
2345
  }) {
2358
2346
  switch (finishReason) {
2359
2347
  case void 0:
2360
2348
  case null:
2361
- return hasToolCalls ? "tool-calls" : "stop";
2349
+ return hasFunctionCall ? "tool-calls" : "stop";
2362
2350
  case "max_output_tokens":
2363
2351
  return "length";
2364
2352
  case "content_filter":
2365
2353
  return "content-filter";
2366
2354
  default:
2367
- return hasToolCalls ? "tool-calls" : "unknown";
2355
+ return hasFunctionCall ? "tool-calls" : "unknown";
2368
2356
  }
2369
2357
  }
2370
2358
 
@@ -2388,6 +2376,44 @@ var codeInterpreter = (0, import_provider_utils13.createProviderDefinedToolFacto
2388
2376
  inputSchema: import_v415.z.object({})
2389
2377
  });
2390
2378
 
2379
+ // src/tool/web-search.ts
2380
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
2381
+ var import_v416 = require("zod/v4");
2382
+ var webSearchArgsSchema = import_v416.z.object({
2383
+ filters: import_v416.z.object({
2384
+ allowedDomains: import_v416.z.array(import_v416.z.string()).optional()
2385
+ }).optional(),
2386
+ searchContextSize: import_v416.z.enum(["low", "medium", "high"]).optional(),
2387
+ userLocation: import_v416.z.object({
2388
+ type: import_v416.z.literal("approximate"),
2389
+ country: import_v416.z.string().optional(),
2390
+ city: import_v416.z.string().optional(),
2391
+ region: import_v416.z.string().optional(),
2392
+ timezone: import_v416.z.string().optional()
2393
+ }).optional()
2394
+ });
2395
+ var factory = (0, import_provider_utils14.createProviderDefinedToolFactory)({
2396
+ id: "openai.web_search",
2397
+ name: "web_search",
2398
+ inputSchema: import_v416.z.object({
2399
+ action: import_v416.z.discriminatedUnion("type", [
2400
+ import_v416.z.object({
2401
+ type: import_v416.z.literal("search"),
2402
+ query: import_v416.z.string().nullish()
2403
+ }),
2404
+ import_v416.z.object({
2405
+ type: import_v416.z.literal("open_page"),
2406
+ url: import_v416.z.string()
2407
+ }),
2408
+ import_v416.z.object({
2409
+ type: import_v416.z.literal("find"),
2410
+ url: import_v416.z.string(),
2411
+ pattern: import_v416.z.string()
2412
+ })
2413
+ ]).nullish()
2414
+ })
2415
+ });
2416
+
2391
2417
  // src/responses/openai-responses-prepare-tools.ts
2392
2418
  function prepareResponsesTools({
2393
2419
  tools,
@@ -2433,6 +2459,16 @@ function prepareResponsesTools({
2433
2459
  });
2434
2460
  break;
2435
2461
  }
2462
+ case "openai.web_search": {
2463
+ const args = webSearchArgsSchema.parse(tool.args);
2464
+ openaiTools.push({
2465
+ type: "web_search",
2466
+ filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
2467
+ search_context_size: args.searchContextSize,
2468
+ user_location: args.userLocation
2469
+ });
2470
+ break;
2471
+ }
2436
2472
  case "openai.code_interpreter": {
2437
2473
  const args = codeInterpreterArgsSchema.parse(tool.args);
2438
2474
  openaiTools.push({
@@ -2465,7 +2501,7 @@ function prepareResponsesTools({
2465
2501
  case "tool":
2466
2502
  return {
2467
2503
  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 },
2504
+ 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
2505
  toolWarnings
2470
2506
  };
2471
2507
  default: {
@@ -2478,35 +2514,35 @@ function prepareResponsesTools({
2478
2514
  }
2479
2515
 
2480
2516
  // 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()
2517
+ var webSearchCallItem = import_v417.z.object({
2518
+ type: import_v417.z.literal("web_search_call"),
2519
+ id: import_v417.z.string(),
2520
+ status: import_v417.z.string(),
2521
+ action: import_v417.z.discriminatedUnion("type", [
2522
+ import_v417.z.object({
2523
+ type: import_v417.z.literal("search"),
2524
+ query: import_v417.z.string().nullish()
2489
2525
  }),
2490
- import_v416.z.object({
2491
- type: import_v416.z.literal("open_page"),
2492
- url: import_v416.z.string()
2526
+ import_v417.z.object({
2527
+ type: import_v417.z.literal("open_page"),
2528
+ url: import_v417.z.string()
2493
2529
  }),
2494
- import_v416.z.object({
2495
- type: import_v416.z.literal("find"),
2496
- url: import_v416.z.string(),
2497
- pattern: import_v416.z.string()
2530
+ import_v417.z.object({
2531
+ type: import_v417.z.literal("find"),
2532
+ url: import_v417.z.string(),
2533
+ pattern: import_v417.z.string()
2498
2534
  })
2499
2535
  ]).nullish()
2500
2536
  });
2501
2537
  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()
2538
+ var LOGPROBS_SCHEMA = import_v417.z.array(
2539
+ import_v417.z.object({
2540
+ token: import_v417.z.string(),
2541
+ logprob: import_v417.z.number(),
2542
+ top_logprobs: import_v417.z.array(
2543
+ import_v417.z.object({
2544
+ token: import_v417.z.string(),
2545
+ logprob: import_v417.z.number()
2510
2546
  })
2511
2547
  )
2512
2548
  })
@@ -2569,7 +2605,7 @@ var OpenAIResponsesLanguageModel = class {
2569
2605
  fileIdPrefixes: this.config.fileIdPrefixes
2570
2606
  });
2571
2607
  warnings.push(...messageWarnings);
2572
- const openaiOptions = await (0, import_provider_utils14.parseProviderOptions)({
2608
+ const openaiOptions = await (0, import_provider_utils15.parseProviderOptions)({
2573
2609
  provider: "openai",
2574
2610
  providerOptions,
2575
2611
  schema: openaiResponsesProviderOptionsSchema
@@ -2704,98 +2740,98 @@ var OpenAIResponsesLanguageModel = class {
2704
2740
  responseHeaders,
2705
2741
  value: response,
2706
2742
  rawValue: rawResponse
2707
- } = await (0, import_provider_utils14.postJsonToApi)({
2743
+ } = await (0, import_provider_utils15.postJsonToApi)({
2708
2744
  url,
2709
- headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
2745
+ headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
2710
2746
  body,
2711
2747
  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()
2748
+ successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
2749
+ import_v417.z.object({
2750
+ id: import_v417.z.string(),
2751
+ created_at: import_v417.z.number(),
2752
+ error: import_v417.z.object({
2753
+ code: import_v417.z.string(),
2754
+ message: import_v417.z.string()
2719
2755
  }).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(),
2756
+ model: import_v417.z.string(),
2757
+ output: import_v417.z.array(
2758
+ import_v417.z.discriminatedUnion("type", [
2759
+ import_v417.z.object({
2760
+ type: import_v417.z.literal("message"),
2761
+ role: import_v417.z.literal("assistant"),
2762
+ id: import_v417.z.string(),
2763
+ content: import_v417.z.array(
2764
+ import_v417.z.object({
2765
+ type: import_v417.z.literal("output_text"),
2766
+ text: import_v417.z.string(),
2731
2767
  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()
2768
+ annotations: import_v417.z.array(
2769
+ import_v417.z.discriminatedUnion("type", [
2770
+ import_v417.z.object({
2771
+ type: import_v417.z.literal("url_citation"),
2772
+ start_index: import_v417.z.number(),
2773
+ end_index: import_v417.z.number(),
2774
+ url: import_v417.z.string(),
2775
+ title: import_v417.z.string()
2740
2776
  }),
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()
2777
+ import_v417.z.object({
2778
+ type: import_v417.z.literal("file_citation"),
2779
+ file_id: import_v417.z.string(),
2780
+ filename: import_v417.z.string().nullish(),
2781
+ index: import_v417.z.number().nullish(),
2782
+ start_index: import_v417.z.number().nullish(),
2783
+ end_index: import_v417.z.number().nullish(),
2784
+ quote: import_v417.z.string().nullish()
2749
2785
  })
2750
2786
  ])
2751
2787
  )
2752
2788
  })
2753
2789
  )
2754
2790
  }),
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()
2791
+ import_v417.z.object({
2792
+ type: import_v417.z.literal("function_call"),
2793
+ call_id: import_v417.z.string(),
2794
+ name: import_v417.z.string(),
2795
+ arguments: import_v417.z.string(),
2796
+ id: import_v417.z.string()
2761
2797
  }),
2762
2798
  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()
2799
+ import_v417.z.object({
2800
+ type: import_v417.z.literal("computer_call"),
2801
+ id: import_v417.z.string(),
2802
+ status: import_v417.z.string().optional()
2767
2803
  }),
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()
2804
+ import_v417.z.object({
2805
+ type: import_v417.z.literal("file_search_call"),
2806
+ id: import_v417.z.string(),
2807
+ status: import_v417.z.string().optional(),
2808
+ queries: import_v417.z.array(import_v417.z.string()).nullish(),
2809
+ results: import_v417.z.array(
2810
+ import_v417.z.object({
2811
+ attributes: import_v417.z.object({
2812
+ file_id: import_v417.z.string(),
2813
+ filename: import_v417.z.string(),
2814
+ score: import_v417.z.number(),
2815
+ text: import_v417.z.string()
2780
2816
  })
2781
2817
  })
2782
2818
  ).nullish()
2783
2819
  }),
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()
2820
+ import_v417.z.object({
2821
+ type: import_v417.z.literal("reasoning"),
2822
+ id: import_v417.z.string(),
2823
+ encrypted_content: import_v417.z.string().nullish(),
2824
+ summary: import_v417.z.array(
2825
+ import_v417.z.object({
2826
+ type: import_v417.z.literal("summary_text"),
2827
+ text: import_v417.z.string()
2792
2828
  })
2793
2829
  )
2794
2830
  })
2795
2831
  ])
2796
2832
  ),
2797
- service_tier: import_v416.z.string().nullish(),
2798
- incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullable(),
2833
+ service_tier: import_v417.z.string().nullish(),
2834
+ incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullable(),
2799
2835
  usage: usageSchema2
2800
2836
  })
2801
2837
  ),
@@ -2815,6 +2851,7 @@ var OpenAIResponsesLanguageModel = class {
2815
2851
  }
2816
2852
  const content = [];
2817
2853
  const logprobs = [];
2854
+ let hasFunctionCall = false;
2818
2855
  for (const part of response.output) {
2819
2856
  switch (part.type) {
2820
2857
  case "reasoning": {
@@ -2854,7 +2891,7 @@ var OpenAIResponsesLanguageModel = class {
2854
2891
  content.push({
2855
2892
  type: "source",
2856
2893
  sourceType: "url",
2857
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils14.generateId)(),
2894
+ id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils15.generateId)(),
2858
2895
  url: annotation.url,
2859
2896
  title: annotation.title
2860
2897
  });
@@ -2862,7 +2899,7 @@ var OpenAIResponsesLanguageModel = class {
2862
2899
  content.push({
2863
2900
  type: "source",
2864
2901
  sourceType: "document",
2865
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils14.generateId)(),
2902
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils15.generateId)(),
2866
2903
  mediaType: "text/plain",
2867
2904
  title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
2868
2905
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id
@@ -2873,6 +2910,7 @@ var OpenAIResponsesLanguageModel = class {
2873
2910
  break;
2874
2911
  }
2875
2912
  case "function_call": {
2913
+ hasFunctionCall = true;
2876
2914
  content.push({
2877
2915
  type: "tool-call",
2878
2916
  toolCallId: part.call_id,
@@ -2960,7 +2998,7 @@ var OpenAIResponsesLanguageModel = class {
2960
2998
  content,
2961
2999
  finishReason: mapOpenAIResponseFinishReason({
2962
3000
  finishReason: (_m = response.incomplete_details) == null ? void 0 : _m.reason,
2963
- hasToolCalls: content.some((part) => part.type === "tool-call")
3001
+ hasFunctionCall
2964
3002
  }),
2965
3003
  usage: {
2966
3004
  inputTokens: response.usage.input_tokens,
@@ -2983,18 +3021,18 @@ var OpenAIResponsesLanguageModel = class {
2983
3021
  }
2984
3022
  async doStream(options) {
2985
3023
  const { args: body, warnings } = await this.getArgs(options);
2986
- const { responseHeaders, value: response } = await (0, import_provider_utils14.postJsonToApi)({
3024
+ const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
2987
3025
  url: this.config.url({
2988
3026
  path: "/responses",
2989
3027
  modelId: this.modelId
2990
3028
  }),
2991
- headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
3029
+ headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
2992
3030
  body: {
2993
3031
  ...body,
2994
3032
  stream: true
2995
3033
  },
2996
3034
  failedResponseHandler: openaiFailedResponseHandler,
2997
- successfulResponseHandler: (0, import_provider_utils14.createEventSourceResponseHandler)(
3035
+ successfulResponseHandler: (0, import_provider_utils15.createEventSourceResponseHandler)(
2998
3036
  openaiResponsesChunkSchema
2999
3037
  ),
3000
3038
  abortSignal: options.abortSignal,
@@ -3010,7 +3048,7 @@ var OpenAIResponsesLanguageModel = class {
3010
3048
  const logprobs = [];
3011
3049
  let responseId = null;
3012
3050
  const ongoingToolCalls = {};
3013
- let hasToolCalls = false;
3051
+ let hasFunctionCall = false;
3014
3052
  const activeReasoning = {};
3015
3053
  let serviceTier;
3016
3054
  return {
@@ -3100,7 +3138,7 @@ var OpenAIResponsesLanguageModel = class {
3100
3138
  } else if (isResponseOutputItemDoneChunk(value)) {
3101
3139
  if (value.item.type === "function_call") {
3102
3140
  ongoingToolCalls[value.output_index] = void 0;
3103
- hasToolCalls = true;
3141
+ hasFunctionCall = true;
3104
3142
  controller.enqueue({
3105
3143
  type: "tool-input-end",
3106
3144
  id: value.item.call_id
@@ -3118,7 +3156,6 @@ var OpenAIResponsesLanguageModel = class {
3118
3156
  });
3119
3157
  } else if (value.item.type === "web_search_call") {
3120
3158
  ongoingToolCalls[value.output_index] = void 0;
3121
- hasToolCalls = true;
3122
3159
  controller.enqueue({
3123
3160
  type: "tool-input-end",
3124
3161
  id: value.item.id
@@ -3126,20 +3163,19 @@ var OpenAIResponsesLanguageModel = class {
3126
3163
  controller.enqueue({
3127
3164
  type: "tool-call",
3128
3165
  toolCallId: value.item.id,
3129
- toolName: "web_search_preview",
3166
+ toolName: "web_search",
3130
3167
  input: JSON.stringify({ action: value.item.action }),
3131
3168
  providerExecuted: true
3132
3169
  });
3133
3170
  controller.enqueue({
3134
3171
  type: "tool-result",
3135
3172
  toolCallId: value.item.id,
3136
- toolName: "web_search_preview",
3173
+ toolName: "web_search",
3137
3174
  result: { status: value.item.status },
3138
3175
  providerExecuted: true
3139
3176
  });
3140
3177
  } else if (value.item.type === "computer_call") {
3141
3178
  ongoingToolCalls[value.output_index] = void 0;
3142
- hasToolCalls = true;
3143
3179
  controller.enqueue({
3144
3180
  type: "tool-input-end",
3145
3181
  id: value.item.id
@@ -3163,7 +3199,6 @@ var OpenAIResponsesLanguageModel = class {
3163
3199
  });
3164
3200
  } else if (value.item.type === "file_search_call") {
3165
3201
  ongoingToolCalls[value.output_index] = void 0;
3166
- hasToolCalls = true;
3167
3202
  controller.enqueue({
3168
3203
  type: "tool-input-end",
3169
3204
  id: value.item.id
@@ -3264,7 +3299,7 @@ var OpenAIResponsesLanguageModel = class {
3264
3299
  } else if (isResponseFinishedChunk(value)) {
3265
3300
  finishReason = mapOpenAIResponseFinishReason({
3266
3301
  finishReason: (_h = value.response.incomplete_details) == null ? void 0 : _h.reason,
3267
- hasToolCalls
3302
+ hasFunctionCall
3268
3303
  });
3269
3304
  usage.inputTokens = value.response.usage.input_tokens;
3270
3305
  usage.outputTokens = value.response.usage.output_tokens;
@@ -3279,7 +3314,7 @@ var OpenAIResponsesLanguageModel = class {
3279
3314
  controller.enqueue({
3280
3315
  type: "source",
3281
3316
  sourceType: "url",
3282
- id: (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils14.generateId)(),
3317
+ id: (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils15.generateId)(),
3283
3318
  url: value.annotation.url,
3284
3319
  title: value.annotation.title
3285
3320
  });
@@ -3287,7 +3322,7 @@ var OpenAIResponsesLanguageModel = class {
3287
3322
  controller.enqueue({
3288
3323
  type: "source",
3289
3324
  sourceType: "document",
3290
- id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils14.generateId)(),
3325
+ id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils15.generateId)(),
3291
3326
  mediaType: "text/plain",
3292
3327
  title: (_t = (_s = value.annotation.quote) != null ? _s : value.annotation.filename) != null ? _t : "Document",
3293
3328
  filename: (_u = value.annotation.filename) != null ? _u : value.annotation.file_id
@@ -3323,176 +3358,176 @@ var OpenAIResponsesLanguageModel = class {
3323
3358
  };
3324
3359
  }
3325
3360
  };
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()
3361
+ var usageSchema2 = import_v417.z.object({
3362
+ input_tokens: import_v417.z.number(),
3363
+ input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
3364
+ output_tokens: import_v417.z.number(),
3365
+ output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
3331
3366
  });
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(),
3367
+ var textDeltaChunkSchema = import_v417.z.object({
3368
+ type: import_v417.z.literal("response.output_text.delta"),
3369
+ item_id: import_v417.z.string(),
3370
+ delta: import_v417.z.string(),
3336
3371
  logprobs: LOGPROBS_SCHEMA.nullish()
3337
3372
  });
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()
3373
+ var errorChunkSchema = import_v417.z.object({
3374
+ type: import_v417.z.literal("error"),
3375
+ code: import_v417.z.string(),
3376
+ message: import_v417.z.string(),
3377
+ param: import_v417.z.string().nullish(),
3378
+ sequence_number: import_v417.z.number()
3344
3379
  });
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(),
3380
+ var responseFinishedChunkSchema = import_v417.z.object({
3381
+ type: import_v417.z.enum(["response.completed", "response.incomplete"]),
3382
+ response: import_v417.z.object({
3383
+ incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
3349
3384
  usage: usageSchema2,
3350
- service_tier: import_v416.z.string().nullish()
3385
+ service_tier: import_v417.z.string().nullish()
3351
3386
  })
3352
3387
  });
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()
3388
+ var responseCreatedChunkSchema = import_v417.z.object({
3389
+ type: import_v417.z.literal("response.created"),
3390
+ response: import_v417.z.object({
3391
+ id: import_v417.z.string(),
3392
+ created_at: import_v417.z.number(),
3393
+ model: import_v417.z.string(),
3394
+ service_tier: import_v417.z.string().nullish()
3360
3395
  })
3361
3396
  });
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()
3397
+ var responseOutputItemAddedSchema = import_v417.z.object({
3398
+ type: import_v417.z.literal("response.output_item.added"),
3399
+ output_index: import_v417.z.number(),
3400
+ item: import_v417.z.discriminatedUnion("type", [
3401
+ import_v417.z.object({
3402
+ type: import_v417.z.literal("message"),
3403
+ id: import_v417.z.string()
3369
3404
  }),
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()
3405
+ import_v417.z.object({
3406
+ type: import_v417.z.literal("reasoning"),
3407
+ id: import_v417.z.string(),
3408
+ encrypted_content: import_v417.z.string().nullish()
3374
3409
  }),
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()
3410
+ import_v417.z.object({
3411
+ type: import_v417.z.literal("function_call"),
3412
+ id: import_v417.z.string(),
3413
+ call_id: import_v417.z.string(),
3414
+ name: import_v417.z.string(),
3415
+ arguments: import_v417.z.string()
3381
3416
  }),
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()
3417
+ import_v417.z.object({
3418
+ type: import_v417.z.literal("web_search_call"),
3419
+ id: import_v417.z.string(),
3420
+ status: import_v417.z.string(),
3421
+ action: import_v417.z.object({
3422
+ type: import_v417.z.literal("search"),
3423
+ query: import_v417.z.string().optional()
3389
3424
  }).nullish()
3390
3425
  }),
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()
3426
+ import_v417.z.object({
3427
+ type: import_v417.z.literal("computer_call"),
3428
+ id: import_v417.z.string(),
3429
+ status: import_v417.z.string()
3395
3430
  }),
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()
3431
+ import_v417.z.object({
3432
+ type: import_v417.z.literal("file_search_call"),
3433
+ id: import_v417.z.string(),
3434
+ status: import_v417.z.string(),
3435
+ queries: import_v417.z.array(import_v417.z.string()).nullish(),
3436
+ results: import_v417.z.array(
3437
+ import_v417.z.object({
3438
+ attributes: import_v417.z.object({
3439
+ file_id: import_v417.z.string(),
3440
+ filename: import_v417.z.string(),
3441
+ score: import_v417.z.number(),
3442
+ text: import_v417.z.string()
3408
3443
  })
3409
3444
  })
3410
3445
  ).optional()
3411
3446
  })
3412
3447
  ])
3413
3448
  });
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()
3449
+ var responseOutputItemDoneSchema = import_v417.z.object({
3450
+ type: import_v417.z.literal("response.output_item.done"),
3451
+ output_index: import_v417.z.number(),
3452
+ item: import_v417.z.discriminatedUnion("type", [
3453
+ import_v417.z.object({
3454
+ type: import_v417.z.literal("message"),
3455
+ id: import_v417.z.string()
3421
3456
  }),
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()
3457
+ import_v417.z.object({
3458
+ type: import_v417.z.literal("reasoning"),
3459
+ id: import_v417.z.string(),
3460
+ encrypted_content: import_v417.z.string().nullish()
3426
3461
  }),
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")
3462
+ import_v417.z.object({
3463
+ type: import_v417.z.literal("function_call"),
3464
+ id: import_v417.z.string(),
3465
+ call_id: import_v417.z.string(),
3466
+ name: import_v417.z.string(),
3467
+ arguments: import_v417.z.string(),
3468
+ status: import_v417.z.literal("completed")
3434
3469
  }),
3435
3470
  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")
3471
+ import_v417.z.object({
3472
+ type: import_v417.z.literal("computer_call"),
3473
+ id: import_v417.z.string(),
3474
+ status: import_v417.z.literal("completed")
3440
3475
  }),
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()
3476
+ import_v417.z.object({
3477
+ type: import_v417.z.literal("file_search_call"),
3478
+ id: import_v417.z.string(),
3479
+ status: import_v417.z.literal("completed"),
3480
+ queries: import_v417.z.array(import_v417.z.string()).nullish(),
3481
+ results: import_v417.z.array(
3482
+ import_v417.z.object({
3483
+ attributes: import_v417.z.object({
3484
+ file_id: import_v417.z.string(),
3485
+ filename: import_v417.z.string(),
3486
+ score: import_v417.z.number(),
3487
+ text: import_v417.z.string()
3453
3488
  })
3454
3489
  })
3455
3490
  ).nullish()
3456
3491
  })
3457
3492
  ])
3458
3493
  });
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()
3494
+ var responseFunctionCallArgumentsDeltaSchema = import_v417.z.object({
3495
+ type: import_v417.z.literal("response.function_call_arguments.delta"),
3496
+ item_id: import_v417.z.string(),
3497
+ output_index: import_v417.z.number(),
3498
+ delta: import_v417.z.string()
3464
3499
  });
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()
3500
+ var responseAnnotationAddedSchema = import_v417.z.object({
3501
+ type: import_v417.z.literal("response.output_text.annotation.added"),
3502
+ annotation: import_v417.z.discriminatedUnion("type", [
3503
+ import_v417.z.object({
3504
+ type: import_v417.z.literal("url_citation"),
3505
+ url: import_v417.z.string(),
3506
+ title: import_v417.z.string()
3472
3507
  }),
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()
3508
+ import_v417.z.object({
3509
+ type: import_v417.z.literal("file_citation"),
3510
+ file_id: import_v417.z.string(),
3511
+ filename: import_v417.z.string().nullish(),
3512
+ index: import_v417.z.number().nullish(),
3513
+ start_index: import_v417.z.number().nullish(),
3514
+ end_index: import_v417.z.number().nullish(),
3515
+ quote: import_v417.z.string().nullish()
3481
3516
  })
3482
3517
  ])
3483
3518
  });
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()
3519
+ var responseReasoningSummaryPartAddedSchema = import_v417.z.object({
3520
+ type: import_v417.z.literal("response.reasoning_summary_part.added"),
3521
+ item_id: import_v417.z.string(),
3522
+ summary_index: import_v417.z.number()
3488
3523
  });
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()
3524
+ var responseReasoningSummaryTextDeltaSchema = import_v417.z.object({
3525
+ type: import_v417.z.literal("response.reasoning_summary_text.delta"),
3526
+ item_id: import_v417.z.string(),
3527
+ summary_index: import_v417.z.number(),
3528
+ delta: import_v417.z.string()
3494
3529
  });
3495
- var openaiResponsesChunkSchema = import_v416.z.union([
3530
+ var openaiResponsesChunkSchema = import_v417.z.union([
3496
3531
  textDeltaChunkSchema,
3497
3532
  responseFinishedChunkSchema,
3498
3533
  responseCreatedChunkSchema,
@@ -3503,7 +3538,7 @@ var openaiResponsesChunkSchema = import_v416.z.union([
3503
3538
  responseReasoningSummaryPartAddedSchema,
3504
3539
  responseReasoningSummaryTextDeltaSchema,
3505
3540
  errorChunkSchema,
3506
- import_v416.z.object({ type: import_v416.z.string() }).loose()
3541
+ import_v417.z.object({ type: import_v417.z.string() }).loose()
3507
3542
  // fallback for unknown chunks
3508
3543
  ]);
3509
3544
  function isTextDeltaChunk(chunk) {
@@ -3576,27 +3611,27 @@ function getResponsesModelConfig(modelId) {
3576
3611
  isReasoningModel: false
3577
3612
  };
3578
3613
  }
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([
3614
+ var openaiResponsesProviderOptionsSchema = import_v417.z.object({
3615
+ metadata: import_v417.z.any().nullish(),
3616
+ parallelToolCalls: import_v417.z.boolean().nullish(),
3617
+ previousResponseId: import_v417.z.string().nullish(),
3618
+ store: import_v417.z.boolean().nullish(),
3619
+ user: import_v417.z.string().nullish(),
3620
+ reasoningEffort: import_v417.z.string().nullish(),
3621
+ strictJsonSchema: import_v417.z.boolean().nullish(),
3622
+ instructions: import_v417.z.string().nullish(),
3623
+ reasoningSummary: import_v417.z.string().nullish(),
3624
+ serviceTier: import_v417.z.enum(["auto", "flex", "priority"]).nullish(),
3625
+ include: import_v417.z.array(
3626
+ import_v417.z.enum([
3592
3627
  "reasoning.encrypted_content",
3593
3628
  "file_search_call.results",
3594
3629
  "message.output_text.logprobs"
3595
3630
  ])
3596
3631
  ).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(),
3632
+ textVerbosity: import_v417.z.enum(["low", "medium", "high"]).nullish(),
3633
+ promptCacheKey: import_v417.z.string().nullish(),
3634
+ safetyIdentifier: import_v417.z.string().nullish(),
3600
3635
  /**
3601
3636
  * Return the log probabilities of the tokens.
3602
3637
  *
@@ -3609,7 +3644,7 @@ var openaiResponsesProviderOptionsSchema = import_v416.z.object({
3609
3644
  * @see https://platform.openai.com/docs/api-reference/responses/create
3610
3645
  * @see https://cookbook.openai.com/examples/using_logprobs
3611
3646
  */
3612
- logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
3647
+ logprobs: import_v417.z.union([import_v417.z.boolean(), import_v417.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
3613
3648
  });
3614
3649
  // Annotate the CommonJS export names for ESM import in node:
3615
3650
  0 && (module.exports = {