@ai-sdk/openai 2.0.30 → 2.0.32

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.
@@ -11,7 +11,7 @@ import {
11
11
  parseProviderOptions,
12
12
  postJsonToApi
13
13
  } from "@ai-sdk/provider-utils";
14
- import { z as z5 } from "zod/v4";
14
+ import { z as z3 } from "zod/v4";
15
15
 
16
16
  // src/openai-error.ts
17
17
  import { z } from "zod/v4";
@@ -336,98 +336,6 @@ var openaiProviderOptions = z2.object({
336
336
  import {
337
337
  UnsupportedFunctionalityError as UnsupportedFunctionalityError2
338
338
  } from "@ai-sdk/provider";
339
-
340
- // src/tool/file-search.ts
341
- import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
342
- import { z as z3 } from "zod/v4";
343
- var comparisonFilterSchema = z3.object({
344
- key: z3.string(),
345
- type: z3.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
346
- value: z3.union([z3.string(), z3.number(), z3.boolean()])
347
- });
348
- var compoundFilterSchema = z3.object({
349
- type: z3.enum(["and", "or"]),
350
- filters: z3.array(
351
- z3.union([comparisonFilterSchema, z3.lazy(() => compoundFilterSchema)])
352
- )
353
- });
354
- var filtersSchema = z3.union([comparisonFilterSchema, compoundFilterSchema]);
355
- var fileSearchArgsSchema = z3.object({
356
- vectorStoreIds: z3.array(z3.string()).optional(),
357
- maxNumResults: z3.number().optional(),
358
- ranking: z3.object({
359
- ranker: z3.enum(["auto", "default-2024-08-21"]).optional()
360
- }).optional(),
361
- filters: filtersSchema.optional()
362
- });
363
- var fileSearch = createProviderDefinedToolFactory({
364
- id: "openai.file_search",
365
- name: "file_search",
366
- inputSchema: z3.object({
367
- query: z3.string()
368
- })
369
- });
370
-
371
- // src/tool/web-search-preview.ts
372
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
373
- import { z as z4 } from "zod/v4";
374
- var webSearchPreviewArgsSchema = z4.object({
375
- /**
376
- * Search context size to use for the web search.
377
- * - high: Most comprehensive context, highest cost, slower response
378
- * - medium: Balanced context, cost, and latency (default)
379
- * - low: Least context, lowest cost, fastest response
380
- */
381
- searchContextSize: z4.enum(["low", "medium", "high"]).optional(),
382
- /**
383
- * User location information to provide geographically relevant search results.
384
- */
385
- userLocation: z4.object({
386
- /**
387
- * Type of location (always 'approximate')
388
- */
389
- type: z4.literal("approximate"),
390
- /**
391
- * Two-letter ISO country code (e.g., 'US', 'GB')
392
- */
393
- country: z4.string().optional(),
394
- /**
395
- * City name (free text, e.g., 'Minneapolis')
396
- */
397
- city: z4.string().optional(),
398
- /**
399
- * Region name (free text, e.g., 'Minnesota')
400
- */
401
- region: z4.string().optional(),
402
- /**
403
- * IANA timezone (e.g., 'America/Chicago')
404
- */
405
- timezone: z4.string().optional()
406
- }).optional()
407
- });
408
- var webSearchPreview = createProviderDefinedToolFactory2({
409
- id: "openai.web_search_preview",
410
- name: "web_search_preview",
411
- inputSchema: z4.object({
412
- action: z4.discriminatedUnion("type", [
413
- z4.object({
414
- type: z4.literal("search"),
415
- query: z4.string().nullish()
416
- }),
417
- z4.object({
418
- type: z4.literal("open_page"),
419
- url: z4.string()
420
- }),
421
- z4.object({
422
- type: z4.literal("find"),
423
- url: z4.string(),
424
- pattern: z4.string()
425
- })
426
- ]).nullish()
427
- })
428
- });
429
-
430
- // src/chat/openai-chat-prepare-tools.ts
431
339
  function prepareChatTools({
432
340
  tools,
433
341
  toolChoice,
@@ -453,33 +361,6 @@ function prepareChatTools({
453
361
  }
454
362
  });
455
363
  break;
456
- case "provider-defined":
457
- switch (tool.id) {
458
- case "openai.file_search": {
459
- const args = fileSearchArgsSchema.parse(tool.args);
460
- openaiTools.push({
461
- type: "file_search",
462
- vector_store_ids: args.vectorStoreIds,
463
- max_num_results: args.maxNumResults,
464
- ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
465
- filters: args.filters
466
- });
467
- break;
468
- }
469
- case "openai.web_search_preview": {
470
- const args = webSearchPreviewArgsSchema.parse(tool.args);
471
- openaiTools.push({
472
- type: "web_search_preview",
473
- search_context_size: args.searchContextSize,
474
- user_location: args.userLocation
475
- });
476
- break;
477
- }
478
- default:
479
- toolWarnings.push({ type: "unsupported-tool", tool });
480
- break;
481
- }
482
- break;
483
364
  default:
484
365
  toolWarnings.push({ type: "unsupported-tool", tool });
485
366
  break;
@@ -1007,115 +888,115 @@ var OpenAIChatLanguageModel = class {
1007
888
  };
1008
889
  }
1009
890
  };
1010
- var openaiTokenUsageSchema = z5.object({
1011
- prompt_tokens: z5.number().nullish(),
1012
- completion_tokens: z5.number().nullish(),
1013
- total_tokens: z5.number().nullish(),
1014
- prompt_tokens_details: z5.object({
1015
- cached_tokens: z5.number().nullish()
891
+ var openaiTokenUsageSchema = z3.object({
892
+ prompt_tokens: z3.number().nullish(),
893
+ completion_tokens: z3.number().nullish(),
894
+ total_tokens: z3.number().nullish(),
895
+ prompt_tokens_details: z3.object({
896
+ cached_tokens: z3.number().nullish()
1016
897
  }).nullish(),
1017
- completion_tokens_details: z5.object({
1018
- reasoning_tokens: z5.number().nullish(),
1019
- accepted_prediction_tokens: z5.number().nullish(),
1020
- rejected_prediction_tokens: z5.number().nullish()
898
+ completion_tokens_details: z3.object({
899
+ reasoning_tokens: z3.number().nullish(),
900
+ accepted_prediction_tokens: z3.number().nullish(),
901
+ rejected_prediction_tokens: z3.number().nullish()
1021
902
  }).nullish()
1022
903
  }).nullish();
1023
- var openaiChatResponseSchema = z5.object({
1024
- id: z5.string().nullish(),
1025
- created: z5.number().nullish(),
1026
- model: z5.string().nullish(),
1027
- choices: z5.array(
1028
- z5.object({
1029
- message: z5.object({
1030
- role: z5.literal("assistant").nullish(),
1031
- content: z5.string().nullish(),
1032
- tool_calls: z5.array(
1033
- z5.object({
1034
- id: z5.string().nullish(),
1035
- type: z5.literal("function"),
1036
- function: z5.object({
1037
- name: z5.string(),
1038
- arguments: z5.string()
904
+ var openaiChatResponseSchema = z3.object({
905
+ id: z3.string().nullish(),
906
+ created: z3.number().nullish(),
907
+ model: z3.string().nullish(),
908
+ choices: z3.array(
909
+ z3.object({
910
+ message: z3.object({
911
+ role: z3.literal("assistant").nullish(),
912
+ content: z3.string().nullish(),
913
+ tool_calls: z3.array(
914
+ z3.object({
915
+ id: z3.string().nullish(),
916
+ type: z3.literal("function"),
917
+ function: z3.object({
918
+ name: z3.string(),
919
+ arguments: z3.string()
1039
920
  })
1040
921
  })
1041
922
  ).nullish(),
1042
- annotations: z5.array(
1043
- z5.object({
1044
- type: z5.literal("url_citation"),
1045
- start_index: z5.number(),
1046
- end_index: z5.number(),
1047
- url: z5.string(),
1048
- title: z5.string()
923
+ annotations: z3.array(
924
+ z3.object({
925
+ type: z3.literal("url_citation"),
926
+ start_index: z3.number(),
927
+ end_index: z3.number(),
928
+ url: z3.string(),
929
+ title: z3.string()
1049
930
  })
1050
931
  ).nullish()
1051
932
  }),
1052
- index: z5.number(),
1053
- logprobs: z5.object({
1054
- content: z5.array(
1055
- z5.object({
1056
- token: z5.string(),
1057
- logprob: z5.number(),
1058
- top_logprobs: z5.array(
1059
- z5.object({
1060
- token: z5.string(),
1061
- logprob: z5.number()
933
+ index: z3.number(),
934
+ logprobs: z3.object({
935
+ content: z3.array(
936
+ z3.object({
937
+ token: z3.string(),
938
+ logprob: z3.number(),
939
+ top_logprobs: z3.array(
940
+ z3.object({
941
+ token: z3.string(),
942
+ logprob: z3.number()
1062
943
  })
1063
944
  )
1064
945
  })
1065
946
  ).nullish()
1066
947
  }).nullish(),
1067
- finish_reason: z5.string().nullish()
948
+ finish_reason: z3.string().nullish()
1068
949
  })
1069
950
  ),
1070
951
  usage: openaiTokenUsageSchema
1071
952
  });
1072
- var openaiChatChunkSchema = z5.union([
1073
- z5.object({
1074
- id: z5.string().nullish(),
1075
- created: z5.number().nullish(),
1076
- model: z5.string().nullish(),
1077
- choices: z5.array(
1078
- z5.object({
1079
- delta: z5.object({
1080
- role: z5.enum(["assistant"]).nullish(),
1081
- content: z5.string().nullish(),
1082
- tool_calls: z5.array(
1083
- z5.object({
1084
- index: z5.number(),
1085
- id: z5.string().nullish(),
1086
- type: z5.literal("function").nullish(),
1087
- function: z5.object({
1088
- name: z5.string().nullish(),
1089
- arguments: z5.string().nullish()
953
+ var openaiChatChunkSchema = z3.union([
954
+ z3.object({
955
+ id: z3.string().nullish(),
956
+ created: z3.number().nullish(),
957
+ model: z3.string().nullish(),
958
+ choices: z3.array(
959
+ z3.object({
960
+ delta: z3.object({
961
+ role: z3.enum(["assistant"]).nullish(),
962
+ content: z3.string().nullish(),
963
+ tool_calls: z3.array(
964
+ z3.object({
965
+ index: z3.number(),
966
+ id: z3.string().nullish(),
967
+ type: z3.literal("function").nullish(),
968
+ function: z3.object({
969
+ name: z3.string().nullish(),
970
+ arguments: z3.string().nullish()
1090
971
  })
1091
972
  })
1092
973
  ).nullish(),
1093
- annotations: z5.array(
1094
- z5.object({
1095
- type: z5.literal("url_citation"),
1096
- start_index: z5.number(),
1097
- end_index: z5.number(),
1098
- url: z5.string(),
1099
- title: z5.string()
974
+ annotations: z3.array(
975
+ z3.object({
976
+ type: z3.literal("url_citation"),
977
+ start_index: z3.number(),
978
+ end_index: z3.number(),
979
+ url: z3.string(),
980
+ title: z3.string()
1100
981
  })
1101
982
  ).nullish()
1102
983
  }).nullish(),
1103
- logprobs: z5.object({
1104
- content: z5.array(
1105
- z5.object({
1106
- token: z5.string(),
1107
- logprob: z5.number(),
1108
- top_logprobs: z5.array(
1109
- z5.object({
1110
- token: z5.string(),
1111
- logprob: z5.number()
984
+ logprobs: z3.object({
985
+ content: z3.array(
986
+ z3.object({
987
+ token: z3.string(),
988
+ logprob: z3.number(),
989
+ top_logprobs: z3.array(
990
+ z3.object({
991
+ token: z3.string(),
992
+ logprob: z3.number()
1112
993
  })
1113
994
  )
1114
995
  })
1115
996
  ).nullish()
1116
997
  }).nullish(),
1117
- finish_reason: z5.string().nullish(),
1118
- index: z5.number()
998
+ finish_reason: z3.string().nullish(),
999
+ index: z3.number()
1119
1000
  })
1120
1001
  ),
1121
1002
  usage: openaiTokenUsageSchema
@@ -1179,7 +1060,7 @@ import {
1179
1060
  parseProviderOptions as parseProviderOptions2,
1180
1061
  postJsonToApi as postJsonToApi2
1181
1062
  } from "@ai-sdk/provider-utils";
1182
- import { z as z7 } from "zod/v4";
1063
+ import { z as z5 } from "zod/v4";
1183
1064
 
1184
1065
  // src/completion/convert-to-openai-completion-prompt.ts
1185
1066
  import {
@@ -1290,12 +1171,12 @@ function mapOpenAIFinishReason2(finishReason) {
1290
1171
  }
1291
1172
 
1292
1173
  // src/completion/openai-completion-options.ts
1293
- import { z as z6 } from "zod/v4";
1294
- var openaiCompletionProviderOptions = z6.object({
1174
+ import { z as z4 } from "zod/v4";
1175
+ var openaiCompletionProviderOptions = z4.object({
1295
1176
  /**
1296
1177
  Echo back the prompt in addition to the completion.
1297
1178
  */
1298
- echo: z6.boolean().optional(),
1179
+ echo: z4.boolean().optional(),
1299
1180
  /**
1300
1181
  Modify the likelihood of specified tokens appearing in the completion.
1301
1182
 
@@ -1310,16 +1191,16 @@ var openaiCompletionProviderOptions = z6.object({
1310
1191
  As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
1311
1192
  token from being generated.
1312
1193
  */
1313
- logitBias: z6.record(z6.string(), z6.number()).optional(),
1194
+ logitBias: z4.record(z4.string(), z4.number()).optional(),
1314
1195
  /**
1315
1196
  The suffix that comes after a completion of inserted text.
1316
1197
  */
1317
- suffix: z6.string().optional(),
1198
+ suffix: z4.string().optional(),
1318
1199
  /**
1319
1200
  A unique identifier representing your end-user, which can help OpenAI to
1320
1201
  monitor and detect abuse. Learn more.
1321
1202
  */
1322
- user: z6.string().optional(),
1203
+ user: z4.string().optional(),
1323
1204
  /**
1324
1205
  Return the log probabilities of the tokens. Including logprobs will increase
1325
1206
  the response size and can slow down response times. However, it can
@@ -1329,7 +1210,7 @@ var openaiCompletionProviderOptions = z6.object({
1329
1210
  Setting to a number will return the log probabilities of the top n
1330
1211
  tokens that were generated.
1331
1212
  */
1332
- logprobs: z6.union([z6.boolean(), z6.number()]).optional()
1213
+ logprobs: z4.union([z4.boolean(), z4.number()]).optional()
1333
1214
  });
1334
1215
 
1335
1216
  // src/completion/openai-completion-language-model.ts
@@ -1561,42 +1442,42 @@ var OpenAICompletionLanguageModel = class {
1561
1442
  };
1562
1443
  }
1563
1444
  };
1564
- var usageSchema = z7.object({
1565
- prompt_tokens: z7.number(),
1566
- completion_tokens: z7.number(),
1567
- total_tokens: z7.number()
1445
+ var usageSchema = z5.object({
1446
+ prompt_tokens: z5.number(),
1447
+ completion_tokens: z5.number(),
1448
+ total_tokens: z5.number()
1568
1449
  });
1569
- var openaiCompletionResponseSchema = z7.object({
1570
- id: z7.string().nullish(),
1571
- created: z7.number().nullish(),
1572
- model: z7.string().nullish(),
1573
- choices: z7.array(
1574
- z7.object({
1575
- text: z7.string(),
1576
- finish_reason: z7.string(),
1577
- logprobs: z7.object({
1578
- tokens: z7.array(z7.string()),
1579
- token_logprobs: z7.array(z7.number()),
1580
- top_logprobs: z7.array(z7.record(z7.string(), z7.number())).nullish()
1450
+ var openaiCompletionResponseSchema = z5.object({
1451
+ id: z5.string().nullish(),
1452
+ created: z5.number().nullish(),
1453
+ model: z5.string().nullish(),
1454
+ choices: z5.array(
1455
+ z5.object({
1456
+ text: z5.string(),
1457
+ finish_reason: z5.string(),
1458
+ logprobs: z5.object({
1459
+ tokens: z5.array(z5.string()),
1460
+ token_logprobs: z5.array(z5.number()),
1461
+ top_logprobs: z5.array(z5.record(z5.string(), z5.number())).nullish()
1581
1462
  }).nullish()
1582
1463
  })
1583
1464
  ),
1584
1465
  usage: usageSchema.nullish()
1585
1466
  });
1586
- var openaiCompletionChunkSchema = z7.union([
1587
- z7.object({
1588
- id: z7.string().nullish(),
1589
- created: z7.number().nullish(),
1590
- model: z7.string().nullish(),
1591
- choices: z7.array(
1592
- z7.object({
1593
- text: z7.string(),
1594
- finish_reason: z7.string().nullish(),
1595
- index: z7.number(),
1596
- logprobs: z7.object({
1597
- tokens: z7.array(z7.string()),
1598
- token_logprobs: z7.array(z7.number()),
1599
- top_logprobs: z7.array(z7.record(z7.string(), z7.number())).nullish()
1467
+ var openaiCompletionChunkSchema = z5.union([
1468
+ z5.object({
1469
+ id: z5.string().nullish(),
1470
+ created: z5.number().nullish(),
1471
+ model: z5.string().nullish(),
1472
+ choices: z5.array(
1473
+ z5.object({
1474
+ text: z5.string(),
1475
+ finish_reason: z5.string().nullish(),
1476
+ index: z5.number(),
1477
+ logprobs: z5.object({
1478
+ tokens: z5.array(z5.string()),
1479
+ token_logprobs: z5.array(z5.number()),
1480
+ top_logprobs: z5.array(z5.record(z5.string(), z5.number())).nullish()
1600
1481
  }).nullish()
1601
1482
  })
1602
1483
  ),
@@ -1615,21 +1496,21 @@ import {
1615
1496
  parseProviderOptions as parseProviderOptions3,
1616
1497
  postJsonToApi as postJsonToApi3
1617
1498
  } from "@ai-sdk/provider-utils";
1618
- import { z as z9 } from "zod/v4";
1499
+ import { z as z7 } from "zod/v4";
1619
1500
 
1620
1501
  // src/embedding/openai-embedding-options.ts
1621
- import { z as z8 } from "zod/v4";
1622
- var openaiEmbeddingProviderOptions = z8.object({
1502
+ import { z as z6 } from "zod/v4";
1503
+ var openaiEmbeddingProviderOptions = z6.object({
1623
1504
  /**
1624
1505
  The number of dimensions the resulting output embeddings should have.
1625
1506
  Only supported in text-embedding-3 and later models.
1626
1507
  */
1627
- dimensions: z8.number().optional(),
1508
+ dimensions: z6.number().optional(),
1628
1509
  /**
1629
1510
  A unique identifier representing your end-user, which can help OpenAI to
1630
1511
  monitor and detect abuse. Learn more.
1631
1512
  */
1632
- user: z8.string().optional()
1513
+ user: z6.string().optional()
1633
1514
  });
1634
1515
 
1635
1516
  // src/embedding/openai-embedding-model.ts
@@ -1695,9 +1576,9 @@ var OpenAIEmbeddingModel = class {
1695
1576
  };
1696
1577
  }
1697
1578
  };
1698
- var openaiTextEmbeddingResponseSchema = z9.object({
1699
- data: z9.array(z9.object({ embedding: z9.array(z9.number()) })),
1700
- usage: z9.object({ prompt_tokens: z9.number() }).nullish()
1579
+ var openaiTextEmbeddingResponseSchema = z7.object({
1580
+ data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
1581
+ usage: z7.object({ prompt_tokens: z7.number() }).nullish()
1701
1582
  });
1702
1583
 
1703
1584
  // src/image/openai-image-model.ts
@@ -1706,7 +1587,7 @@ import {
1706
1587
  createJsonResponseHandler as createJsonResponseHandler4,
1707
1588
  postJsonToApi as postJsonToApi4
1708
1589
  } from "@ai-sdk/provider-utils";
1709
- import { z as z10 } from "zod/v4";
1590
+ import { z as z8 } from "zod/v4";
1710
1591
 
1711
1592
  // src/image/openai-image-options.ts
1712
1593
  var modelMaxImagesPerCall = {
@@ -1794,9 +1675,9 @@ var OpenAIImageModel = class {
1794
1675
  };
1795
1676
  }
1796
1677
  };
1797
- var openaiImageResponseSchema = z10.object({
1798
- data: z10.array(
1799
- z10.object({ b64_json: z10.string(), revised_prompt: z10.string().optional() })
1678
+ var openaiImageResponseSchema = z8.object({
1679
+ data: z8.array(
1680
+ z8.object({ b64_json: z8.string(), revised_prompt: z8.string().optional() })
1800
1681
  )
1801
1682
  });
1802
1683
 
@@ -1809,33 +1690,33 @@ import {
1809
1690
  parseProviderOptions as parseProviderOptions4,
1810
1691
  postFormDataToApi
1811
1692
  } from "@ai-sdk/provider-utils";
1812
- import { z as z12 } from "zod/v4";
1693
+ import { z as z10 } from "zod/v4";
1813
1694
 
1814
1695
  // src/transcription/openai-transcription-options.ts
1815
- import { z as z11 } from "zod/v4";
1816
- var openAITranscriptionProviderOptions = z11.object({
1696
+ import { z as z9 } from "zod/v4";
1697
+ var openAITranscriptionProviderOptions = z9.object({
1817
1698
  /**
1818
1699
  * Additional information to include in the transcription response.
1819
1700
  */
1820
- include: z11.array(z11.string()).optional(),
1701
+ include: z9.array(z9.string()).optional(),
1821
1702
  /**
1822
1703
  * The language of the input audio in ISO-639-1 format.
1823
1704
  */
1824
- language: z11.string().optional(),
1705
+ language: z9.string().optional(),
1825
1706
  /**
1826
1707
  * An optional text to guide the model's style or continue a previous audio segment.
1827
1708
  */
1828
- prompt: z11.string().optional(),
1709
+ prompt: z9.string().optional(),
1829
1710
  /**
1830
1711
  * The sampling temperature, between 0 and 1.
1831
1712
  * @default 0
1832
1713
  */
1833
- temperature: z11.number().min(0).max(1).default(0).optional(),
1714
+ temperature: z9.number().min(0).max(1).default(0).optional(),
1834
1715
  /**
1835
1716
  * The timestamp granularities to populate for this transcription.
1836
1717
  * @default ['segment']
1837
1718
  */
1838
- timestampGranularities: z11.array(z11.enum(["word", "segment"])).default(["segment"]).optional()
1719
+ timestampGranularities: z9.array(z9.enum(["word", "segment"])).default(["segment"]).optional()
1839
1720
  });
1840
1721
 
1841
1722
  // src/transcription/openai-transcription-model.ts
@@ -2004,29 +1885,29 @@ var OpenAITranscriptionModel = class {
2004
1885
  };
2005
1886
  }
2006
1887
  };
2007
- var openaiTranscriptionResponseSchema = z12.object({
2008
- text: z12.string(),
2009
- language: z12.string().nullish(),
2010
- duration: z12.number().nullish(),
2011
- words: z12.array(
2012
- z12.object({
2013
- word: z12.string(),
2014
- start: z12.number(),
2015
- end: z12.number()
1888
+ var openaiTranscriptionResponseSchema = z10.object({
1889
+ text: z10.string(),
1890
+ language: z10.string().nullish(),
1891
+ duration: z10.number().nullish(),
1892
+ words: z10.array(
1893
+ z10.object({
1894
+ word: z10.string(),
1895
+ start: z10.number(),
1896
+ end: z10.number()
2016
1897
  })
2017
1898
  ).nullish(),
2018
- segments: z12.array(
2019
- z12.object({
2020
- id: z12.number(),
2021
- seek: z12.number(),
2022
- start: z12.number(),
2023
- end: z12.number(),
2024
- text: z12.string(),
2025
- tokens: z12.array(z12.number()),
2026
- temperature: z12.number(),
2027
- avg_logprob: z12.number(),
2028
- compression_ratio: z12.number(),
2029
- no_speech_prob: z12.number()
1899
+ segments: z10.array(
1900
+ z10.object({
1901
+ id: z10.number(),
1902
+ seek: z10.number(),
1903
+ start: z10.number(),
1904
+ end: z10.number(),
1905
+ text: z10.string(),
1906
+ tokens: z10.array(z10.number()),
1907
+ temperature: z10.number(),
1908
+ avg_logprob: z10.number(),
1909
+ compression_ratio: z10.number(),
1910
+ no_speech_prob: z10.number()
2030
1911
  })
2031
1912
  ).nullish()
2032
1913
  });
@@ -2038,10 +1919,10 @@ import {
2038
1919
  parseProviderOptions as parseProviderOptions5,
2039
1920
  postJsonToApi as postJsonToApi5
2040
1921
  } from "@ai-sdk/provider-utils";
2041
- import { z as z13 } from "zod/v4";
2042
- var OpenAIProviderOptionsSchema = z13.object({
2043
- instructions: z13.string().nullish(),
2044
- speed: z13.number().min(0.25).max(4).default(1).nullish()
1922
+ import { z as z11 } from "zod/v4";
1923
+ var OpenAIProviderOptionsSchema = z11.object({
1924
+ instructions: z11.string().nullish(),
1925
+ speed: z11.number().min(0.25).max(4).default(1).nullish()
2045
1926
  });
2046
1927
  var OpenAISpeechModel = class {
2047
1928
  constructor(modelId, config) {
@@ -2155,14 +2036,14 @@ import {
2155
2036
  parseProviderOptions as parseProviderOptions7,
2156
2037
  postJsonToApi as postJsonToApi6
2157
2038
  } from "@ai-sdk/provider-utils";
2158
- import { z as z17 } from "zod/v4";
2039
+ import { z as z18 } from "zod/v4";
2159
2040
 
2160
2041
  // src/responses/convert-to-openai-responses-input.ts
2161
2042
  import {
2162
2043
  UnsupportedFunctionalityError as UnsupportedFunctionalityError4
2163
2044
  } from "@ai-sdk/provider";
2164
2045
  import { convertToBase64 as convertToBase642, parseProviderOptions as parseProviderOptions6 } from "@ai-sdk/provider-utils";
2165
- import { z as z14 } from "zod/v4";
2046
+ import { z as z12 } from "zod/v4";
2166
2047
  function isFileId(data, prefixes) {
2167
2048
  if (!prefixes) return false;
2168
2049
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2170,7 +2051,8 @@ function isFileId(data, prefixes) {
2170
2051
  async function convertToOpenAIResponsesInput({
2171
2052
  prompt,
2172
2053
  systemMessageMode,
2173
- fileIdPrefixes
2054
+ fileIdPrefixes,
2055
+ store
2174
2056
  }) {
2175
2057
  var _a, _b, _c, _d, _e, _f;
2176
2058
  const input = [];
@@ -2275,10 +2157,14 @@ async function convertToOpenAIResponsesInput({
2275
2157
  break;
2276
2158
  }
2277
2159
  case "tool-result": {
2278
- warnings.push({
2279
- type: "other",
2280
- message: `tool result parts in assistant messages are not supported for OpenAI responses`
2281
- });
2160
+ if (store) {
2161
+ input.push({ type: "item_reference", id: part.toolCallId });
2162
+ } else {
2163
+ warnings.push({
2164
+ type: "other",
2165
+ message: `Results for OpenAI tool ${part.toolName} are not sent to the API when store is false`
2166
+ });
2167
+ }
2282
2168
  break;
2283
2169
  }
2284
2170
  case "reasoning": {
@@ -2353,9 +2239,9 @@ async function convertToOpenAIResponsesInput({
2353
2239
  }
2354
2240
  return { input, warnings };
2355
2241
  }
2356
- var openaiResponsesReasoningProviderOptionsSchema = z14.object({
2357
- itemId: z14.string().nullish(),
2358
- reasoningEncryptedContent: z14.string().nullish()
2242
+ var openaiResponsesReasoningProviderOptionsSchema = z12.object({
2243
+ itemId: z12.string().nullish(),
2244
+ reasoningEncryptedContent: z12.string().nullish()
2359
2245
  });
2360
2246
 
2361
2247
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2383,24 +2269,24 @@ import {
2383
2269
 
2384
2270
  // src/tool/code-interpreter.ts
2385
2271
  import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
2386
- import { z as z15 } from "zod/v4";
2387
- var codeInterpreterInputSchema = z15.object({
2388
- code: z15.string().nullish(),
2389
- containerId: z15.string()
2272
+ import { z as z13 } from "zod/v4";
2273
+ var codeInterpreterInputSchema = z13.object({
2274
+ code: z13.string().nullish(),
2275
+ containerId: z13.string()
2390
2276
  });
2391
- var codeInterpreterOutputSchema = z15.object({
2392
- outputs: z15.array(
2393
- z15.discriminatedUnion("type", [
2394
- z15.object({ type: z15.literal("logs"), logs: z15.string() }),
2395
- z15.object({ type: z15.literal("image"), url: z15.string() })
2277
+ var codeInterpreterOutputSchema = z13.object({
2278
+ outputs: z13.array(
2279
+ z13.discriminatedUnion("type", [
2280
+ z13.object({ type: z13.literal("logs"), logs: z13.string() }),
2281
+ z13.object({ type: z13.literal("image"), url: z13.string() })
2396
2282
  ])
2397
2283
  ).nullish()
2398
2284
  });
2399
- var codeInterpreterArgsSchema = z15.object({
2400
- container: z15.union([
2401
- z15.string(),
2402
- z15.object({
2403
- fileIds: z15.array(z15.string()).optional()
2285
+ var codeInterpreterArgsSchema = z13.object({
2286
+ container: z13.union([
2287
+ z13.string(),
2288
+ z13.object({
2289
+ fileIds: z13.array(z13.string()).optional()
2404
2290
  })
2405
2291
  ]).optional()
2406
2292
  });
@@ -2411,25 +2297,126 @@ var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchem
2411
2297
  outputSchema: codeInterpreterOutputSchema
2412
2298
  });
2413
2299
 
2300
+ // src/tool/file-search.ts
2301
+ import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
2302
+ import { z as z14 } from "zod/v4";
2303
+ var comparisonFilterSchema = z14.object({
2304
+ key: z14.string(),
2305
+ type: z14.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
2306
+ value: z14.union([z14.string(), z14.number(), z14.boolean()])
2307
+ });
2308
+ var compoundFilterSchema = z14.object({
2309
+ type: z14.enum(["and", "or"]),
2310
+ filters: z14.array(
2311
+ z14.union([comparisonFilterSchema, z14.lazy(() => compoundFilterSchema)])
2312
+ )
2313
+ });
2314
+ var fileSearchArgsSchema = z14.object({
2315
+ vectorStoreIds: z14.array(z14.string()),
2316
+ maxNumResults: z14.number().optional(),
2317
+ ranking: z14.object({
2318
+ ranker: z14.string().optional(),
2319
+ scoreThreshold: z14.number().optional()
2320
+ }).optional(),
2321
+ filters: z14.union([comparisonFilterSchema, compoundFilterSchema]).optional()
2322
+ });
2323
+ var fileSearchOutputSchema = z14.object({
2324
+ queries: z14.array(z14.string()),
2325
+ results: z14.array(
2326
+ z14.object({
2327
+ attributes: z14.record(z14.string(), z14.unknown()),
2328
+ fileId: z14.string(),
2329
+ filename: z14.string(),
2330
+ score: z14.number(),
2331
+ text: z14.string()
2332
+ })
2333
+ ).nullable()
2334
+ });
2335
+ var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
2336
+ id: "openai.file_search",
2337
+ name: "file_search",
2338
+ inputSchema: z14.object({}),
2339
+ outputSchema: fileSearchOutputSchema
2340
+ });
2341
+
2414
2342
  // src/tool/web-search.ts
2415
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory3 } from "@ai-sdk/provider-utils";
2416
- import { z as z16 } from "zod/v4";
2417
- var webSearchArgsSchema = z16.object({
2418
- filters: z16.object({
2419
- allowedDomains: z16.array(z16.string()).optional()
2343
+ import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
2344
+ import { z as z15 } from "zod/v4";
2345
+ var webSearchArgsSchema = z15.object({
2346
+ filters: z15.object({
2347
+ allowedDomains: z15.array(z15.string()).optional()
2420
2348
  }).optional(),
2349
+ searchContextSize: z15.enum(["low", "medium", "high"]).optional(),
2350
+ userLocation: z15.object({
2351
+ type: z15.literal("approximate"),
2352
+ country: z15.string().optional(),
2353
+ city: z15.string().optional(),
2354
+ region: z15.string().optional(),
2355
+ timezone: z15.string().optional()
2356
+ }).optional()
2357
+ });
2358
+ var webSearchToolFactory = createProviderDefinedToolFactory({
2359
+ id: "openai.web_search",
2360
+ name: "web_search",
2361
+ inputSchema: z15.object({
2362
+ action: z15.discriminatedUnion("type", [
2363
+ z15.object({
2364
+ type: z15.literal("search"),
2365
+ query: z15.string().nullish()
2366
+ }),
2367
+ z15.object({
2368
+ type: z15.literal("open_page"),
2369
+ url: z15.string()
2370
+ }),
2371
+ z15.object({
2372
+ type: z15.literal("find"),
2373
+ url: z15.string(),
2374
+ pattern: z15.string()
2375
+ })
2376
+ ]).nullish()
2377
+ })
2378
+ });
2379
+
2380
+ // src/tool/web-search-preview.ts
2381
+ import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
2382
+ import { z as z16 } from "zod/v4";
2383
+ var webSearchPreviewArgsSchema = z16.object({
2384
+ /**
2385
+ * Search context size to use for the web search.
2386
+ * - high: Most comprehensive context, highest cost, slower response
2387
+ * - medium: Balanced context, cost, and latency (default)
2388
+ * - low: Least context, lowest cost, fastest response
2389
+ */
2421
2390
  searchContextSize: z16.enum(["low", "medium", "high"]).optional(),
2391
+ /**
2392
+ * User location information to provide geographically relevant search results.
2393
+ */
2422
2394
  userLocation: z16.object({
2395
+ /**
2396
+ * Type of location (always 'approximate')
2397
+ */
2423
2398
  type: z16.literal("approximate"),
2399
+ /**
2400
+ * Two-letter ISO country code (e.g., 'US', 'GB')
2401
+ */
2424
2402
  country: z16.string().optional(),
2403
+ /**
2404
+ * City name (free text, e.g., 'Minneapolis')
2405
+ */
2425
2406
  city: z16.string().optional(),
2407
+ /**
2408
+ * Region name (free text, e.g., 'Minnesota')
2409
+ */
2426
2410
  region: z16.string().optional(),
2411
+ /**
2412
+ * IANA timezone (e.g., 'America/Chicago')
2413
+ */
2427
2414
  timezone: z16.string().optional()
2428
2415
  }).optional()
2429
2416
  });
2430
- var webSearchToolFactory = createProviderDefinedToolFactory3({
2431
- id: "openai.web_search",
2432
- name: "web_search",
2417
+ var webSearchPreview = createProviderDefinedToolFactory2({
2418
+ id: "openai.web_search_preview",
2419
+ name: "web_search_preview",
2433
2420
  inputSchema: z16.object({
2434
2421
  action: z16.discriminatedUnion("type", [
2435
2422
  z16.object({
@@ -2449,6 +2436,33 @@ var webSearchToolFactory = createProviderDefinedToolFactory3({
2449
2436
  })
2450
2437
  });
2451
2438
 
2439
+ // src/tool/image-generation.ts
2440
+ import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3 } from "@ai-sdk/provider-utils";
2441
+ import { z as z17 } from "zod/v4";
2442
+ var imageGenerationArgsSchema = z17.object({
2443
+ background: z17.enum(["auto", "opaque", "transparent"]).optional(),
2444
+ inputFidelity: z17.enum(["low", "high"]).optional(),
2445
+ inputImageMask: z17.object({
2446
+ fileId: z17.string().optional(),
2447
+ imageUrl: z17.string().optional()
2448
+ }).optional(),
2449
+ model: z17.string().optional(),
2450
+ moderation: z17.enum(["auto"]).optional(),
2451
+ outputCompression: z17.number().int().min(0).max(100).optional(),
2452
+ outputFormat: z17.enum(["png", "jpeg", "webp"]).optional(),
2453
+ quality: z17.enum(["auto", "low", "medium", "high"]).optional(),
2454
+ size: z17.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2455
+ }).strict();
2456
+ var imageGenerationOutputSchema = z17.object({
2457
+ result: z17.string()
2458
+ });
2459
+ var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
2460
+ id: "openai.image_generation",
2461
+ name: "image_generation",
2462
+ inputSchema: z17.object({}),
2463
+ outputSchema: imageGenerationOutputSchema
2464
+ });
2465
+
2452
2466
  // src/responses/openai-responses-prepare-tools.ts
2453
2467
  function prepareResponsesTools({
2454
2468
  tools,
@@ -2480,7 +2494,10 @@ function prepareResponsesTools({
2480
2494
  type: "file_search",
2481
2495
  vector_store_ids: args.vectorStoreIds,
2482
2496
  max_num_results: args.maxNumResults,
2483
- ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
2497
+ ranking_options: args.ranking ? {
2498
+ ranker: args.ranking.ranker,
2499
+ score_threshold: args.ranking.scoreThreshold
2500
+ } : void 0,
2484
2501
  filters: args.filters
2485
2502
  });
2486
2503
  break;
@@ -2512,8 +2529,23 @@ function prepareResponsesTools({
2512
2529
  });
2513
2530
  break;
2514
2531
  }
2515
- default: {
2516
- toolWarnings.push({ type: "unsupported-tool", tool });
2532
+ case "openai.image_generation": {
2533
+ const args = imageGenerationArgsSchema.parse(tool.args);
2534
+ openaiTools.push({
2535
+ type: "image_generation",
2536
+ background: args.background,
2537
+ input_fidelity: args.inputFidelity,
2538
+ input_image_mask: args.inputImageMask ? {
2539
+ file_id: args.inputImageMask.fileId,
2540
+ image_url: args.inputImageMask.imageUrl
2541
+ } : void 0,
2542
+ model: args.model,
2543
+ size: args.size,
2544
+ quality: args.quality,
2545
+ moderation: args.moderation,
2546
+ output_format: args.outputFormat,
2547
+ output_compression: args.outputCompression
2548
+ });
2517
2549
  break;
2518
2550
  }
2519
2551
  }
@@ -2536,7 +2568,7 @@ function prepareResponsesTools({
2536
2568
  case "tool":
2537
2569
  return {
2538
2570
  tools: openaiTools,
2539
- 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 },
2571
+ toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
2540
2572
  toolWarnings
2541
2573
  };
2542
2574
  default: {
@@ -2549,47 +2581,66 @@ function prepareResponsesTools({
2549
2581
  }
2550
2582
 
2551
2583
  // src/responses/openai-responses-language-model.ts
2552
- var webSearchCallItem = z17.object({
2553
- type: z17.literal("web_search_call"),
2554
- id: z17.string(),
2555
- status: z17.string(),
2556
- action: z17.discriminatedUnion("type", [
2557
- z17.object({
2558
- type: z17.literal("search"),
2559
- query: z17.string().nullish()
2584
+ var webSearchCallItem = z18.object({
2585
+ type: z18.literal("web_search_call"),
2586
+ id: z18.string(),
2587
+ status: z18.string(),
2588
+ action: z18.discriminatedUnion("type", [
2589
+ z18.object({
2590
+ type: z18.literal("search"),
2591
+ query: z18.string().nullish()
2560
2592
  }),
2561
- z17.object({
2562
- type: z17.literal("open_page"),
2563
- url: z17.string()
2593
+ z18.object({
2594
+ type: z18.literal("open_page"),
2595
+ url: z18.string()
2564
2596
  }),
2565
- z17.object({
2566
- type: z17.literal("find"),
2567
- url: z17.string(),
2568
- pattern: z17.string()
2597
+ z18.object({
2598
+ type: z18.literal("find"),
2599
+ url: z18.string(),
2600
+ pattern: z18.string()
2569
2601
  })
2570
2602
  ]).nullish()
2571
2603
  });
2572
- var codeInterpreterCallItem = z17.object({
2573
- type: z17.literal("code_interpreter_call"),
2574
- id: z17.string(),
2575
- code: z17.string().nullable(),
2576
- container_id: z17.string(),
2577
- outputs: z17.array(
2578
- z17.discriminatedUnion("type", [
2579
- z17.object({ type: z17.literal("logs"), logs: z17.string() }),
2580
- z17.object({ type: z17.literal("image"), url: z17.string() })
2604
+ var fileSearchCallItem = z18.object({
2605
+ type: z18.literal("file_search_call"),
2606
+ id: z18.string(),
2607
+ queries: z18.array(z18.string()),
2608
+ results: z18.array(
2609
+ z18.object({
2610
+ attributes: z18.record(z18.string(), z18.unknown()),
2611
+ file_id: z18.string(),
2612
+ filename: z18.string(),
2613
+ score: z18.number(),
2614
+ text: z18.string()
2615
+ })
2616
+ ).nullish()
2617
+ });
2618
+ var codeInterpreterCallItem = z18.object({
2619
+ type: z18.literal("code_interpreter_call"),
2620
+ id: z18.string(),
2621
+ code: z18.string().nullable(),
2622
+ container_id: z18.string(),
2623
+ outputs: z18.array(
2624
+ z18.discriminatedUnion("type", [
2625
+ z18.object({ type: z18.literal("logs"), logs: z18.string() }),
2626
+ z18.object({ type: z18.literal("image"), url: z18.string() })
2581
2627
  ])
2582
2628
  ).nullable()
2583
2629
  });
2630
+ var imageGenerationCallItem = z18.object({
2631
+ type: z18.literal("image_generation_call"),
2632
+ id: z18.string(),
2633
+ result: z18.string()
2634
+ });
2584
2635
  var TOP_LOGPROBS_MAX = 20;
2585
- var LOGPROBS_SCHEMA = z17.array(
2586
- z17.object({
2587
- token: z17.string(),
2588
- logprob: z17.number(),
2589
- top_logprobs: z17.array(
2590
- z17.object({
2591
- token: z17.string(),
2592
- logprob: z17.number()
2636
+ var LOGPROBS_SCHEMA = z18.array(
2637
+ z18.object({
2638
+ token: z18.string(),
2639
+ logprob: z18.number(),
2640
+ top_logprobs: z18.array(
2641
+ z18.object({
2642
+ token: z18.string(),
2643
+ logprob: z18.number()
2593
2644
  })
2594
2645
  )
2595
2646
  })
@@ -2646,29 +2697,41 @@ var OpenAIResponsesLanguageModel = class {
2646
2697
  if (stopSequences != null) {
2647
2698
  warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
2648
2699
  }
2649
- const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
2650
- prompt,
2651
- systemMessageMode: modelConfig.systemMessageMode,
2652
- fileIdPrefixes: this.config.fileIdPrefixes
2653
- });
2654
- warnings.push(...inputWarnings);
2655
2700
  const openaiOptions = await parseProviderOptions7({
2656
2701
  provider: "openai",
2657
2702
  providerOptions,
2658
2703
  schema: openaiResponsesProviderOptionsSchema
2659
2704
  });
2660
- const strictJsonSchema = (_a = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _a : false;
2705
+ const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
2706
+ prompt,
2707
+ systemMessageMode: modelConfig.systemMessageMode,
2708
+ fileIdPrefixes: this.config.fileIdPrefixes,
2709
+ store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
2710
+ });
2711
+ warnings.push(...inputWarnings);
2712
+ const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
2661
2713
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
2714
+ function addInclude(key) {
2715
+ include = include != null ? [...include, key] : [key];
2716
+ }
2717
+ function hasOpenAITool(id) {
2718
+ return (tools == null ? void 0 : tools.find(
2719
+ (tool) => tool.type === "provider-defined" && tool.id === id
2720
+ )) != null;
2721
+ }
2662
2722
  const topLogprobs = typeof (openaiOptions == null ? void 0 : openaiOptions.logprobs) === "number" ? openaiOptions == null ? void 0 : openaiOptions.logprobs : (openaiOptions == null ? void 0 : openaiOptions.logprobs) === true ? TOP_LOGPROBS_MAX : void 0;
2663
- include = topLogprobs ? Array.isArray(include) ? [...include, "message.output_text.logprobs"] : ["message.output_text.logprobs"] : include;
2664
- const webSearchToolName = (_b = tools == null ? void 0 : tools.find(
2723
+ if (topLogprobs) {
2724
+ addInclude("message.output_text.logprobs");
2725
+ }
2726
+ const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
2665
2727
  (tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
2666
- )) == null ? void 0 : _b.name;
2667
- include = webSearchToolName ? Array.isArray(include) ? [...include, "web_search_call.action.sources"] : ["web_search_call.action.sources"] : include;
2668
- const codeInterpreterToolName = (_c = tools == null ? void 0 : tools.find(
2669
- (tool) => tool.type === "provider-defined" && tool.id === "openai.code_interpreter"
2670
2728
  )) == null ? void 0 : _c.name;
2671
- include = codeInterpreterToolName ? Array.isArray(include) ? [...include, "code_interpreter_call.outputs"] : ["code_interpreter_call.outputs"] : include;
2729
+ if (webSearchToolName) {
2730
+ addInclude("web_search_call.action.sources");
2731
+ }
2732
+ if (hasOpenAITool("openai.code_interpreter")) {
2733
+ addInclude("code_interpreter_call.outputs");
2734
+ }
2672
2735
  const baseArgs = {
2673
2736
  model: this.modelId,
2674
2737
  input,
@@ -2692,6 +2755,7 @@ var OpenAIResponsesLanguageModel = class {
2692
2755
  }
2693
2756
  },
2694
2757
  // provider options:
2758
+ max_tool_calls: openaiOptions == null ? void 0 : openaiOptions.maxToolCalls,
2695
2759
  metadata: openaiOptions == null ? void 0 : openaiOptions.metadata,
2696
2760
  parallel_tool_calls: openaiOptions == null ? void 0 : openaiOptions.parallelToolCalls,
2697
2761
  previous_response_id: openaiOptions == null ? void 0 : openaiOptions.previousResponseId,
@@ -2787,7 +2851,7 @@ var OpenAIResponsesLanguageModel = class {
2787
2851
  };
2788
2852
  }
2789
2853
  async doGenerate(options) {
2790
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2854
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
2791
2855
  const {
2792
2856
  args: body,
2793
2857
  warnings,
@@ -2807,96 +2871,82 @@ var OpenAIResponsesLanguageModel = class {
2807
2871
  body,
2808
2872
  failedResponseHandler: openaiFailedResponseHandler,
2809
2873
  successfulResponseHandler: createJsonResponseHandler6(
2810
- z17.object({
2811
- id: z17.string(),
2812
- created_at: z17.number(),
2813
- error: z17.object({
2814
- code: z17.string(),
2815
- message: z17.string()
2874
+ z18.object({
2875
+ id: z18.string(),
2876
+ created_at: z18.number(),
2877
+ error: z18.object({
2878
+ code: z18.string(),
2879
+ message: z18.string()
2816
2880
  }).nullish(),
2817
- model: z17.string(),
2818
- output: z17.array(
2819
- z17.discriminatedUnion("type", [
2820
- z17.object({
2821
- type: z17.literal("message"),
2822
- role: z17.literal("assistant"),
2823
- id: z17.string(),
2824
- content: z17.array(
2825
- z17.object({
2826
- type: z17.literal("output_text"),
2827
- text: z17.string(),
2881
+ model: z18.string(),
2882
+ output: z18.array(
2883
+ z18.discriminatedUnion("type", [
2884
+ z18.object({
2885
+ type: z18.literal("message"),
2886
+ role: z18.literal("assistant"),
2887
+ id: z18.string(),
2888
+ content: z18.array(
2889
+ z18.object({
2890
+ type: z18.literal("output_text"),
2891
+ text: z18.string(),
2828
2892
  logprobs: LOGPROBS_SCHEMA.nullish(),
2829
- annotations: z17.array(
2830
- z17.discriminatedUnion("type", [
2831
- z17.object({
2832
- type: z17.literal("url_citation"),
2833
- start_index: z17.number(),
2834
- end_index: z17.number(),
2835
- url: z17.string(),
2836
- title: z17.string()
2893
+ annotations: z18.array(
2894
+ z18.discriminatedUnion("type", [
2895
+ z18.object({
2896
+ type: z18.literal("url_citation"),
2897
+ start_index: z18.number(),
2898
+ end_index: z18.number(),
2899
+ url: z18.string(),
2900
+ title: z18.string()
2837
2901
  }),
2838
- z17.object({
2839
- type: z17.literal("file_citation"),
2840
- file_id: z17.string(),
2841
- filename: z17.string().nullish(),
2842
- index: z17.number().nullish(),
2843
- start_index: z17.number().nullish(),
2844
- end_index: z17.number().nullish(),
2845
- quote: z17.string().nullish()
2902
+ z18.object({
2903
+ type: z18.literal("file_citation"),
2904
+ file_id: z18.string(),
2905
+ filename: z18.string().nullish(),
2906
+ index: z18.number().nullish(),
2907
+ start_index: z18.number().nullish(),
2908
+ end_index: z18.number().nullish(),
2909
+ quote: z18.string().nullish()
2846
2910
  }),
2847
- z17.object({
2848
- type: z17.literal("container_file_citation")
2911
+ z18.object({
2912
+ type: z18.literal("container_file_citation")
2849
2913
  })
2850
2914
  ])
2851
2915
  )
2852
2916
  })
2853
2917
  )
2854
2918
  }),
2919
+ webSearchCallItem,
2920
+ fileSearchCallItem,
2855
2921
  codeInterpreterCallItem,
2856
- z17.object({
2857
- type: z17.literal("function_call"),
2858
- call_id: z17.string(),
2859
- name: z17.string(),
2860
- arguments: z17.string(),
2861
- id: z17.string()
2922
+ imageGenerationCallItem,
2923
+ z18.object({
2924
+ type: z18.literal("function_call"),
2925
+ call_id: z18.string(),
2926
+ name: z18.string(),
2927
+ arguments: z18.string(),
2928
+ id: z18.string()
2862
2929
  }),
2863
- webSearchCallItem,
2864
- z17.object({
2865
- type: z17.literal("computer_call"),
2866
- id: z17.string(),
2867
- status: z17.string().optional()
2930
+ z18.object({
2931
+ type: z18.literal("computer_call"),
2932
+ id: z18.string(),
2933
+ status: z18.string().optional()
2868
2934
  }),
2869
- z17.object({
2870
- type: z17.literal("file_search_call"),
2871
- id: z17.string(),
2872
- status: z17.string().optional(),
2873
- queries: z17.array(z17.string()).nullish(),
2874
- results: z17.array(
2875
- z17.object({
2876
- attributes: z17.object({
2877
- file_id: z17.string(),
2878
- filename: z17.string(),
2879
- score: z17.number(),
2880
- text: z17.string()
2881
- })
2882
- })
2883
- ).nullish()
2884
- }),
2885
- z17.object({
2886
- type: z17.literal("reasoning"),
2887
- id: z17.string(),
2888
- encrypted_content: z17.string().nullish(),
2889
- summary: z17.array(
2890
- z17.object({
2891
- type: z17.literal("summary_text"),
2892
- text: z17.string()
2935
+ z18.object({
2936
+ type: z18.literal("reasoning"),
2937
+ id: z18.string(),
2938
+ encrypted_content: z18.string().nullish(),
2939
+ summary: z18.array(
2940
+ z18.object({
2941
+ type: z18.literal("summary_text"),
2942
+ text: z18.string()
2893
2943
  })
2894
2944
  )
2895
2945
  })
2896
2946
  ])
2897
2947
  ),
2898
- service_tier: z17.string().nullish(),
2899
- incomplete_details: z17.object({ reason: z17.string() }).nullable(),
2948
+ service_tier: z18.string().nullish(),
2949
+ incomplete_details: z18.object({ reason: z18.string() }).nullable(),
2900
2950
  usage: usageSchema2
2901
2951
  })
2902
2952
  ),
@@ -2937,6 +2987,25 @@ var OpenAIResponsesLanguageModel = class {
2937
2987
  }
2938
2988
  break;
2939
2989
  }
2990
+ case "image_generation_call": {
2991
+ content.push({
2992
+ type: "tool-call",
2993
+ toolCallId: part.id,
2994
+ toolName: "image_generation",
2995
+ input: "{}",
2996
+ providerExecuted: true
2997
+ });
2998
+ content.push({
2999
+ type: "tool-result",
3000
+ toolCallId: part.id,
3001
+ toolName: "image_generation",
3002
+ result: {
3003
+ result: part.result
3004
+ },
3005
+ providerExecuted: true
3006
+ });
3007
+ break;
3008
+ }
2940
3009
  case "message": {
2941
3010
  for (const contentPart of part.content) {
2942
3011
  if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
@@ -3031,7 +3100,7 @@ var OpenAIResponsesLanguageModel = class {
3031
3100
  type: "tool-call",
3032
3101
  toolCallId: part.id,
3033
3102
  toolName: "file_search",
3034
- input: "",
3103
+ input: "{}",
3035
3104
  providerExecuted: true
3036
3105
  });
3037
3106
  content.push({
@@ -3039,10 +3108,14 @@ var OpenAIResponsesLanguageModel = class {
3039
3108
  toolCallId: part.id,
3040
3109
  toolName: "file_search",
3041
3110
  result: {
3042
- type: "file_search_tool_result",
3043
- status: part.status || "completed",
3044
- ...part.queries && { queries: part.queries },
3045
- ...part.results && { results: part.results }
3111
+ queries: part.queries,
3112
+ results: (_n = (_m = part.results) == null ? void 0 : _m.map((result) => ({
3113
+ attributes: result.attributes,
3114
+ fileId: result.file_id,
3115
+ filename: result.filename,
3116
+ score: result.score,
3117
+ text: result.text
3118
+ }))) != null ? _n : null
3046
3119
  },
3047
3120
  providerExecuted: true
3048
3121
  });
@@ -3084,15 +3157,15 @@ var OpenAIResponsesLanguageModel = class {
3084
3157
  return {
3085
3158
  content,
3086
3159
  finishReason: mapOpenAIResponseFinishReason({
3087
- finishReason: (_m = response.incomplete_details) == null ? void 0 : _m.reason,
3160
+ finishReason: (_o = response.incomplete_details) == null ? void 0 : _o.reason,
3088
3161
  hasFunctionCall
3089
3162
  }),
3090
3163
  usage: {
3091
3164
  inputTokens: response.usage.input_tokens,
3092
3165
  outputTokens: response.usage.output_tokens,
3093
3166
  totalTokens: response.usage.input_tokens + response.usage.output_tokens,
3094
- reasoningTokens: (_o = (_n = response.usage.output_tokens_details) == null ? void 0 : _n.reasoning_tokens) != null ? _o : void 0,
3095
- cachedInputTokens: (_q = (_p = response.usage.input_tokens_details) == null ? void 0 : _p.cached_tokens) != null ? _q : void 0
3167
+ reasoningTokens: (_q = (_p = response.usage.output_tokens_details) == null ? void 0 : _p.reasoning_tokens) != null ? _q : void 0,
3168
+ cachedInputTokens: (_s = (_r = response.usage.input_tokens_details) == null ? void 0 : _r.cached_tokens) != null ? _s : void 0
3096
3169
  },
3097
3170
  request: { body },
3098
3171
  response: {
@@ -3149,7 +3222,7 @@ var OpenAIResponsesLanguageModel = class {
3149
3222
  controller.enqueue({ type: "stream-start", warnings });
3150
3223
  },
3151
3224
  transform(chunk, controller) {
3152
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
3225
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
3153
3226
  if (options.includeRawChunks) {
3154
3227
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
3155
3228
  }
@@ -3191,14 +3264,20 @@ var OpenAIResponsesLanguageModel = class {
3191
3264
  toolName: "computer_use"
3192
3265
  });
3193
3266
  } else if (value.item.type === "file_search_call") {
3194
- ongoingToolCalls[value.output_index] = {
3267
+ controller.enqueue({
3268
+ type: "tool-call",
3269
+ toolCallId: value.item.id,
3195
3270
  toolName: "file_search",
3196
- toolCallId: value.item.id
3197
- };
3271
+ input: "{}",
3272
+ providerExecuted: true
3273
+ });
3274
+ } else if (value.item.type === "image_generation_call") {
3198
3275
  controller.enqueue({
3199
- type: "tool-input-start",
3200
- id: value.item.id,
3201
- toolName: "file_search"
3276
+ type: "tool-call",
3277
+ toolCallId: value.item.id,
3278
+ toolName: "image_generation",
3279
+ input: "{}",
3280
+ providerExecuted: true
3202
3281
  });
3203
3282
  } else if (value.item.type === "message") {
3204
3283
  controller.enqueue({
@@ -3290,26 +3369,19 @@ var OpenAIResponsesLanguageModel = class {
3290
3369
  });
3291
3370
  } else if (value.item.type === "file_search_call") {
3292
3371
  ongoingToolCalls[value.output_index] = void 0;
3293
- controller.enqueue({
3294
- type: "tool-input-end",
3295
- id: value.item.id
3296
- });
3297
- controller.enqueue({
3298
- type: "tool-call",
3299
- toolCallId: value.item.id,
3300
- toolName: "file_search",
3301
- input: "",
3302
- providerExecuted: true
3303
- });
3304
3372
  controller.enqueue({
3305
3373
  type: "tool-result",
3306
3374
  toolCallId: value.item.id,
3307
3375
  toolName: "file_search",
3308
3376
  result: {
3309
- type: "file_search_tool_result",
3310
- status: value.item.status || "completed",
3311
- ...value.item.queries && { queries: value.item.queries },
3312
- ...value.item.results && { results: value.item.results }
3377
+ queries: value.item.queries,
3378
+ results: (_c = (_b = value.item.results) == null ? void 0 : _b.map((result) => ({
3379
+ attributes: result.attributes,
3380
+ fileId: result.file_id,
3381
+ filename: result.filename,
3382
+ score: result.score,
3383
+ text: result.text
3384
+ }))) != null ? _c : null
3313
3385
  },
3314
3386
  providerExecuted: true
3315
3387
  });
@@ -3333,6 +3405,16 @@ var OpenAIResponsesLanguageModel = class {
3333
3405
  },
3334
3406
  providerExecuted: true
3335
3407
  });
3408
+ } else if (value.item.type === "image_generation_call") {
3409
+ controller.enqueue({
3410
+ type: "tool-result",
3411
+ toolCallId: value.item.id,
3412
+ toolName: "image_generation",
3413
+ result: {
3414
+ result: value.item.result
3415
+ },
3416
+ providerExecuted: true
3417
+ });
3336
3418
  } else if (value.item.type === "message") {
3337
3419
  controller.enqueue({
3338
3420
  type: "text-end",
@@ -3347,7 +3429,7 @@ var OpenAIResponsesLanguageModel = class {
3347
3429
  providerMetadata: {
3348
3430
  openai: {
3349
3431
  itemId: value.item.id,
3350
- reasoningEncryptedContent: (_b = value.item.encrypted_content) != null ? _b : null
3432
+ reasoningEncryptedContent: (_d = value.item.encrypted_content) != null ? _d : null
3351
3433
  }
3352
3434
  }
3353
3435
  });
@@ -3377,12 +3459,12 @@ var OpenAIResponsesLanguageModel = class {
3377
3459
  id: value.item_id,
3378
3460
  delta: value.delta
3379
3461
  });
3380
- if (((_d = (_c = options.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.logprobs) && value.logprobs) {
3462
+ if (((_f = (_e = options.providerOptions) == null ? void 0 : _e.openai) == null ? void 0 : _f.logprobs) && value.logprobs) {
3381
3463
  logprobs.push(value.logprobs);
3382
3464
  }
3383
3465
  } else if (isResponseReasoningSummaryPartAddedChunk(value)) {
3384
3466
  if (value.summary_index > 0) {
3385
- (_e = activeReasoning[value.item_id]) == null ? void 0 : _e.summaryParts.push(
3467
+ (_g = activeReasoning[value.item_id]) == null ? void 0 : _g.summaryParts.push(
3386
3468
  value.summary_index
3387
3469
  );
3388
3470
  controller.enqueue({
@@ -3391,7 +3473,7 @@ var OpenAIResponsesLanguageModel = class {
3391
3473
  providerMetadata: {
3392
3474
  openai: {
3393
3475
  itemId: value.item_id,
3394
- reasoningEncryptedContent: (_g = (_f = activeReasoning[value.item_id]) == null ? void 0 : _f.encryptedContent) != null ? _g : null
3476
+ reasoningEncryptedContent: (_i = (_h = activeReasoning[value.item_id]) == null ? void 0 : _h.encryptedContent) != null ? _i : null
3395
3477
  }
3396
3478
  }
3397
3479
  });
@@ -3409,14 +3491,14 @@ var OpenAIResponsesLanguageModel = class {
3409
3491
  });
3410
3492
  } else if (isResponseFinishedChunk(value)) {
3411
3493
  finishReason = mapOpenAIResponseFinishReason({
3412
- finishReason: (_h = value.response.incomplete_details) == null ? void 0 : _h.reason,
3494
+ finishReason: (_j = value.response.incomplete_details) == null ? void 0 : _j.reason,
3413
3495
  hasFunctionCall
3414
3496
  });
3415
3497
  usage.inputTokens = value.response.usage.input_tokens;
3416
3498
  usage.outputTokens = value.response.usage.output_tokens;
3417
3499
  usage.totalTokens = value.response.usage.input_tokens + value.response.usage.output_tokens;
3418
- usage.reasoningTokens = (_j = (_i = value.response.usage.output_tokens_details) == null ? void 0 : _i.reasoning_tokens) != null ? _j : void 0;
3419
- usage.cachedInputTokens = (_l = (_k = value.response.usage.input_tokens_details) == null ? void 0 : _k.cached_tokens) != null ? _l : void 0;
3500
+ usage.reasoningTokens = (_l = (_k = value.response.usage.output_tokens_details) == null ? void 0 : _k.reasoning_tokens) != null ? _l : void 0;
3501
+ usage.cachedInputTokens = (_n = (_m = value.response.usage.input_tokens_details) == null ? void 0 : _m.cached_tokens) != null ? _n : void 0;
3420
3502
  if (typeof value.response.service_tier === "string") {
3421
3503
  serviceTier = value.response.service_tier;
3422
3504
  }
@@ -3425,7 +3507,7 @@ var OpenAIResponsesLanguageModel = class {
3425
3507
  controller.enqueue({
3426
3508
  type: "source",
3427
3509
  sourceType: "url",
3428
- id: (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
3510
+ id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : generateId2(),
3429
3511
  url: value.annotation.url,
3430
3512
  title: value.annotation.title
3431
3513
  });
@@ -3433,10 +3515,10 @@ var OpenAIResponsesLanguageModel = class {
3433
3515
  controller.enqueue({
3434
3516
  type: "source",
3435
3517
  sourceType: "document",
3436
- id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : generateId2(),
3518
+ id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : generateId2(),
3437
3519
  mediaType: "text/plain",
3438
- title: (_t = (_s = value.annotation.quote) != null ? _s : value.annotation.filename) != null ? _t : "Document",
3439
- filename: (_u = value.annotation.filename) != null ? _u : value.annotation.file_id
3520
+ title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
3521
+ filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
3440
3522
  });
3441
3523
  }
3442
3524
  } else if (isErrorChunk(value)) {
@@ -3469,177 +3551,155 @@ var OpenAIResponsesLanguageModel = class {
3469
3551
  };
3470
3552
  }
3471
3553
  };
3472
- var usageSchema2 = z17.object({
3473
- input_tokens: z17.number(),
3474
- input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
3475
- output_tokens: z17.number(),
3476
- output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
3554
+ var usageSchema2 = z18.object({
3555
+ input_tokens: z18.number(),
3556
+ input_tokens_details: z18.object({ cached_tokens: z18.number().nullish() }).nullish(),
3557
+ output_tokens: z18.number(),
3558
+ output_tokens_details: z18.object({ reasoning_tokens: z18.number().nullish() }).nullish()
3477
3559
  });
3478
- var textDeltaChunkSchema = z17.object({
3479
- type: z17.literal("response.output_text.delta"),
3480
- item_id: z17.string(),
3481
- delta: z17.string(),
3560
+ var textDeltaChunkSchema = z18.object({
3561
+ type: z18.literal("response.output_text.delta"),
3562
+ item_id: z18.string(),
3563
+ delta: z18.string(),
3482
3564
  logprobs: LOGPROBS_SCHEMA.nullish()
3483
3565
  });
3484
- var errorChunkSchema = z17.object({
3485
- type: z17.literal("error"),
3486
- code: z17.string(),
3487
- message: z17.string(),
3488
- param: z17.string().nullish(),
3489
- sequence_number: z17.number()
3566
+ var errorChunkSchema = z18.object({
3567
+ type: z18.literal("error"),
3568
+ code: z18.string(),
3569
+ message: z18.string(),
3570
+ param: z18.string().nullish(),
3571
+ sequence_number: z18.number()
3490
3572
  });
3491
- var responseFinishedChunkSchema = z17.object({
3492
- type: z17.enum(["response.completed", "response.incomplete"]),
3493
- response: z17.object({
3494
- incomplete_details: z17.object({ reason: z17.string() }).nullish(),
3573
+ var responseFinishedChunkSchema = z18.object({
3574
+ type: z18.enum(["response.completed", "response.incomplete"]),
3575
+ response: z18.object({
3576
+ incomplete_details: z18.object({ reason: z18.string() }).nullish(),
3495
3577
  usage: usageSchema2,
3496
- service_tier: z17.string().nullish()
3578
+ service_tier: z18.string().nullish()
3497
3579
  })
3498
3580
  });
3499
- var responseCreatedChunkSchema = z17.object({
3500
- type: z17.literal("response.created"),
3501
- response: z17.object({
3502
- id: z17.string(),
3503
- created_at: z17.number(),
3504
- model: z17.string(),
3505
- service_tier: z17.string().nullish()
3581
+ var responseCreatedChunkSchema = z18.object({
3582
+ type: z18.literal("response.created"),
3583
+ response: z18.object({
3584
+ id: z18.string(),
3585
+ created_at: z18.number(),
3586
+ model: z18.string(),
3587
+ service_tier: z18.string().nullish()
3506
3588
  })
3507
3589
  });
3508
- var responseOutputItemAddedSchema = z17.object({
3509
- type: z17.literal("response.output_item.added"),
3510
- output_index: z17.number(),
3511
- item: z17.discriminatedUnion("type", [
3512
- z17.object({
3513
- type: z17.literal("message"),
3514
- id: z17.string()
3590
+ var responseOutputItemAddedSchema = z18.object({
3591
+ type: z18.literal("response.output_item.added"),
3592
+ output_index: z18.number(),
3593
+ item: z18.discriminatedUnion("type", [
3594
+ z18.object({
3595
+ type: z18.literal("message"),
3596
+ id: z18.string()
3515
3597
  }),
3516
- z17.object({
3517
- type: z17.literal("reasoning"),
3518
- id: z17.string(),
3519
- encrypted_content: z17.string().nullish()
3598
+ z18.object({
3599
+ type: z18.literal("reasoning"),
3600
+ id: z18.string(),
3601
+ encrypted_content: z18.string().nullish()
3520
3602
  }),
3521
- z17.object({
3522
- type: z17.literal("function_call"),
3523
- id: z17.string(),
3524
- call_id: z17.string(),
3525
- name: z17.string(),
3526
- arguments: z17.string()
3603
+ z18.object({
3604
+ type: z18.literal("function_call"),
3605
+ id: z18.string(),
3606
+ call_id: z18.string(),
3607
+ name: z18.string(),
3608
+ arguments: z18.string()
3527
3609
  }),
3528
- z17.object({
3529
- type: z17.literal("web_search_call"),
3530
- id: z17.string(),
3531
- status: z17.string(),
3532
- action: z17.object({
3533
- type: z17.literal("search"),
3534
- query: z17.string().optional()
3610
+ z18.object({
3611
+ type: z18.literal("web_search_call"),
3612
+ id: z18.string(),
3613
+ status: z18.string(),
3614
+ action: z18.object({
3615
+ type: z18.literal("search"),
3616
+ query: z18.string().optional()
3535
3617
  }).nullish()
3536
3618
  }),
3537
- z17.object({
3538
- type: z17.literal("computer_call"),
3539
- id: z17.string(),
3540
- status: z17.string()
3619
+ z18.object({
3620
+ type: z18.literal("computer_call"),
3621
+ id: z18.string(),
3622
+ status: z18.string()
3541
3623
  }),
3542
- z17.object({
3543
- type: z17.literal("file_search_call"),
3544
- id: z17.string(),
3545
- status: z17.string(),
3546
- queries: z17.array(z17.string()).nullish(),
3547
- results: z17.array(
3548
- z17.object({
3549
- attributes: z17.object({
3550
- file_id: z17.string(),
3551
- filename: z17.string(),
3552
- score: z17.number(),
3553
- text: z17.string()
3554
- })
3555
- })
3556
- ).optional()
3624
+ z18.object({
3625
+ type: z18.literal("file_search_call"),
3626
+ id: z18.string()
3627
+ }),
3628
+ z18.object({
3629
+ type: z18.literal("image_generation_call"),
3630
+ id: z18.string()
3557
3631
  })
3558
3632
  ])
3559
3633
  });
3560
- var responseOutputItemDoneSchema = z17.object({
3561
- type: z17.literal("response.output_item.done"),
3562
- output_index: z17.number(),
3563
- item: z17.discriminatedUnion("type", [
3564
- z17.object({
3565
- type: z17.literal("message"),
3566
- id: z17.string()
3634
+ var responseOutputItemDoneSchema = z18.object({
3635
+ type: z18.literal("response.output_item.done"),
3636
+ output_index: z18.number(),
3637
+ item: z18.discriminatedUnion("type", [
3638
+ z18.object({
3639
+ type: z18.literal("message"),
3640
+ id: z18.string()
3567
3641
  }),
3568
- z17.object({
3569
- type: z17.literal("reasoning"),
3570
- id: z17.string(),
3571
- encrypted_content: z17.string().nullish()
3642
+ z18.object({
3643
+ type: z18.literal("reasoning"),
3644
+ id: z18.string(),
3645
+ encrypted_content: z18.string().nullish()
3572
3646
  }),
3573
- z17.object({
3574
- type: z17.literal("function_call"),
3575
- id: z17.string(),
3576
- call_id: z17.string(),
3577
- name: z17.string(),
3578
- arguments: z17.string(),
3579
- status: z17.literal("completed")
3647
+ z18.object({
3648
+ type: z18.literal("function_call"),
3649
+ id: z18.string(),
3650
+ call_id: z18.string(),
3651
+ name: z18.string(),
3652
+ arguments: z18.string(),
3653
+ status: z18.literal("completed")
3580
3654
  }),
3581
3655
  codeInterpreterCallItem,
3656
+ imageGenerationCallItem,
3582
3657
  webSearchCallItem,
3583
- z17.object({
3584
- type: z17.literal("computer_call"),
3585
- id: z17.string(),
3586
- status: z17.literal("completed")
3587
- }),
3588
- z17.object({
3589
- type: z17.literal("file_search_call"),
3590
- id: z17.string(),
3591
- status: z17.literal("completed"),
3592
- queries: z17.array(z17.string()).nullish(),
3593
- results: z17.array(
3594
- z17.object({
3595
- attributes: z17.object({
3596
- file_id: z17.string(),
3597
- filename: z17.string(),
3598
- score: z17.number(),
3599
- text: z17.string()
3600
- })
3601
- })
3602
- ).nullish()
3658
+ fileSearchCallItem,
3659
+ z18.object({
3660
+ type: z18.literal("computer_call"),
3661
+ id: z18.string(),
3662
+ status: z18.literal("completed")
3603
3663
  })
3604
3664
  ])
3605
3665
  });
3606
- var responseFunctionCallArgumentsDeltaSchema = z17.object({
3607
- type: z17.literal("response.function_call_arguments.delta"),
3608
- item_id: z17.string(),
3609
- output_index: z17.number(),
3610
- delta: z17.string()
3666
+ var responseFunctionCallArgumentsDeltaSchema = z18.object({
3667
+ type: z18.literal("response.function_call_arguments.delta"),
3668
+ item_id: z18.string(),
3669
+ output_index: z18.number(),
3670
+ delta: z18.string()
3611
3671
  });
3612
- var responseAnnotationAddedSchema = z17.object({
3613
- type: z17.literal("response.output_text.annotation.added"),
3614
- annotation: z17.discriminatedUnion("type", [
3615
- z17.object({
3616
- type: z17.literal("url_citation"),
3617
- url: z17.string(),
3618
- title: z17.string()
3672
+ var responseAnnotationAddedSchema = z18.object({
3673
+ type: z18.literal("response.output_text.annotation.added"),
3674
+ annotation: z18.discriminatedUnion("type", [
3675
+ z18.object({
3676
+ type: z18.literal("url_citation"),
3677
+ url: z18.string(),
3678
+ title: z18.string()
3619
3679
  }),
3620
- z17.object({
3621
- type: z17.literal("file_citation"),
3622
- file_id: z17.string(),
3623
- filename: z17.string().nullish(),
3624
- index: z17.number().nullish(),
3625
- start_index: z17.number().nullish(),
3626
- end_index: z17.number().nullish(),
3627
- quote: z17.string().nullish()
3680
+ z18.object({
3681
+ type: z18.literal("file_citation"),
3682
+ file_id: z18.string(),
3683
+ filename: z18.string().nullish(),
3684
+ index: z18.number().nullish(),
3685
+ start_index: z18.number().nullish(),
3686
+ end_index: z18.number().nullish(),
3687
+ quote: z18.string().nullish()
3628
3688
  })
3629
3689
  ])
3630
3690
  });
3631
- var responseReasoningSummaryPartAddedSchema = z17.object({
3632
- type: z17.literal("response.reasoning_summary_part.added"),
3633
- item_id: z17.string(),
3634
- summary_index: z17.number()
3691
+ var responseReasoningSummaryPartAddedSchema = z18.object({
3692
+ type: z18.literal("response.reasoning_summary_part.added"),
3693
+ item_id: z18.string(),
3694
+ summary_index: z18.number()
3635
3695
  });
3636
- var responseReasoningSummaryTextDeltaSchema = z17.object({
3637
- type: z17.literal("response.reasoning_summary_text.delta"),
3638
- item_id: z17.string(),
3639
- summary_index: z17.number(),
3640
- delta: z17.string()
3696
+ var responseReasoningSummaryTextDeltaSchema = z18.object({
3697
+ type: z18.literal("response.reasoning_summary_text.delta"),
3698
+ item_id: z18.string(),
3699
+ summary_index: z18.number(),
3700
+ delta: z18.string()
3641
3701
  });
3642
- var openaiResponsesChunkSchema = z17.union([
3702
+ var openaiResponsesChunkSchema = z18.union([
3643
3703
  textDeltaChunkSchema,
3644
3704
  responseFinishedChunkSchema,
3645
3705
  responseCreatedChunkSchema,
@@ -3650,7 +3710,7 @@ var openaiResponsesChunkSchema = z17.union([
3650
3710
  responseReasoningSummaryPartAddedSchema,
3651
3711
  responseReasoningSummaryTextDeltaSchema,
3652
3712
  errorChunkSchema,
3653
- z17.object({ type: z17.string() }).loose()
3713
+ z18.object({ type: z18.string() }).loose()
3654
3714
  // fallback for unknown chunks
3655
3715
  ]);
3656
3716
  function isTextDeltaChunk(chunk) {
@@ -3723,27 +3783,15 @@ function getResponsesModelConfig(modelId) {
3723
3783
  isReasoningModel: false
3724
3784
  };
3725
3785
  }
3726
- var openaiResponsesProviderOptionsSchema = z17.object({
3727
- metadata: z17.any().nullish(),
3728
- parallelToolCalls: z17.boolean().nullish(),
3729
- previousResponseId: z17.string().nullish(),
3730
- store: z17.boolean().nullish(),
3731
- user: z17.string().nullish(),
3732
- reasoningEffort: z17.string().nullish(),
3733
- strictJsonSchema: z17.boolean().nullish(),
3734
- instructions: z17.string().nullish(),
3735
- reasoningSummary: z17.string().nullish(),
3736
- serviceTier: z17.enum(["auto", "flex", "priority"]).nullish(),
3737
- include: z17.array(
3738
- z17.enum([
3786
+ var openaiResponsesProviderOptionsSchema = z18.object({
3787
+ include: z18.array(
3788
+ z18.enum([
3739
3789
  "reasoning.encrypted_content",
3740
3790
  "file_search_call.results",
3741
3791
  "message.output_text.logprobs"
3742
3792
  ])
3743
3793
  ).nullish(),
3744
- textVerbosity: z17.enum(["low", "medium", "high"]).nullish(),
3745
- promptCacheKey: z17.string().nullish(),
3746
- safetyIdentifier: z17.string().nullish(),
3794
+ instructions: z18.string().nullish(),
3747
3795
  /**
3748
3796
  * Return the log probabilities of the tokens.
3749
3797
  *
@@ -3756,7 +3804,25 @@ var openaiResponsesProviderOptionsSchema = z17.object({
3756
3804
  * @see https://platform.openai.com/docs/api-reference/responses/create
3757
3805
  * @see https://cookbook.openai.com/examples/using_logprobs
3758
3806
  */
3759
- logprobs: z17.union([z17.boolean(), z17.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
3807
+ logprobs: z18.union([z18.boolean(), z18.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3808
+ /**
3809
+ * The maximum number of total calls to built-in tools that can be processed in a response.
3810
+ * This maximum number applies across all built-in tool calls, not per individual tool.
3811
+ * Any further attempts to call a tool by the model will be ignored.
3812
+ */
3813
+ maxToolCalls: z18.number().nullish(),
3814
+ metadata: z18.any().nullish(),
3815
+ parallelToolCalls: z18.boolean().nullish(),
3816
+ previousResponseId: z18.string().nullish(),
3817
+ promptCacheKey: z18.string().nullish(),
3818
+ reasoningEffort: z18.string().nullish(),
3819
+ reasoningSummary: z18.string().nullish(),
3820
+ safetyIdentifier: z18.string().nullish(),
3821
+ serviceTier: z18.enum(["auto", "flex", "priority"]).nullish(),
3822
+ store: z18.boolean().nullish(),
3823
+ strictJsonSchema: z18.boolean().nullish(),
3824
+ textVerbosity: z18.enum(["low", "medium", "high"]).nullish(),
3825
+ user: z18.string().nullish()
3760
3826
  });
3761
3827
  export {
3762
3828
  OpenAIChatLanguageModel,