@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.
@@ -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 z16 } from "zod/v4";
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
- hasToolCalls
2363
+ hasFunctionCall
2376
2364
  }) {
2377
2365
  switch (finishReason) {
2378
2366
  case void 0:
2379
2367
  case null:
2380
- return hasToolCalls ? "tool-calls" : "stop";
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 hasToolCalls ? "tool-calls" : "unknown";
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 = z16.object({
2503
- type: z16.literal("web_search_call"),
2504
- id: z16.string(),
2505
- status: z16.string(),
2506
- action: z16.discriminatedUnion("type", [
2507
- z16.object({
2508
- type: z16.literal("search"),
2509
- query: z16.string().nullish()
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
- z16.object({
2512
- type: z16.literal("open_page"),
2513
- url: z16.string()
2547
+ z17.object({
2548
+ type: z17.literal("open_page"),
2549
+ url: z17.string()
2514
2550
  }),
2515
- z16.object({
2516
- type: z16.literal("find"),
2517
- url: z16.string(),
2518
- pattern: z16.string()
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 = z16.array(
2524
- z16.object({
2525
- token: z16.string(),
2526
- logprob: z16.number(),
2527
- top_logprobs: z16.array(
2528
- z16.object({
2529
- token: z16.string(),
2530
- logprob: z16.number()
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
- z16.object({
2735
- id: z16.string(),
2736
- created_at: z16.number(),
2737
- error: z16.object({
2738
- code: z16.string(),
2739
- message: z16.string()
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: z16.string(),
2742
- output: z16.array(
2743
- z16.discriminatedUnion("type", [
2744
- z16.object({
2745
- type: z16.literal("message"),
2746
- role: z16.literal("assistant"),
2747
- id: z16.string(),
2748
- content: z16.array(
2749
- z16.object({
2750
- type: z16.literal("output_text"),
2751
- text: z16.string(),
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: z16.array(
2754
- z16.discriminatedUnion("type", [
2755
- z16.object({
2756
- type: z16.literal("url_citation"),
2757
- start_index: z16.number(),
2758
- end_index: z16.number(),
2759
- url: z16.string(),
2760
- title: z16.string()
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
- z16.object({
2763
- type: z16.literal("file_citation"),
2764
- file_id: z16.string(),
2765
- filename: z16.string().nullish(),
2766
- index: z16.number().nullish(),
2767
- start_index: z16.number().nullish(),
2768
- end_index: z16.number().nullish(),
2769
- quote: z16.string().nullish()
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
- z16.object({
2777
- type: z16.literal("function_call"),
2778
- call_id: z16.string(),
2779
- name: z16.string(),
2780
- arguments: z16.string(),
2781
- id: z16.string()
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
- z16.object({
2785
- type: z16.literal("computer_call"),
2786
- id: z16.string(),
2787
- status: z16.string().optional()
2820
+ z17.object({
2821
+ type: z17.literal("computer_call"),
2822
+ id: z17.string(),
2823
+ status: z17.string().optional()
2788
2824
  }),
2789
- z16.object({
2790
- type: z16.literal("file_search_call"),
2791
- id: z16.string(),
2792
- status: z16.string().optional(),
2793
- queries: z16.array(z16.string()).nullish(),
2794
- results: z16.array(
2795
- z16.object({
2796
- attributes: z16.object({
2797
- file_id: z16.string(),
2798
- filename: z16.string(),
2799
- score: z16.number(),
2800
- text: z16.string()
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
- z16.object({
2806
- type: z16.literal("reasoning"),
2807
- id: z16.string(),
2808
- encrypted_content: z16.string().nullish(),
2809
- summary: z16.array(
2810
- z16.object({
2811
- type: z16.literal("summary_text"),
2812
- text: z16.string()
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: z16.string().nullish(),
2819
- incomplete_details: z16.object({ reason: z16.string() }).nullable(),
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
- hasToolCalls: content.some((part) => part.type === "tool-call")
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 hasToolCalls = false;
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
- hasToolCalls = true;
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: "web_search_preview",
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: "web_search_preview",
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
- hasToolCalls
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 = z16.object({
3348
- input_tokens: z16.number(),
3349
- input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
3350
- output_tokens: z16.number(),
3351
- output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
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 = z16.object({
3354
- type: z16.literal("response.output_text.delta"),
3355
- item_id: z16.string(),
3356
- delta: z16.string(),
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 = z16.object({
3360
- type: z16.literal("error"),
3361
- code: z16.string(),
3362
- message: z16.string(),
3363
- param: z16.string().nullish(),
3364
- sequence_number: z16.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 = z16.object({
3367
- type: z16.enum(["response.completed", "response.incomplete"]),
3368
- response: z16.object({
3369
- incomplete_details: z16.object({ reason: z16.string() }).nullish(),
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: z16.string().nullish()
3406
+ service_tier: z17.string().nullish()
3372
3407
  })
3373
3408
  });
3374
- var responseCreatedChunkSchema = z16.object({
3375
- type: z16.literal("response.created"),
3376
- response: z16.object({
3377
- id: z16.string(),
3378
- created_at: z16.number(),
3379
- model: z16.string(),
3380
- service_tier: z16.string().nullish()
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 = z16.object({
3384
- type: z16.literal("response.output_item.added"),
3385
- output_index: z16.number(),
3386
- item: z16.discriminatedUnion("type", [
3387
- z16.object({
3388
- type: z16.literal("message"),
3389
- id: z16.string()
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
- z16.object({
3392
- type: z16.literal("reasoning"),
3393
- id: z16.string(),
3394
- encrypted_content: z16.string().nullish()
3426
+ z17.object({
3427
+ type: z17.literal("reasoning"),
3428
+ id: z17.string(),
3429
+ encrypted_content: z17.string().nullish()
3395
3430
  }),
3396
- z16.object({
3397
- type: z16.literal("function_call"),
3398
- id: z16.string(),
3399
- call_id: z16.string(),
3400
- name: z16.string(),
3401
- arguments: z16.string()
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
- z16.object({
3404
- type: z16.literal("web_search_call"),
3405
- id: z16.string(),
3406
- status: z16.string(),
3407
- action: z16.object({
3408
- type: z16.literal("search"),
3409
- query: z16.string().optional()
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
- z16.object({
3413
- type: z16.literal("computer_call"),
3414
- id: z16.string(),
3415
- status: z16.string()
3447
+ z17.object({
3448
+ type: z17.literal("computer_call"),
3449
+ id: z17.string(),
3450
+ status: z17.string()
3416
3451
  }),
3417
- z16.object({
3418
- type: z16.literal("file_search_call"),
3419
- id: z16.string(),
3420
- status: z16.string(),
3421
- queries: z16.array(z16.string()).nullish(),
3422
- results: z16.array(
3423
- z16.object({
3424
- attributes: z16.object({
3425
- file_id: z16.string(),
3426
- filename: z16.string(),
3427
- score: z16.number(),
3428
- text: z16.string()
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 = z16.object({
3436
- type: z16.literal("response.output_item.done"),
3437
- output_index: z16.number(),
3438
- item: z16.discriminatedUnion("type", [
3439
- z16.object({
3440
- type: z16.literal("message"),
3441
- id: z16.string()
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
- z16.object({
3444
- type: z16.literal("reasoning"),
3445
- id: z16.string(),
3446
- encrypted_content: z16.string().nullish()
3478
+ z17.object({
3479
+ type: z17.literal("reasoning"),
3480
+ id: z17.string(),
3481
+ encrypted_content: z17.string().nullish()
3447
3482
  }),
3448
- z16.object({
3449
- type: z16.literal("function_call"),
3450
- id: z16.string(),
3451
- call_id: z16.string(),
3452
- name: z16.string(),
3453
- arguments: z16.string(),
3454
- status: z16.literal("completed")
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
- z16.object({
3458
- type: z16.literal("computer_call"),
3459
- id: z16.string(),
3460
- status: z16.literal("completed")
3492
+ z17.object({
3493
+ type: z17.literal("computer_call"),
3494
+ id: z17.string(),
3495
+ status: z17.literal("completed")
3461
3496
  }),
3462
- z16.object({
3463
- type: z16.literal("file_search_call"),
3464
- id: z16.string(),
3465
- status: z16.literal("completed"),
3466
- queries: z16.array(z16.string()).nullish(),
3467
- results: z16.array(
3468
- z16.object({
3469
- attributes: z16.object({
3470
- file_id: z16.string(),
3471
- filename: z16.string(),
3472
- score: z16.number(),
3473
- text: z16.string()
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 = z16.object({
3481
- type: z16.literal("response.function_call_arguments.delta"),
3482
- item_id: z16.string(),
3483
- output_index: z16.number(),
3484
- delta: z16.string()
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 = z16.object({
3487
- type: z16.literal("response.output_text.annotation.added"),
3488
- annotation: z16.discriminatedUnion("type", [
3489
- z16.object({
3490
- type: z16.literal("url_citation"),
3491
- url: z16.string(),
3492
- title: z16.string()
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
- z16.object({
3495
- type: z16.literal("file_citation"),
3496
- file_id: z16.string(),
3497
- filename: z16.string().nullish(),
3498
- index: z16.number().nullish(),
3499
- start_index: z16.number().nullish(),
3500
- end_index: z16.number().nullish(),
3501
- quote: z16.string().nullish()
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 = z16.object({
3506
- type: z16.literal("response.reasoning_summary_part.added"),
3507
- item_id: z16.string(),
3508
- summary_index: z16.number()
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 = z16.object({
3511
- type: z16.literal("response.reasoning_summary_text.delta"),
3512
- item_id: z16.string(),
3513
- summary_index: z16.number(),
3514
- delta: z16.string()
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 = z16.union([
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
- z16.object({ type: z16.string() }).loose()
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 = z16.object({
3601
- metadata: z16.any().nullish(),
3602
- parallelToolCalls: z16.boolean().nullish(),
3603
- previousResponseId: z16.string().nullish(),
3604
- store: z16.boolean().nullish(),
3605
- user: z16.string().nullish(),
3606
- reasoningEffort: z16.string().nullish(),
3607
- strictJsonSchema: z16.boolean().nullish(),
3608
- instructions: z16.string().nullish(),
3609
- reasoningSummary: z16.string().nullish(),
3610
- serviceTier: z16.enum(["auto", "flex", "priority"]).nullish(),
3611
- include: z16.array(
3612
- z16.enum([
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: z16.enum(["low", "medium", "high"]).nullish(),
3619
- promptCacheKey: z16.string().nullish(),
3620
- safetyIdentifier: z16.string().nullish(),
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: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
3668
+ logprobs: z17.union([z17.boolean(), z17.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
3634
3669
  });
3635
3670
  export {
3636
3671
  OpenAIChatLanguageModel,