@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.
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  parseProviderOptions,
18
18
  postJsonToApi
19
19
  } from "@ai-sdk/provider-utils";
20
- import { z as z5 } from "zod/v4";
20
+ import { z as z3 } from "zod/v4";
21
21
 
22
22
  // src/openai-error.ts
23
23
  import { z } from "zod/v4";
@@ -342,98 +342,6 @@ var openaiProviderOptions = z2.object({
342
342
  import {
343
343
  UnsupportedFunctionalityError as UnsupportedFunctionalityError2
344
344
  } from "@ai-sdk/provider";
345
-
346
- // src/tool/file-search.ts
347
- import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
348
- import { z as z3 } from "zod/v4";
349
- var comparisonFilterSchema = z3.object({
350
- key: z3.string(),
351
- type: z3.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
352
- value: z3.union([z3.string(), z3.number(), z3.boolean()])
353
- });
354
- var compoundFilterSchema = z3.object({
355
- type: z3.enum(["and", "or"]),
356
- filters: z3.array(
357
- z3.union([comparisonFilterSchema, z3.lazy(() => compoundFilterSchema)])
358
- )
359
- });
360
- var filtersSchema = z3.union([comparisonFilterSchema, compoundFilterSchema]);
361
- var fileSearchArgsSchema = z3.object({
362
- vectorStoreIds: z3.array(z3.string()).optional(),
363
- maxNumResults: z3.number().optional(),
364
- ranking: z3.object({
365
- ranker: z3.enum(["auto", "default-2024-08-21"]).optional()
366
- }).optional(),
367
- filters: filtersSchema.optional()
368
- });
369
- var fileSearch = createProviderDefinedToolFactory({
370
- id: "openai.file_search",
371
- name: "file_search",
372
- inputSchema: z3.object({
373
- query: z3.string()
374
- })
375
- });
376
-
377
- // src/tool/web-search-preview.ts
378
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
379
- import { z as z4 } from "zod/v4";
380
- var webSearchPreviewArgsSchema = z4.object({
381
- /**
382
- * Search context size to use for the web search.
383
- * - high: Most comprehensive context, highest cost, slower response
384
- * - medium: Balanced context, cost, and latency (default)
385
- * - low: Least context, lowest cost, fastest response
386
- */
387
- searchContextSize: z4.enum(["low", "medium", "high"]).optional(),
388
- /**
389
- * User location information to provide geographically relevant search results.
390
- */
391
- userLocation: z4.object({
392
- /**
393
- * Type of location (always 'approximate')
394
- */
395
- type: z4.literal("approximate"),
396
- /**
397
- * Two-letter ISO country code (e.g., 'US', 'GB')
398
- */
399
- country: z4.string().optional(),
400
- /**
401
- * City name (free text, e.g., 'Minneapolis')
402
- */
403
- city: z4.string().optional(),
404
- /**
405
- * Region name (free text, e.g., 'Minnesota')
406
- */
407
- region: z4.string().optional(),
408
- /**
409
- * IANA timezone (e.g., 'America/Chicago')
410
- */
411
- timezone: z4.string().optional()
412
- }).optional()
413
- });
414
- var webSearchPreview = createProviderDefinedToolFactory2({
415
- id: "openai.web_search_preview",
416
- name: "web_search_preview",
417
- inputSchema: z4.object({
418
- action: z4.discriminatedUnion("type", [
419
- z4.object({
420
- type: z4.literal("search"),
421
- query: z4.string().nullish()
422
- }),
423
- z4.object({
424
- type: z4.literal("open_page"),
425
- url: z4.string()
426
- }),
427
- z4.object({
428
- type: z4.literal("find"),
429
- url: z4.string(),
430
- pattern: z4.string()
431
- })
432
- ]).nullish()
433
- })
434
- });
435
-
436
- // src/chat/openai-chat-prepare-tools.ts
437
345
  function prepareChatTools({
438
346
  tools,
439
347
  toolChoice,
@@ -459,33 +367,6 @@ function prepareChatTools({
459
367
  }
460
368
  });
461
369
  break;
462
- case "provider-defined":
463
- switch (tool.id) {
464
- case "openai.file_search": {
465
- const args = fileSearchArgsSchema.parse(tool.args);
466
- openaiTools2.push({
467
- type: "file_search",
468
- vector_store_ids: args.vectorStoreIds,
469
- max_num_results: args.maxNumResults,
470
- ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
471
- filters: args.filters
472
- });
473
- break;
474
- }
475
- case "openai.web_search_preview": {
476
- const args = webSearchPreviewArgsSchema.parse(tool.args);
477
- openaiTools2.push({
478
- type: "web_search_preview",
479
- search_context_size: args.searchContextSize,
480
- user_location: args.userLocation
481
- });
482
- break;
483
- }
484
- default:
485
- toolWarnings.push({ type: "unsupported-tool", tool });
486
- break;
487
- }
488
- break;
489
370
  default:
490
371
  toolWarnings.push({ type: "unsupported-tool", tool });
491
372
  break;
@@ -1013,115 +894,115 @@ var OpenAIChatLanguageModel = class {
1013
894
  };
1014
895
  }
1015
896
  };
1016
- var openaiTokenUsageSchema = z5.object({
1017
- prompt_tokens: z5.number().nullish(),
1018
- completion_tokens: z5.number().nullish(),
1019
- total_tokens: z5.number().nullish(),
1020
- prompt_tokens_details: z5.object({
1021
- cached_tokens: z5.number().nullish()
897
+ var openaiTokenUsageSchema = z3.object({
898
+ prompt_tokens: z3.number().nullish(),
899
+ completion_tokens: z3.number().nullish(),
900
+ total_tokens: z3.number().nullish(),
901
+ prompt_tokens_details: z3.object({
902
+ cached_tokens: z3.number().nullish()
1022
903
  }).nullish(),
1023
- completion_tokens_details: z5.object({
1024
- reasoning_tokens: z5.number().nullish(),
1025
- accepted_prediction_tokens: z5.number().nullish(),
1026
- rejected_prediction_tokens: z5.number().nullish()
904
+ completion_tokens_details: z3.object({
905
+ reasoning_tokens: z3.number().nullish(),
906
+ accepted_prediction_tokens: z3.number().nullish(),
907
+ rejected_prediction_tokens: z3.number().nullish()
1027
908
  }).nullish()
1028
909
  }).nullish();
1029
- var openaiChatResponseSchema = z5.object({
1030
- id: z5.string().nullish(),
1031
- created: z5.number().nullish(),
1032
- model: z5.string().nullish(),
1033
- choices: z5.array(
1034
- z5.object({
1035
- message: z5.object({
1036
- role: z5.literal("assistant").nullish(),
1037
- content: z5.string().nullish(),
1038
- tool_calls: z5.array(
1039
- z5.object({
1040
- id: z5.string().nullish(),
1041
- type: z5.literal("function"),
1042
- function: z5.object({
1043
- name: z5.string(),
1044
- arguments: z5.string()
910
+ var openaiChatResponseSchema = z3.object({
911
+ id: z3.string().nullish(),
912
+ created: z3.number().nullish(),
913
+ model: z3.string().nullish(),
914
+ choices: z3.array(
915
+ z3.object({
916
+ message: z3.object({
917
+ role: z3.literal("assistant").nullish(),
918
+ content: z3.string().nullish(),
919
+ tool_calls: z3.array(
920
+ z3.object({
921
+ id: z3.string().nullish(),
922
+ type: z3.literal("function"),
923
+ function: z3.object({
924
+ name: z3.string(),
925
+ arguments: z3.string()
1045
926
  })
1046
927
  })
1047
928
  ).nullish(),
1048
- annotations: z5.array(
1049
- z5.object({
1050
- type: z5.literal("url_citation"),
1051
- start_index: z5.number(),
1052
- end_index: z5.number(),
1053
- url: z5.string(),
1054
- title: z5.string()
929
+ annotations: z3.array(
930
+ z3.object({
931
+ type: z3.literal("url_citation"),
932
+ start_index: z3.number(),
933
+ end_index: z3.number(),
934
+ url: z3.string(),
935
+ title: z3.string()
1055
936
  })
1056
937
  ).nullish()
1057
938
  }),
1058
- index: z5.number(),
1059
- logprobs: z5.object({
1060
- content: z5.array(
1061
- z5.object({
1062
- token: z5.string(),
1063
- logprob: z5.number(),
1064
- top_logprobs: z5.array(
1065
- z5.object({
1066
- token: z5.string(),
1067
- logprob: z5.number()
939
+ index: z3.number(),
940
+ logprobs: z3.object({
941
+ content: z3.array(
942
+ z3.object({
943
+ token: z3.string(),
944
+ logprob: z3.number(),
945
+ top_logprobs: z3.array(
946
+ z3.object({
947
+ token: z3.string(),
948
+ logprob: z3.number()
1068
949
  })
1069
950
  )
1070
951
  })
1071
952
  ).nullish()
1072
953
  }).nullish(),
1073
- finish_reason: z5.string().nullish()
954
+ finish_reason: z3.string().nullish()
1074
955
  })
1075
956
  ),
1076
957
  usage: openaiTokenUsageSchema
1077
958
  });
1078
- var openaiChatChunkSchema = z5.union([
1079
- z5.object({
1080
- id: z5.string().nullish(),
1081
- created: z5.number().nullish(),
1082
- model: z5.string().nullish(),
1083
- choices: z5.array(
1084
- z5.object({
1085
- delta: z5.object({
1086
- role: z5.enum(["assistant"]).nullish(),
1087
- content: z5.string().nullish(),
1088
- tool_calls: z5.array(
1089
- z5.object({
1090
- index: z5.number(),
1091
- id: z5.string().nullish(),
1092
- type: z5.literal("function").nullish(),
1093
- function: z5.object({
1094
- name: z5.string().nullish(),
1095
- arguments: z5.string().nullish()
959
+ var openaiChatChunkSchema = z3.union([
960
+ z3.object({
961
+ id: z3.string().nullish(),
962
+ created: z3.number().nullish(),
963
+ model: z3.string().nullish(),
964
+ choices: z3.array(
965
+ z3.object({
966
+ delta: z3.object({
967
+ role: z3.enum(["assistant"]).nullish(),
968
+ content: z3.string().nullish(),
969
+ tool_calls: z3.array(
970
+ z3.object({
971
+ index: z3.number(),
972
+ id: z3.string().nullish(),
973
+ type: z3.literal("function").nullish(),
974
+ function: z3.object({
975
+ name: z3.string().nullish(),
976
+ arguments: z3.string().nullish()
1096
977
  })
1097
978
  })
1098
979
  ).nullish(),
1099
- annotations: z5.array(
1100
- z5.object({
1101
- type: z5.literal("url_citation"),
1102
- start_index: z5.number(),
1103
- end_index: z5.number(),
1104
- url: z5.string(),
1105
- title: z5.string()
980
+ annotations: z3.array(
981
+ z3.object({
982
+ type: z3.literal("url_citation"),
983
+ start_index: z3.number(),
984
+ end_index: z3.number(),
985
+ url: z3.string(),
986
+ title: z3.string()
1106
987
  })
1107
988
  ).nullish()
1108
989
  }).nullish(),
1109
- logprobs: z5.object({
1110
- content: z5.array(
1111
- z5.object({
1112
- token: z5.string(),
1113
- logprob: z5.number(),
1114
- top_logprobs: z5.array(
1115
- z5.object({
1116
- token: z5.string(),
1117
- logprob: z5.number()
990
+ logprobs: z3.object({
991
+ content: z3.array(
992
+ z3.object({
993
+ token: z3.string(),
994
+ logprob: z3.number(),
995
+ top_logprobs: z3.array(
996
+ z3.object({
997
+ token: z3.string(),
998
+ logprob: z3.number()
1118
999
  })
1119
1000
  )
1120
1001
  })
1121
1002
  ).nullish()
1122
1003
  }).nullish(),
1123
- finish_reason: z5.string().nullish(),
1124
- index: z5.number()
1004
+ finish_reason: z3.string().nullish(),
1005
+ index: z3.number()
1125
1006
  })
1126
1007
  ),
1127
1008
  usage: openaiTokenUsageSchema
@@ -1185,7 +1066,7 @@ import {
1185
1066
  parseProviderOptions as parseProviderOptions2,
1186
1067
  postJsonToApi as postJsonToApi2
1187
1068
  } from "@ai-sdk/provider-utils";
1188
- import { z as z7 } from "zod/v4";
1069
+ import { z as z5 } from "zod/v4";
1189
1070
 
1190
1071
  // src/completion/convert-to-openai-completion-prompt.ts
1191
1072
  import {
@@ -1296,12 +1177,12 @@ function mapOpenAIFinishReason2(finishReason) {
1296
1177
  }
1297
1178
 
1298
1179
  // src/completion/openai-completion-options.ts
1299
- import { z as z6 } from "zod/v4";
1300
- var openaiCompletionProviderOptions = z6.object({
1180
+ import { z as z4 } from "zod/v4";
1181
+ var openaiCompletionProviderOptions = z4.object({
1301
1182
  /**
1302
1183
  Echo back the prompt in addition to the completion.
1303
1184
  */
1304
- echo: z6.boolean().optional(),
1185
+ echo: z4.boolean().optional(),
1305
1186
  /**
1306
1187
  Modify the likelihood of specified tokens appearing in the completion.
1307
1188
 
@@ -1316,16 +1197,16 @@ var openaiCompletionProviderOptions = z6.object({
1316
1197
  As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
1317
1198
  token from being generated.
1318
1199
  */
1319
- logitBias: z6.record(z6.string(), z6.number()).optional(),
1200
+ logitBias: z4.record(z4.string(), z4.number()).optional(),
1320
1201
  /**
1321
1202
  The suffix that comes after a completion of inserted text.
1322
1203
  */
1323
- suffix: z6.string().optional(),
1204
+ suffix: z4.string().optional(),
1324
1205
  /**
1325
1206
  A unique identifier representing your end-user, which can help OpenAI to
1326
1207
  monitor and detect abuse. Learn more.
1327
1208
  */
1328
- user: z6.string().optional(),
1209
+ user: z4.string().optional(),
1329
1210
  /**
1330
1211
  Return the log probabilities of the tokens. Including logprobs will increase
1331
1212
  the response size and can slow down response times. However, it can
@@ -1335,7 +1216,7 @@ var openaiCompletionProviderOptions = z6.object({
1335
1216
  Setting to a number will return the log probabilities of the top n
1336
1217
  tokens that were generated.
1337
1218
  */
1338
- logprobs: z6.union([z6.boolean(), z6.number()]).optional()
1219
+ logprobs: z4.union([z4.boolean(), z4.number()]).optional()
1339
1220
  });
1340
1221
 
1341
1222
  // src/completion/openai-completion-language-model.ts
@@ -1567,42 +1448,42 @@ var OpenAICompletionLanguageModel = class {
1567
1448
  };
1568
1449
  }
1569
1450
  };
1570
- var usageSchema = z7.object({
1571
- prompt_tokens: z7.number(),
1572
- completion_tokens: z7.number(),
1573
- total_tokens: z7.number()
1451
+ var usageSchema = z5.object({
1452
+ prompt_tokens: z5.number(),
1453
+ completion_tokens: z5.number(),
1454
+ total_tokens: z5.number()
1574
1455
  });
1575
- var openaiCompletionResponseSchema = z7.object({
1576
- id: z7.string().nullish(),
1577
- created: z7.number().nullish(),
1578
- model: z7.string().nullish(),
1579
- choices: z7.array(
1580
- z7.object({
1581
- text: z7.string(),
1582
- finish_reason: z7.string(),
1583
- logprobs: z7.object({
1584
- tokens: z7.array(z7.string()),
1585
- token_logprobs: z7.array(z7.number()),
1586
- top_logprobs: z7.array(z7.record(z7.string(), z7.number())).nullish()
1456
+ var openaiCompletionResponseSchema = z5.object({
1457
+ id: z5.string().nullish(),
1458
+ created: z5.number().nullish(),
1459
+ model: z5.string().nullish(),
1460
+ choices: z5.array(
1461
+ z5.object({
1462
+ text: z5.string(),
1463
+ finish_reason: z5.string(),
1464
+ logprobs: z5.object({
1465
+ tokens: z5.array(z5.string()),
1466
+ token_logprobs: z5.array(z5.number()),
1467
+ top_logprobs: z5.array(z5.record(z5.string(), z5.number())).nullish()
1587
1468
  }).nullish()
1588
1469
  })
1589
1470
  ),
1590
1471
  usage: usageSchema.nullish()
1591
1472
  });
1592
- var openaiCompletionChunkSchema = z7.union([
1593
- z7.object({
1594
- id: z7.string().nullish(),
1595
- created: z7.number().nullish(),
1596
- model: z7.string().nullish(),
1597
- choices: z7.array(
1598
- z7.object({
1599
- text: z7.string(),
1600
- finish_reason: z7.string().nullish(),
1601
- index: z7.number(),
1602
- logprobs: z7.object({
1603
- tokens: z7.array(z7.string()),
1604
- token_logprobs: z7.array(z7.number()),
1605
- top_logprobs: z7.array(z7.record(z7.string(), z7.number())).nullish()
1473
+ var openaiCompletionChunkSchema = z5.union([
1474
+ z5.object({
1475
+ id: z5.string().nullish(),
1476
+ created: z5.number().nullish(),
1477
+ model: z5.string().nullish(),
1478
+ choices: z5.array(
1479
+ z5.object({
1480
+ text: z5.string(),
1481
+ finish_reason: z5.string().nullish(),
1482
+ index: z5.number(),
1483
+ logprobs: z5.object({
1484
+ tokens: z5.array(z5.string()),
1485
+ token_logprobs: z5.array(z5.number()),
1486
+ top_logprobs: z5.array(z5.record(z5.string(), z5.number())).nullish()
1606
1487
  }).nullish()
1607
1488
  })
1608
1489
  ),
@@ -1621,21 +1502,21 @@ import {
1621
1502
  parseProviderOptions as parseProviderOptions3,
1622
1503
  postJsonToApi as postJsonToApi3
1623
1504
  } from "@ai-sdk/provider-utils";
1624
- import { z as z9 } from "zod/v4";
1505
+ import { z as z7 } from "zod/v4";
1625
1506
 
1626
1507
  // src/embedding/openai-embedding-options.ts
1627
- import { z as z8 } from "zod/v4";
1628
- var openaiEmbeddingProviderOptions = z8.object({
1508
+ import { z as z6 } from "zod/v4";
1509
+ var openaiEmbeddingProviderOptions = z6.object({
1629
1510
  /**
1630
1511
  The number of dimensions the resulting output embeddings should have.
1631
1512
  Only supported in text-embedding-3 and later models.
1632
1513
  */
1633
- dimensions: z8.number().optional(),
1514
+ dimensions: z6.number().optional(),
1634
1515
  /**
1635
1516
  A unique identifier representing your end-user, which can help OpenAI to
1636
1517
  monitor and detect abuse. Learn more.
1637
1518
  */
1638
- user: z8.string().optional()
1519
+ user: z6.string().optional()
1639
1520
  });
1640
1521
 
1641
1522
  // src/embedding/openai-embedding-model.ts
@@ -1701,9 +1582,9 @@ var OpenAIEmbeddingModel = class {
1701
1582
  };
1702
1583
  }
1703
1584
  };
1704
- var openaiTextEmbeddingResponseSchema = z9.object({
1705
- data: z9.array(z9.object({ embedding: z9.array(z9.number()) })),
1706
- usage: z9.object({ prompt_tokens: z9.number() }).nullish()
1585
+ var openaiTextEmbeddingResponseSchema = z7.object({
1586
+ data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
1587
+ usage: z7.object({ prompt_tokens: z7.number() }).nullish()
1707
1588
  });
1708
1589
 
1709
1590
  // src/image/openai-image-model.ts
@@ -1712,7 +1593,7 @@ import {
1712
1593
  createJsonResponseHandler as createJsonResponseHandler4,
1713
1594
  postJsonToApi as postJsonToApi4
1714
1595
  } from "@ai-sdk/provider-utils";
1715
- import { z as z10 } from "zod/v4";
1596
+ import { z as z8 } from "zod/v4";
1716
1597
 
1717
1598
  // src/image/openai-image-options.ts
1718
1599
  var modelMaxImagesPerCall = {
@@ -1800,32 +1681,32 @@ var OpenAIImageModel = class {
1800
1681
  };
1801
1682
  }
1802
1683
  };
1803
- var openaiImageResponseSchema = z10.object({
1804
- data: z10.array(
1805
- z10.object({ b64_json: z10.string(), revised_prompt: z10.string().optional() })
1684
+ var openaiImageResponseSchema = z8.object({
1685
+ data: z8.array(
1686
+ z8.object({ b64_json: z8.string(), revised_prompt: z8.string().optional() })
1806
1687
  )
1807
1688
  });
1808
1689
 
1809
1690
  // src/tool/code-interpreter.ts
1810
1691
  import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
1811
- import { z as z11 } from "zod/v4";
1812
- var codeInterpreterInputSchema = z11.object({
1813
- code: z11.string().nullish(),
1814
- containerId: z11.string()
1692
+ import { z as z9 } from "zod/v4";
1693
+ var codeInterpreterInputSchema = z9.object({
1694
+ code: z9.string().nullish(),
1695
+ containerId: z9.string()
1815
1696
  });
1816
- var codeInterpreterOutputSchema = z11.object({
1817
- outputs: z11.array(
1818
- z11.discriminatedUnion("type", [
1819
- z11.object({ type: z11.literal("logs"), logs: z11.string() }),
1820
- z11.object({ type: z11.literal("image"), url: z11.string() })
1697
+ var codeInterpreterOutputSchema = z9.object({
1698
+ outputs: z9.array(
1699
+ z9.discriminatedUnion("type", [
1700
+ z9.object({ type: z9.literal("logs"), logs: z9.string() }),
1701
+ z9.object({ type: z9.literal("image"), url: z9.string() })
1821
1702
  ])
1822
1703
  ).nullish()
1823
1704
  });
1824
- var codeInterpreterArgsSchema = z11.object({
1825
- container: z11.union([
1826
- z11.string(),
1827
- z11.object({
1828
- fileIds: z11.array(z11.string()).optional()
1705
+ var codeInterpreterArgsSchema = z9.object({
1706
+ container: z9.union([
1707
+ z9.string(),
1708
+ z9.object({
1709
+ fileIds: z9.array(z9.string()).optional()
1829
1710
  })
1830
1711
  ]).optional()
1831
1712
  });
@@ -1839,8 +1720,80 @@ var codeInterpreter = (args = {}) => {
1839
1720
  return codeInterpreterToolFactory(args);
1840
1721
  };
1841
1722
 
1723
+ // src/tool/file-search.ts
1724
+ import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
1725
+ import { z as z10 } from "zod/v4";
1726
+ var comparisonFilterSchema = z10.object({
1727
+ key: z10.string(),
1728
+ type: z10.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
1729
+ value: z10.union([z10.string(), z10.number(), z10.boolean()])
1730
+ });
1731
+ var compoundFilterSchema = z10.object({
1732
+ type: z10.enum(["and", "or"]),
1733
+ filters: z10.array(
1734
+ z10.union([comparisonFilterSchema, z10.lazy(() => compoundFilterSchema)])
1735
+ )
1736
+ });
1737
+ var fileSearchArgsSchema = z10.object({
1738
+ vectorStoreIds: z10.array(z10.string()),
1739
+ maxNumResults: z10.number().optional(),
1740
+ ranking: z10.object({
1741
+ ranker: z10.string().optional(),
1742
+ scoreThreshold: z10.number().optional()
1743
+ }).optional(),
1744
+ filters: z10.union([comparisonFilterSchema, compoundFilterSchema]).optional()
1745
+ });
1746
+ var fileSearchOutputSchema = z10.object({
1747
+ queries: z10.array(z10.string()),
1748
+ results: z10.array(
1749
+ z10.object({
1750
+ attributes: z10.record(z10.string(), z10.unknown()),
1751
+ fileId: z10.string(),
1752
+ filename: z10.string(),
1753
+ score: z10.number(),
1754
+ text: z10.string()
1755
+ })
1756
+ ).nullable()
1757
+ });
1758
+ var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
1759
+ id: "openai.file_search",
1760
+ name: "file_search",
1761
+ inputSchema: z10.object({}),
1762
+ outputSchema: fileSearchOutputSchema
1763
+ });
1764
+
1765
+ // src/tool/image-generation.ts
1766
+ import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3 } from "@ai-sdk/provider-utils";
1767
+ import { z as z11 } from "zod/v4";
1768
+ var imageGenerationArgsSchema = z11.object({
1769
+ background: z11.enum(["auto", "opaque", "transparent"]).optional(),
1770
+ inputFidelity: z11.enum(["low", "high"]).optional(),
1771
+ inputImageMask: z11.object({
1772
+ fileId: z11.string().optional(),
1773
+ imageUrl: z11.string().optional()
1774
+ }).optional(),
1775
+ model: z11.string().optional(),
1776
+ moderation: z11.enum(["auto"]).optional(),
1777
+ outputCompression: z11.number().int().min(0).max(100).optional(),
1778
+ outputFormat: z11.enum(["png", "jpeg", "webp"]).optional(),
1779
+ quality: z11.enum(["auto", "low", "medium", "high"]).optional(),
1780
+ size: z11.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
1781
+ }).strict();
1782
+ var imageGenerationOutputSchema = z11.object({
1783
+ result: z11.string()
1784
+ });
1785
+ var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
1786
+ id: "openai.image_generation",
1787
+ name: "image_generation",
1788
+ inputSchema: z11.object({}),
1789
+ outputSchema: imageGenerationOutputSchema
1790
+ });
1791
+ var imageGeneration = (args = {}) => {
1792
+ return imageGenerationToolFactory(args);
1793
+ };
1794
+
1842
1795
  // src/tool/web-search.ts
1843
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory3 } from "@ai-sdk/provider-utils";
1796
+ import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
1844
1797
  import { z as z12 } from "zod/v4";
1845
1798
  var webSearchArgsSchema = z12.object({
1846
1799
  filters: z12.object({
@@ -1855,7 +1808,7 @@ var webSearchArgsSchema = z12.object({
1855
1808
  timezone: z12.string().optional()
1856
1809
  }).optional()
1857
1810
  });
1858
- var webSearchToolFactory = createProviderDefinedToolFactory3({
1811
+ var webSearchToolFactory = createProviderDefinedToolFactory({
1859
1812
  id: "openai.web_search",
1860
1813
  name: "web_search",
1861
1814
  inputSchema: z12.object({
@@ -1880,6 +1833,65 @@ var webSearch = (args = {}) => {
1880
1833
  return webSearchToolFactory(args);
1881
1834
  };
1882
1835
 
1836
+ // src/tool/web-search-preview.ts
1837
+ import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
1838
+ import { z as z13 } from "zod/v4";
1839
+ var webSearchPreviewArgsSchema = z13.object({
1840
+ /**
1841
+ * Search context size to use for the web search.
1842
+ * - high: Most comprehensive context, highest cost, slower response
1843
+ * - medium: Balanced context, cost, and latency (default)
1844
+ * - low: Least context, lowest cost, fastest response
1845
+ */
1846
+ searchContextSize: z13.enum(["low", "medium", "high"]).optional(),
1847
+ /**
1848
+ * User location information to provide geographically relevant search results.
1849
+ */
1850
+ userLocation: z13.object({
1851
+ /**
1852
+ * Type of location (always 'approximate')
1853
+ */
1854
+ type: z13.literal("approximate"),
1855
+ /**
1856
+ * Two-letter ISO country code (e.g., 'US', 'GB')
1857
+ */
1858
+ country: z13.string().optional(),
1859
+ /**
1860
+ * City name (free text, e.g., 'Minneapolis')
1861
+ */
1862
+ city: z13.string().optional(),
1863
+ /**
1864
+ * Region name (free text, e.g., 'Minnesota')
1865
+ */
1866
+ region: z13.string().optional(),
1867
+ /**
1868
+ * IANA timezone (e.g., 'America/Chicago')
1869
+ */
1870
+ timezone: z13.string().optional()
1871
+ }).optional()
1872
+ });
1873
+ var webSearchPreview = createProviderDefinedToolFactory2({
1874
+ id: "openai.web_search_preview",
1875
+ name: "web_search_preview",
1876
+ inputSchema: z13.object({
1877
+ action: z13.discriminatedUnion("type", [
1878
+ z13.object({
1879
+ type: z13.literal("search"),
1880
+ query: z13.string().nullish()
1881
+ }),
1882
+ z13.object({
1883
+ type: z13.literal("open_page"),
1884
+ url: z13.string()
1885
+ }),
1886
+ z13.object({
1887
+ type: z13.literal("find"),
1888
+ url: z13.string(),
1889
+ pattern: z13.string()
1890
+ })
1891
+ ]).nullish()
1892
+ })
1893
+ });
1894
+
1883
1895
  // src/openai-tools.ts
1884
1896
  var openaiTools = {
1885
1897
  /**
@@ -1905,6 +1917,20 @@ var openaiTools = {
1905
1917
  * @param filters - The filters to use for the file search.
1906
1918
  */
1907
1919
  fileSearch,
1920
+ /**
1921
+ * The image generation tool allows you to generate images using a text prompt,
1922
+ * and optionally image inputs. It leverages the GPT Image model,
1923
+ * and automatically optimizes text inputs for improved performance.
1924
+ *
1925
+ * Must have name `image_generation`.
1926
+ *
1927
+ * @param size - Image dimensions (e.g., 1024x1024, 1024x1536)
1928
+ * @param quality - Rendering quality (e.g. low, medium, high)
1929
+ * @param format - File output format
1930
+ * @param compression - Compression level (0-100%) for JPEG and WebP formats
1931
+ * @param background - Transparent or opaque
1932
+ */
1933
+ imageGeneration,
1908
1934
  /**
1909
1935
  * Web search allows models to access up-to-date information from the internet
1910
1936
  * and provide answers with sourced citations.
@@ -1942,14 +1968,14 @@ import {
1942
1968
  parseProviderOptions as parseProviderOptions5,
1943
1969
  postJsonToApi as postJsonToApi5
1944
1970
  } from "@ai-sdk/provider-utils";
1945
- import { z as z14 } from "zod/v4";
1971
+ import { z as z15 } from "zod/v4";
1946
1972
 
1947
1973
  // src/responses/convert-to-openai-responses-input.ts
1948
1974
  import {
1949
1975
  UnsupportedFunctionalityError as UnsupportedFunctionalityError4
1950
1976
  } from "@ai-sdk/provider";
1951
1977
  import { convertToBase64 as convertToBase642, parseProviderOptions as parseProviderOptions4 } from "@ai-sdk/provider-utils";
1952
- import { z as z13 } from "zod/v4";
1978
+ import { z as z14 } from "zod/v4";
1953
1979
  function isFileId(data, prefixes) {
1954
1980
  if (!prefixes) return false;
1955
1981
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -1957,7 +1983,8 @@ function isFileId(data, prefixes) {
1957
1983
  async function convertToOpenAIResponsesInput({
1958
1984
  prompt,
1959
1985
  systemMessageMode,
1960
- fileIdPrefixes
1986
+ fileIdPrefixes,
1987
+ store
1961
1988
  }) {
1962
1989
  var _a, _b, _c, _d, _e, _f;
1963
1990
  const input = [];
@@ -2062,10 +2089,14 @@ async function convertToOpenAIResponsesInput({
2062
2089
  break;
2063
2090
  }
2064
2091
  case "tool-result": {
2065
- warnings.push({
2066
- type: "other",
2067
- message: `tool result parts in assistant messages are not supported for OpenAI responses`
2068
- });
2092
+ if (store) {
2093
+ input.push({ type: "item_reference", id: part.toolCallId });
2094
+ } else {
2095
+ warnings.push({
2096
+ type: "other",
2097
+ message: `Results for OpenAI tool ${part.toolName} are not sent to the API when store is false`
2098
+ });
2099
+ }
2069
2100
  break;
2070
2101
  }
2071
2102
  case "reasoning": {
@@ -2140,9 +2171,9 @@ async function convertToOpenAIResponsesInput({
2140
2171
  }
2141
2172
  return { input, warnings };
2142
2173
  }
2143
- var openaiResponsesReasoningProviderOptionsSchema = z13.object({
2144
- itemId: z13.string().nullish(),
2145
- reasoningEncryptedContent: z13.string().nullish()
2174
+ var openaiResponsesReasoningProviderOptionsSchema = z14.object({
2175
+ itemId: z14.string().nullish(),
2176
+ reasoningEncryptedContent: z14.string().nullish()
2146
2177
  });
2147
2178
 
2148
2179
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2197,7 +2228,10 @@ function prepareResponsesTools({
2197
2228
  type: "file_search",
2198
2229
  vector_store_ids: args.vectorStoreIds,
2199
2230
  max_num_results: args.maxNumResults,
2200
- ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
2231
+ ranking_options: args.ranking ? {
2232
+ ranker: args.ranking.ranker,
2233
+ score_threshold: args.ranking.scoreThreshold
2234
+ } : void 0,
2201
2235
  filters: args.filters
2202
2236
  });
2203
2237
  break;
@@ -2229,8 +2263,23 @@ function prepareResponsesTools({
2229
2263
  });
2230
2264
  break;
2231
2265
  }
2232
- default: {
2233
- toolWarnings.push({ type: "unsupported-tool", tool });
2266
+ case "openai.image_generation": {
2267
+ const args = imageGenerationArgsSchema.parse(tool.args);
2268
+ openaiTools2.push({
2269
+ type: "image_generation",
2270
+ background: args.background,
2271
+ input_fidelity: args.inputFidelity,
2272
+ input_image_mask: args.inputImageMask ? {
2273
+ file_id: args.inputImageMask.fileId,
2274
+ image_url: args.inputImageMask.imageUrl
2275
+ } : void 0,
2276
+ model: args.model,
2277
+ size: args.size,
2278
+ quality: args.quality,
2279
+ moderation: args.moderation,
2280
+ output_format: args.outputFormat,
2281
+ output_compression: args.outputCompression
2282
+ });
2234
2283
  break;
2235
2284
  }
2236
2285
  }
@@ -2253,7 +2302,7 @@ function prepareResponsesTools({
2253
2302
  case "tool":
2254
2303
  return {
2255
2304
  tools: openaiTools2,
2256
- 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 },
2305
+ 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 },
2257
2306
  toolWarnings
2258
2307
  };
2259
2308
  default: {
@@ -2266,47 +2315,66 @@ function prepareResponsesTools({
2266
2315
  }
2267
2316
 
2268
2317
  // src/responses/openai-responses-language-model.ts
2269
- var webSearchCallItem = z14.object({
2270
- type: z14.literal("web_search_call"),
2271
- id: z14.string(),
2272
- status: z14.string(),
2273
- action: z14.discriminatedUnion("type", [
2274
- z14.object({
2275
- type: z14.literal("search"),
2276
- query: z14.string().nullish()
2318
+ var webSearchCallItem = z15.object({
2319
+ type: z15.literal("web_search_call"),
2320
+ id: z15.string(),
2321
+ status: z15.string(),
2322
+ action: z15.discriminatedUnion("type", [
2323
+ z15.object({
2324
+ type: z15.literal("search"),
2325
+ query: z15.string().nullish()
2277
2326
  }),
2278
- z14.object({
2279
- type: z14.literal("open_page"),
2280
- url: z14.string()
2327
+ z15.object({
2328
+ type: z15.literal("open_page"),
2329
+ url: z15.string()
2281
2330
  }),
2282
- z14.object({
2283
- type: z14.literal("find"),
2284
- url: z14.string(),
2285
- pattern: z14.string()
2331
+ z15.object({
2332
+ type: z15.literal("find"),
2333
+ url: z15.string(),
2334
+ pattern: z15.string()
2286
2335
  })
2287
2336
  ]).nullish()
2288
2337
  });
2289
- var codeInterpreterCallItem = z14.object({
2290
- type: z14.literal("code_interpreter_call"),
2291
- id: z14.string(),
2292
- code: z14.string().nullable(),
2293
- container_id: z14.string(),
2294
- outputs: z14.array(
2295
- z14.discriminatedUnion("type", [
2296
- z14.object({ type: z14.literal("logs"), logs: z14.string() }),
2297
- z14.object({ type: z14.literal("image"), url: z14.string() })
2338
+ var fileSearchCallItem = z15.object({
2339
+ type: z15.literal("file_search_call"),
2340
+ id: z15.string(),
2341
+ queries: z15.array(z15.string()),
2342
+ results: z15.array(
2343
+ z15.object({
2344
+ attributes: z15.record(z15.string(), z15.unknown()),
2345
+ file_id: z15.string(),
2346
+ filename: z15.string(),
2347
+ score: z15.number(),
2348
+ text: z15.string()
2349
+ })
2350
+ ).nullish()
2351
+ });
2352
+ var codeInterpreterCallItem = z15.object({
2353
+ type: z15.literal("code_interpreter_call"),
2354
+ id: z15.string(),
2355
+ code: z15.string().nullable(),
2356
+ container_id: z15.string(),
2357
+ outputs: z15.array(
2358
+ z15.discriminatedUnion("type", [
2359
+ z15.object({ type: z15.literal("logs"), logs: z15.string() }),
2360
+ z15.object({ type: z15.literal("image"), url: z15.string() })
2298
2361
  ])
2299
2362
  ).nullable()
2300
2363
  });
2364
+ var imageGenerationCallItem = z15.object({
2365
+ type: z15.literal("image_generation_call"),
2366
+ id: z15.string(),
2367
+ result: z15.string()
2368
+ });
2301
2369
  var TOP_LOGPROBS_MAX = 20;
2302
- var LOGPROBS_SCHEMA = z14.array(
2303
- z14.object({
2304
- token: z14.string(),
2305
- logprob: z14.number(),
2306
- top_logprobs: z14.array(
2307
- z14.object({
2308
- token: z14.string(),
2309
- logprob: z14.number()
2370
+ var LOGPROBS_SCHEMA = z15.array(
2371
+ z15.object({
2372
+ token: z15.string(),
2373
+ logprob: z15.number(),
2374
+ top_logprobs: z15.array(
2375
+ z15.object({
2376
+ token: z15.string(),
2377
+ logprob: z15.number()
2310
2378
  })
2311
2379
  )
2312
2380
  })
@@ -2363,29 +2431,41 @@ var OpenAIResponsesLanguageModel = class {
2363
2431
  if (stopSequences != null) {
2364
2432
  warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
2365
2433
  }
2366
- const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
2367
- prompt,
2368
- systemMessageMode: modelConfig.systemMessageMode,
2369
- fileIdPrefixes: this.config.fileIdPrefixes
2370
- });
2371
- warnings.push(...inputWarnings);
2372
2434
  const openaiOptions = await parseProviderOptions5({
2373
2435
  provider: "openai",
2374
2436
  providerOptions,
2375
2437
  schema: openaiResponsesProviderOptionsSchema
2376
2438
  });
2377
- const strictJsonSchema = (_a = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _a : false;
2439
+ const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
2440
+ prompt,
2441
+ systemMessageMode: modelConfig.systemMessageMode,
2442
+ fileIdPrefixes: this.config.fileIdPrefixes,
2443
+ store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
2444
+ });
2445
+ warnings.push(...inputWarnings);
2446
+ const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
2378
2447
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
2448
+ function addInclude(key) {
2449
+ include = include != null ? [...include, key] : [key];
2450
+ }
2451
+ function hasOpenAITool(id) {
2452
+ return (tools == null ? void 0 : tools.find(
2453
+ (tool) => tool.type === "provider-defined" && tool.id === id
2454
+ )) != null;
2455
+ }
2379
2456
  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;
2380
- include = topLogprobs ? Array.isArray(include) ? [...include, "message.output_text.logprobs"] : ["message.output_text.logprobs"] : include;
2381
- const webSearchToolName = (_b = tools == null ? void 0 : tools.find(
2457
+ if (topLogprobs) {
2458
+ addInclude("message.output_text.logprobs");
2459
+ }
2460
+ const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
2382
2461
  (tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
2383
- )) == null ? void 0 : _b.name;
2384
- include = webSearchToolName ? Array.isArray(include) ? [...include, "web_search_call.action.sources"] : ["web_search_call.action.sources"] : include;
2385
- const codeInterpreterToolName = (_c = tools == null ? void 0 : tools.find(
2386
- (tool) => tool.type === "provider-defined" && tool.id === "openai.code_interpreter"
2387
2462
  )) == null ? void 0 : _c.name;
2388
- include = codeInterpreterToolName ? Array.isArray(include) ? [...include, "code_interpreter_call.outputs"] : ["code_interpreter_call.outputs"] : include;
2463
+ if (webSearchToolName) {
2464
+ addInclude("web_search_call.action.sources");
2465
+ }
2466
+ if (hasOpenAITool("openai.code_interpreter")) {
2467
+ addInclude("code_interpreter_call.outputs");
2468
+ }
2389
2469
  const baseArgs = {
2390
2470
  model: this.modelId,
2391
2471
  input,
@@ -2409,6 +2489,7 @@ var OpenAIResponsesLanguageModel = class {
2409
2489
  }
2410
2490
  },
2411
2491
  // provider options:
2492
+ max_tool_calls: openaiOptions == null ? void 0 : openaiOptions.maxToolCalls,
2412
2493
  metadata: openaiOptions == null ? void 0 : openaiOptions.metadata,
2413
2494
  parallel_tool_calls: openaiOptions == null ? void 0 : openaiOptions.parallelToolCalls,
2414
2495
  previous_response_id: openaiOptions == null ? void 0 : openaiOptions.previousResponseId,
@@ -2504,7 +2585,7 @@ var OpenAIResponsesLanguageModel = class {
2504
2585
  };
2505
2586
  }
2506
2587
  async doGenerate(options) {
2507
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2588
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
2508
2589
  const {
2509
2590
  args: body,
2510
2591
  warnings,
@@ -2524,96 +2605,82 @@ var OpenAIResponsesLanguageModel = class {
2524
2605
  body,
2525
2606
  failedResponseHandler: openaiFailedResponseHandler,
2526
2607
  successfulResponseHandler: createJsonResponseHandler5(
2527
- z14.object({
2528
- id: z14.string(),
2529
- created_at: z14.number(),
2530
- error: z14.object({
2531
- code: z14.string(),
2532
- message: z14.string()
2608
+ z15.object({
2609
+ id: z15.string(),
2610
+ created_at: z15.number(),
2611
+ error: z15.object({
2612
+ code: z15.string(),
2613
+ message: z15.string()
2533
2614
  }).nullish(),
2534
- model: z14.string(),
2535
- output: z14.array(
2536
- z14.discriminatedUnion("type", [
2537
- z14.object({
2538
- type: z14.literal("message"),
2539
- role: z14.literal("assistant"),
2540
- id: z14.string(),
2541
- content: z14.array(
2542
- z14.object({
2543
- type: z14.literal("output_text"),
2544
- text: z14.string(),
2615
+ model: z15.string(),
2616
+ output: z15.array(
2617
+ z15.discriminatedUnion("type", [
2618
+ z15.object({
2619
+ type: z15.literal("message"),
2620
+ role: z15.literal("assistant"),
2621
+ id: z15.string(),
2622
+ content: z15.array(
2623
+ z15.object({
2624
+ type: z15.literal("output_text"),
2625
+ text: z15.string(),
2545
2626
  logprobs: LOGPROBS_SCHEMA.nullish(),
2546
- annotations: z14.array(
2547
- z14.discriminatedUnion("type", [
2548
- z14.object({
2549
- type: z14.literal("url_citation"),
2550
- start_index: z14.number(),
2551
- end_index: z14.number(),
2552
- url: z14.string(),
2553
- title: z14.string()
2627
+ annotations: z15.array(
2628
+ z15.discriminatedUnion("type", [
2629
+ z15.object({
2630
+ type: z15.literal("url_citation"),
2631
+ start_index: z15.number(),
2632
+ end_index: z15.number(),
2633
+ url: z15.string(),
2634
+ title: z15.string()
2554
2635
  }),
2555
- z14.object({
2556
- type: z14.literal("file_citation"),
2557
- file_id: z14.string(),
2558
- filename: z14.string().nullish(),
2559
- index: z14.number().nullish(),
2560
- start_index: z14.number().nullish(),
2561
- end_index: z14.number().nullish(),
2562
- quote: z14.string().nullish()
2636
+ z15.object({
2637
+ type: z15.literal("file_citation"),
2638
+ file_id: z15.string(),
2639
+ filename: z15.string().nullish(),
2640
+ index: z15.number().nullish(),
2641
+ start_index: z15.number().nullish(),
2642
+ end_index: z15.number().nullish(),
2643
+ quote: z15.string().nullish()
2563
2644
  }),
2564
- z14.object({
2565
- type: z14.literal("container_file_citation")
2645
+ z15.object({
2646
+ type: z15.literal("container_file_citation")
2566
2647
  })
2567
2648
  ])
2568
2649
  )
2569
2650
  })
2570
2651
  )
2571
2652
  }),
2572
- codeInterpreterCallItem,
2573
- z14.object({
2574
- type: z14.literal("function_call"),
2575
- call_id: z14.string(),
2576
- name: z14.string(),
2577
- arguments: z14.string(),
2578
- id: z14.string()
2579
- }),
2580
2653
  webSearchCallItem,
2581
- z14.object({
2582
- type: z14.literal("computer_call"),
2583
- id: z14.string(),
2584
- status: z14.string().optional()
2654
+ fileSearchCallItem,
2655
+ codeInterpreterCallItem,
2656
+ imageGenerationCallItem,
2657
+ z15.object({
2658
+ type: z15.literal("function_call"),
2659
+ call_id: z15.string(),
2660
+ name: z15.string(),
2661
+ arguments: z15.string(),
2662
+ id: z15.string()
2585
2663
  }),
2586
- z14.object({
2587
- type: z14.literal("file_search_call"),
2588
- id: z14.string(),
2589
- status: z14.string().optional(),
2590
- queries: z14.array(z14.string()).nullish(),
2591
- results: z14.array(
2592
- z14.object({
2593
- attributes: z14.object({
2594
- file_id: z14.string(),
2595
- filename: z14.string(),
2596
- score: z14.number(),
2597
- text: z14.string()
2598
- })
2599
- })
2600
- ).nullish()
2664
+ z15.object({
2665
+ type: z15.literal("computer_call"),
2666
+ id: z15.string(),
2667
+ status: z15.string().optional()
2601
2668
  }),
2602
- z14.object({
2603
- type: z14.literal("reasoning"),
2604
- id: z14.string(),
2605
- encrypted_content: z14.string().nullish(),
2606
- summary: z14.array(
2607
- z14.object({
2608
- type: z14.literal("summary_text"),
2609
- text: z14.string()
2669
+ z15.object({
2670
+ type: z15.literal("reasoning"),
2671
+ id: z15.string(),
2672
+ encrypted_content: z15.string().nullish(),
2673
+ summary: z15.array(
2674
+ z15.object({
2675
+ type: z15.literal("summary_text"),
2676
+ text: z15.string()
2610
2677
  })
2611
2678
  )
2612
2679
  })
2613
2680
  ])
2614
2681
  ),
2615
- service_tier: z14.string().nullish(),
2616
- incomplete_details: z14.object({ reason: z14.string() }).nullable(),
2682
+ service_tier: z15.string().nullish(),
2683
+ incomplete_details: z15.object({ reason: z15.string() }).nullable(),
2617
2684
  usage: usageSchema2
2618
2685
  })
2619
2686
  ),
@@ -2654,6 +2721,25 @@ var OpenAIResponsesLanguageModel = class {
2654
2721
  }
2655
2722
  break;
2656
2723
  }
2724
+ case "image_generation_call": {
2725
+ content.push({
2726
+ type: "tool-call",
2727
+ toolCallId: part.id,
2728
+ toolName: "image_generation",
2729
+ input: "{}",
2730
+ providerExecuted: true
2731
+ });
2732
+ content.push({
2733
+ type: "tool-result",
2734
+ toolCallId: part.id,
2735
+ toolName: "image_generation",
2736
+ result: {
2737
+ result: part.result
2738
+ },
2739
+ providerExecuted: true
2740
+ });
2741
+ break;
2742
+ }
2657
2743
  case "message": {
2658
2744
  for (const contentPart of part.content) {
2659
2745
  if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
@@ -2748,7 +2834,7 @@ var OpenAIResponsesLanguageModel = class {
2748
2834
  type: "tool-call",
2749
2835
  toolCallId: part.id,
2750
2836
  toolName: "file_search",
2751
- input: "",
2837
+ input: "{}",
2752
2838
  providerExecuted: true
2753
2839
  });
2754
2840
  content.push({
@@ -2756,10 +2842,14 @@ var OpenAIResponsesLanguageModel = class {
2756
2842
  toolCallId: part.id,
2757
2843
  toolName: "file_search",
2758
2844
  result: {
2759
- type: "file_search_tool_result",
2760
- status: part.status || "completed",
2761
- ...part.queries && { queries: part.queries },
2762
- ...part.results && { results: part.results }
2845
+ queries: part.queries,
2846
+ results: (_n = (_m = part.results) == null ? void 0 : _m.map((result) => ({
2847
+ attributes: result.attributes,
2848
+ fileId: result.file_id,
2849
+ filename: result.filename,
2850
+ score: result.score,
2851
+ text: result.text
2852
+ }))) != null ? _n : null
2763
2853
  },
2764
2854
  providerExecuted: true
2765
2855
  });
@@ -2801,15 +2891,15 @@ var OpenAIResponsesLanguageModel = class {
2801
2891
  return {
2802
2892
  content,
2803
2893
  finishReason: mapOpenAIResponseFinishReason({
2804
- finishReason: (_m = response.incomplete_details) == null ? void 0 : _m.reason,
2894
+ finishReason: (_o = response.incomplete_details) == null ? void 0 : _o.reason,
2805
2895
  hasFunctionCall
2806
2896
  }),
2807
2897
  usage: {
2808
2898
  inputTokens: response.usage.input_tokens,
2809
2899
  outputTokens: response.usage.output_tokens,
2810
2900
  totalTokens: response.usage.input_tokens + response.usage.output_tokens,
2811
- reasoningTokens: (_o = (_n = response.usage.output_tokens_details) == null ? void 0 : _n.reasoning_tokens) != null ? _o : void 0,
2812
- cachedInputTokens: (_q = (_p = response.usage.input_tokens_details) == null ? void 0 : _p.cached_tokens) != null ? _q : void 0
2901
+ reasoningTokens: (_q = (_p = response.usage.output_tokens_details) == null ? void 0 : _p.reasoning_tokens) != null ? _q : void 0,
2902
+ cachedInputTokens: (_s = (_r = response.usage.input_tokens_details) == null ? void 0 : _r.cached_tokens) != null ? _s : void 0
2813
2903
  },
2814
2904
  request: { body },
2815
2905
  response: {
@@ -2866,7 +2956,7 @@ var OpenAIResponsesLanguageModel = class {
2866
2956
  controller.enqueue({ type: "stream-start", warnings });
2867
2957
  },
2868
2958
  transform(chunk, controller) {
2869
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
2959
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
2870
2960
  if (options.includeRawChunks) {
2871
2961
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2872
2962
  }
@@ -2908,14 +2998,20 @@ var OpenAIResponsesLanguageModel = class {
2908
2998
  toolName: "computer_use"
2909
2999
  });
2910
3000
  } else if (value.item.type === "file_search_call") {
2911
- ongoingToolCalls[value.output_index] = {
3001
+ controller.enqueue({
3002
+ type: "tool-call",
3003
+ toolCallId: value.item.id,
2912
3004
  toolName: "file_search",
2913
- toolCallId: value.item.id
2914
- };
3005
+ input: "{}",
3006
+ providerExecuted: true
3007
+ });
3008
+ } else if (value.item.type === "image_generation_call") {
2915
3009
  controller.enqueue({
2916
- type: "tool-input-start",
2917
- id: value.item.id,
2918
- toolName: "file_search"
3010
+ type: "tool-call",
3011
+ toolCallId: value.item.id,
3012
+ toolName: "image_generation",
3013
+ input: "{}",
3014
+ providerExecuted: true
2919
3015
  });
2920
3016
  } else if (value.item.type === "message") {
2921
3017
  controller.enqueue({
@@ -3007,26 +3103,19 @@ var OpenAIResponsesLanguageModel = class {
3007
3103
  });
3008
3104
  } else if (value.item.type === "file_search_call") {
3009
3105
  ongoingToolCalls[value.output_index] = void 0;
3010
- controller.enqueue({
3011
- type: "tool-input-end",
3012
- id: value.item.id
3013
- });
3014
- controller.enqueue({
3015
- type: "tool-call",
3016
- toolCallId: value.item.id,
3017
- toolName: "file_search",
3018
- input: "",
3019
- providerExecuted: true
3020
- });
3021
3106
  controller.enqueue({
3022
3107
  type: "tool-result",
3023
3108
  toolCallId: value.item.id,
3024
3109
  toolName: "file_search",
3025
3110
  result: {
3026
- type: "file_search_tool_result",
3027
- status: value.item.status || "completed",
3028
- ...value.item.queries && { queries: value.item.queries },
3029
- ...value.item.results && { results: value.item.results }
3111
+ queries: value.item.queries,
3112
+ results: (_c = (_b = value.item.results) == null ? void 0 : _b.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 ? _c : null
3030
3119
  },
3031
3120
  providerExecuted: true
3032
3121
  });
@@ -3050,6 +3139,16 @@ var OpenAIResponsesLanguageModel = class {
3050
3139
  },
3051
3140
  providerExecuted: true
3052
3141
  });
3142
+ } else if (value.item.type === "image_generation_call") {
3143
+ controller.enqueue({
3144
+ type: "tool-result",
3145
+ toolCallId: value.item.id,
3146
+ toolName: "image_generation",
3147
+ result: {
3148
+ result: value.item.result
3149
+ },
3150
+ providerExecuted: true
3151
+ });
3053
3152
  } else if (value.item.type === "message") {
3054
3153
  controller.enqueue({
3055
3154
  type: "text-end",
@@ -3064,7 +3163,7 @@ var OpenAIResponsesLanguageModel = class {
3064
3163
  providerMetadata: {
3065
3164
  openai: {
3066
3165
  itemId: value.item.id,
3067
- reasoningEncryptedContent: (_b = value.item.encrypted_content) != null ? _b : null
3166
+ reasoningEncryptedContent: (_d = value.item.encrypted_content) != null ? _d : null
3068
3167
  }
3069
3168
  }
3070
3169
  });
@@ -3094,12 +3193,12 @@ var OpenAIResponsesLanguageModel = class {
3094
3193
  id: value.item_id,
3095
3194
  delta: value.delta
3096
3195
  });
3097
- if (((_d = (_c = options.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.logprobs) && value.logprobs) {
3196
+ if (((_f = (_e = options.providerOptions) == null ? void 0 : _e.openai) == null ? void 0 : _f.logprobs) && value.logprobs) {
3098
3197
  logprobs.push(value.logprobs);
3099
3198
  }
3100
3199
  } else if (isResponseReasoningSummaryPartAddedChunk(value)) {
3101
3200
  if (value.summary_index > 0) {
3102
- (_e = activeReasoning[value.item_id]) == null ? void 0 : _e.summaryParts.push(
3201
+ (_g = activeReasoning[value.item_id]) == null ? void 0 : _g.summaryParts.push(
3103
3202
  value.summary_index
3104
3203
  );
3105
3204
  controller.enqueue({
@@ -3108,7 +3207,7 @@ var OpenAIResponsesLanguageModel = class {
3108
3207
  providerMetadata: {
3109
3208
  openai: {
3110
3209
  itemId: value.item_id,
3111
- reasoningEncryptedContent: (_g = (_f = activeReasoning[value.item_id]) == null ? void 0 : _f.encryptedContent) != null ? _g : null
3210
+ reasoningEncryptedContent: (_i = (_h = activeReasoning[value.item_id]) == null ? void 0 : _h.encryptedContent) != null ? _i : null
3112
3211
  }
3113
3212
  }
3114
3213
  });
@@ -3126,14 +3225,14 @@ var OpenAIResponsesLanguageModel = class {
3126
3225
  });
3127
3226
  } else if (isResponseFinishedChunk(value)) {
3128
3227
  finishReason = mapOpenAIResponseFinishReason({
3129
- finishReason: (_h = value.response.incomplete_details) == null ? void 0 : _h.reason,
3228
+ finishReason: (_j = value.response.incomplete_details) == null ? void 0 : _j.reason,
3130
3229
  hasFunctionCall
3131
3230
  });
3132
3231
  usage.inputTokens = value.response.usage.input_tokens;
3133
3232
  usage.outputTokens = value.response.usage.output_tokens;
3134
3233
  usage.totalTokens = value.response.usage.input_tokens + value.response.usage.output_tokens;
3135
- usage.reasoningTokens = (_j = (_i = value.response.usage.output_tokens_details) == null ? void 0 : _i.reasoning_tokens) != null ? _j : void 0;
3136
- usage.cachedInputTokens = (_l = (_k = value.response.usage.input_tokens_details) == null ? void 0 : _k.cached_tokens) != null ? _l : void 0;
3234
+ usage.reasoningTokens = (_l = (_k = value.response.usage.output_tokens_details) == null ? void 0 : _k.reasoning_tokens) != null ? _l : void 0;
3235
+ usage.cachedInputTokens = (_n = (_m = value.response.usage.input_tokens_details) == null ? void 0 : _m.cached_tokens) != null ? _n : void 0;
3137
3236
  if (typeof value.response.service_tier === "string") {
3138
3237
  serviceTier = value.response.service_tier;
3139
3238
  }
@@ -3142,7 +3241,7 @@ var OpenAIResponsesLanguageModel = class {
3142
3241
  controller.enqueue({
3143
3242
  type: "source",
3144
3243
  sourceType: "url",
3145
- id: (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
3244
+ id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : generateId2(),
3146
3245
  url: value.annotation.url,
3147
3246
  title: value.annotation.title
3148
3247
  });
@@ -3150,10 +3249,10 @@ var OpenAIResponsesLanguageModel = class {
3150
3249
  controller.enqueue({
3151
3250
  type: "source",
3152
3251
  sourceType: "document",
3153
- id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : generateId2(),
3252
+ id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : generateId2(),
3154
3253
  mediaType: "text/plain",
3155
- title: (_t = (_s = value.annotation.quote) != null ? _s : value.annotation.filename) != null ? _t : "Document",
3156
- filename: (_u = value.annotation.filename) != null ? _u : value.annotation.file_id
3254
+ title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
3255
+ filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
3157
3256
  });
3158
3257
  }
3159
3258
  } else if (isErrorChunk(value)) {
@@ -3186,177 +3285,155 @@ var OpenAIResponsesLanguageModel = class {
3186
3285
  };
3187
3286
  }
3188
3287
  };
3189
- var usageSchema2 = z14.object({
3190
- input_tokens: z14.number(),
3191
- input_tokens_details: z14.object({ cached_tokens: z14.number().nullish() }).nullish(),
3192
- output_tokens: z14.number(),
3193
- output_tokens_details: z14.object({ reasoning_tokens: z14.number().nullish() }).nullish()
3288
+ var usageSchema2 = z15.object({
3289
+ input_tokens: z15.number(),
3290
+ input_tokens_details: z15.object({ cached_tokens: z15.number().nullish() }).nullish(),
3291
+ output_tokens: z15.number(),
3292
+ output_tokens_details: z15.object({ reasoning_tokens: z15.number().nullish() }).nullish()
3194
3293
  });
3195
- var textDeltaChunkSchema = z14.object({
3196
- type: z14.literal("response.output_text.delta"),
3197
- item_id: z14.string(),
3198
- delta: z14.string(),
3294
+ var textDeltaChunkSchema = z15.object({
3295
+ type: z15.literal("response.output_text.delta"),
3296
+ item_id: z15.string(),
3297
+ delta: z15.string(),
3199
3298
  logprobs: LOGPROBS_SCHEMA.nullish()
3200
3299
  });
3201
- var errorChunkSchema = z14.object({
3202
- type: z14.literal("error"),
3203
- code: z14.string(),
3204
- message: z14.string(),
3205
- param: z14.string().nullish(),
3206
- sequence_number: z14.number()
3300
+ var errorChunkSchema = z15.object({
3301
+ type: z15.literal("error"),
3302
+ code: z15.string(),
3303
+ message: z15.string(),
3304
+ param: z15.string().nullish(),
3305
+ sequence_number: z15.number()
3207
3306
  });
3208
- var responseFinishedChunkSchema = z14.object({
3209
- type: z14.enum(["response.completed", "response.incomplete"]),
3210
- response: z14.object({
3211
- incomplete_details: z14.object({ reason: z14.string() }).nullish(),
3307
+ var responseFinishedChunkSchema = z15.object({
3308
+ type: z15.enum(["response.completed", "response.incomplete"]),
3309
+ response: z15.object({
3310
+ incomplete_details: z15.object({ reason: z15.string() }).nullish(),
3212
3311
  usage: usageSchema2,
3213
- service_tier: z14.string().nullish()
3312
+ service_tier: z15.string().nullish()
3214
3313
  })
3215
3314
  });
3216
- var responseCreatedChunkSchema = z14.object({
3217
- type: z14.literal("response.created"),
3218
- response: z14.object({
3219
- id: z14.string(),
3220
- created_at: z14.number(),
3221
- model: z14.string(),
3222
- service_tier: z14.string().nullish()
3315
+ var responseCreatedChunkSchema = z15.object({
3316
+ type: z15.literal("response.created"),
3317
+ response: z15.object({
3318
+ id: z15.string(),
3319
+ created_at: z15.number(),
3320
+ model: z15.string(),
3321
+ service_tier: z15.string().nullish()
3223
3322
  })
3224
3323
  });
3225
- var responseOutputItemAddedSchema = z14.object({
3226
- type: z14.literal("response.output_item.added"),
3227
- output_index: z14.number(),
3228
- item: z14.discriminatedUnion("type", [
3229
- z14.object({
3230
- type: z14.literal("message"),
3231
- id: z14.string()
3324
+ var responseOutputItemAddedSchema = z15.object({
3325
+ type: z15.literal("response.output_item.added"),
3326
+ output_index: z15.number(),
3327
+ item: z15.discriminatedUnion("type", [
3328
+ z15.object({
3329
+ type: z15.literal("message"),
3330
+ id: z15.string()
3232
3331
  }),
3233
- z14.object({
3234
- type: z14.literal("reasoning"),
3235
- id: z14.string(),
3236
- encrypted_content: z14.string().nullish()
3332
+ z15.object({
3333
+ type: z15.literal("reasoning"),
3334
+ id: z15.string(),
3335
+ encrypted_content: z15.string().nullish()
3237
3336
  }),
3238
- z14.object({
3239
- type: z14.literal("function_call"),
3240
- id: z14.string(),
3241
- call_id: z14.string(),
3242
- name: z14.string(),
3243
- arguments: z14.string()
3337
+ z15.object({
3338
+ type: z15.literal("function_call"),
3339
+ id: z15.string(),
3340
+ call_id: z15.string(),
3341
+ name: z15.string(),
3342
+ arguments: z15.string()
3244
3343
  }),
3245
- z14.object({
3246
- type: z14.literal("web_search_call"),
3247
- id: z14.string(),
3248
- status: z14.string(),
3249
- action: z14.object({
3250
- type: z14.literal("search"),
3251
- query: z14.string().optional()
3344
+ z15.object({
3345
+ type: z15.literal("web_search_call"),
3346
+ id: z15.string(),
3347
+ status: z15.string(),
3348
+ action: z15.object({
3349
+ type: z15.literal("search"),
3350
+ query: z15.string().optional()
3252
3351
  }).nullish()
3253
3352
  }),
3254
- z14.object({
3255
- type: z14.literal("computer_call"),
3256
- id: z14.string(),
3257
- status: z14.string()
3353
+ z15.object({
3354
+ type: z15.literal("computer_call"),
3355
+ id: z15.string(),
3356
+ status: z15.string()
3258
3357
  }),
3259
- z14.object({
3260
- type: z14.literal("file_search_call"),
3261
- id: z14.string(),
3262
- status: z14.string(),
3263
- queries: z14.array(z14.string()).nullish(),
3264
- results: z14.array(
3265
- z14.object({
3266
- attributes: z14.object({
3267
- file_id: z14.string(),
3268
- filename: z14.string(),
3269
- score: z14.number(),
3270
- text: z14.string()
3271
- })
3272
- })
3273
- ).optional()
3358
+ z15.object({
3359
+ type: z15.literal("file_search_call"),
3360
+ id: z15.string()
3361
+ }),
3362
+ z15.object({
3363
+ type: z15.literal("image_generation_call"),
3364
+ id: z15.string()
3274
3365
  })
3275
3366
  ])
3276
3367
  });
3277
- var responseOutputItemDoneSchema = z14.object({
3278
- type: z14.literal("response.output_item.done"),
3279
- output_index: z14.number(),
3280
- item: z14.discriminatedUnion("type", [
3281
- z14.object({
3282
- type: z14.literal("message"),
3283
- id: z14.string()
3368
+ var responseOutputItemDoneSchema = z15.object({
3369
+ type: z15.literal("response.output_item.done"),
3370
+ output_index: z15.number(),
3371
+ item: z15.discriminatedUnion("type", [
3372
+ z15.object({
3373
+ type: z15.literal("message"),
3374
+ id: z15.string()
3284
3375
  }),
3285
- z14.object({
3286
- type: z14.literal("reasoning"),
3287
- id: z14.string(),
3288
- encrypted_content: z14.string().nullish()
3376
+ z15.object({
3377
+ type: z15.literal("reasoning"),
3378
+ id: z15.string(),
3379
+ encrypted_content: z15.string().nullish()
3289
3380
  }),
3290
- z14.object({
3291
- type: z14.literal("function_call"),
3292
- id: z14.string(),
3293
- call_id: z14.string(),
3294
- name: z14.string(),
3295
- arguments: z14.string(),
3296
- status: z14.literal("completed")
3381
+ z15.object({
3382
+ type: z15.literal("function_call"),
3383
+ id: z15.string(),
3384
+ call_id: z15.string(),
3385
+ name: z15.string(),
3386
+ arguments: z15.string(),
3387
+ status: z15.literal("completed")
3297
3388
  }),
3298
3389
  codeInterpreterCallItem,
3390
+ imageGenerationCallItem,
3299
3391
  webSearchCallItem,
3300
- z14.object({
3301
- type: z14.literal("computer_call"),
3302
- id: z14.string(),
3303
- status: z14.literal("completed")
3304
- }),
3305
- z14.object({
3306
- type: z14.literal("file_search_call"),
3307
- id: z14.string(),
3308
- status: z14.literal("completed"),
3309
- queries: z14.array(z14.string()).nullish(),
3310
- results: z14.array(
3311
- z14.object({
3312
- attributes: z14.object({
3313
- file_id: z14.string(),
3314
- filename: z14.string(),
3315
- score: z14.number(),
3316
- text: z14.string()
3317
- })
3318
- })
3319
- ).nullish()
3392
+ fileSearchCallItem,
3393
+ z15.object({
3394
+ type: z15.literal("computer_call"),
3395
+ id: z15.string(),
3396
+ status: z15.literal("completed")
3320
3397
  })
3321
3398
  ])
3322
3399
  });
3323
- var responseFunctionCallArgumentsDeltaSchema = z14.object({
3324
- type: z14.literal("response.function_call_arguments.delta"),
3325
- item_id: z14.string(),
3326
- output_index: z14.number(),
3327
- delta: z14.string()
3400
+ var responseFunctionCallArgumentsDeltaSchema = z15.object({
3401
+ type: z15.literal("response.function_call_arguments.delta"),
3402
+ item_id: z15.string(),
3403
+ output_index: z15.number(),
3404
+ delta: z15.string()
3328
3405
  });
3329
- var responseAnnotationAddedSchema = z14.object({
3330
- type: z14.literal("response.output_text.annotation.added"),
3331
- annotation: z14.discriminatedUnion("type", [
3332
- z14.object({
3333
- type: z14.literal("url_citation"),
3334
- url: z14.string(),
3335
- title: z14.string()
3406
+ var responseAnnotationAddedSchema = z15.object({
3407
+ type: z15.literal("response.output_text.annotation.added"),
3408
+ annotation: z15.discriminatedUnion("type", [
3409
+ z15.object({
3410
+ type: z15.literal("url_citation"),
3411
+ url: z15.string(),
3412
+ title: z15.string()
3336
3413
  }),
3337
- z14.object({
3338
- type: z14.literal("file_citation"),
3339
- file_id: z14.string(),
3340
- filename: z14.string().nullish(),
3341
- index: z14.number().nullish(),
3342
- start_index: z14.number().nullish(),
3343
- end_index: z14.number().nullish(),
3344
- quote: z14.string().nullish()
3414
+ z15.object({
3415
+ type: z15.literal("file_citation"),
3416
+ file_id: z15.string(),
3417
+ filename: z15.string().nullish(),
3418
+ index: z15.number().nullish(),
3419
+ start_index: z15.number().nullish(),
3420
+ end_index: z15.number().nullish(),
3421
+ quote: z15.string().nullish()
3345
3422
  })
3346
3423
  ])
3347
3424
  });
3348
- var responseReasoningSummaryPartAddedSchema = z14.object({
3349
- type: z14.literal("response.reasoning_summary_part.added"),
3350
- item_id: z14.string(),
3351
- summary_index: z14.number()
3425
+ var responseReasoningSummaryPartAddedSchema = z15.object({
3426
+ type: z15.literal("response.reasoning_summary_part.added"),
3427
+ item_id: z15.string(),
3428
+ summary_index: z15.number()
3352
3429
  });
3353
- var responseReasoningSummaryTextDeltaSchema = z14.object({
3354
- type: z14.literal("response.reasoning_summary_text.delta"),
3355
- item_id: z14.string(),
3356
- summary_index: z14.number(),
3357
- delta: z14.string()
3430
+ var responseReasoningSummaryTextDeltaSchema = z15.object({
3431
+ type: z15.literal("response.reasoning_summary_text.delta"),
3432
+ item_id: z15.string(),
3433
+ summary_index: z15.number(),
3434
+ delta: z15.string()
3358
3435
  });
3359
- var openaiResponsesChunkSchema = z14.union([
3436
+ var openaiResponsesChunkSchema = z15.union([
3360
3437
  textDeltaChunkSchema,
3361
3438
  responseFinishedChunkSchema,
3362
3439
  responseCreatedChunkSchema,
@@ -3367,7 +3444,7 @@ var openaiResponsesChunkSchema = z14.union([
3367
3444
  responseReasoningSummaryPartAddedSchema,
3368
3445
  responseReasoningSummaryTextDeltaSchema,
3369
3446
  errorChunkSchema,
3370
- z14.object({ type: z14.string() }).loose()
3447
+ z15.object({ type: z15.string() }).loose()
3371
3448
  // fallback for unknown chunks
3372
3449
  ]);
3373
3450
  function isTextDeltaChunk(chunk) {
@@ -3440,27 +3517,15 @@ function getResponsesModelConfig(modelId) {
3440
3517
  isReasoningModel: false
3441
3518
  };
3442
3519
  }
3443
- var openaiResponsesProviderOptionsSchema = z14.object({
3444
- metadata: z14.any().nullish(),
3445
- parallelToolCalls: z14.boolean().nullish(),
3446
- previousResponseId: z14.string().nullish(),
3447
- store: z14.boolean().nullish(),
3448
- user: z14.string().nullish(),
3449
- reasoningEffort: z14.string().nullish(),
3450
- strictJsonSchema: z14.boolean().nullish(),
3451
- instructions: z14.string().nullish(),
3452
- reasoningSummary: z14.string().nullish(),
3453
- serviceTier: z14.enum(["auto", "flex", "priority"]).nullish(),
3454
- include: z14.array(
3455
- z14.enum([
3520
+ var openaiResponsesProviderOptionsSchema = z15.object({
3521
+ include: z15.array(
3522
+ z15.enum([
3456
3523
  "reasoning.encrypted_content",
3457
3524
  "file_search_call.results",
3458
3525
  "message.output_text.logprobs"
3459
3526
  ])
3460
3527
  ).nullish(),
3461
- textVerbosity: z14.enum(["low", "medium", "high"]).nullish(),
3462
- promptCacheKey: z14.string().nullish(),
3463
- safetyIdentifier: z14.string().nullish(),
3528
+ instructions: z15.string().nullish(),
3464
3529
  /**
3465
3530
  * Return the log probabilities of the tokens.
3466
3531
  *
@@ -3473,7 +3538,25 @@ var openaiResponsesProviderOptionsSchema = z14.object({
3473
3538
  * @see https://platform.openai.com/docs/api-reference/responses/create
3474
3539
  * @see https://cookbook.openai.com/examples/using_logprobs
3475
3540
  */
3476
- logprobs: z14.union([z14.boolean(), z14.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
3541
+ logprobs: z15.union([z15.boolean(), z15.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3542
+ /**
3543
+ * The maximum number of total calls to built-in tools that can be processed in a response.
3544
+ * This maximum number applies across all built-in tool calls, not per individual tool.
3545
+ * Any further attempts to call a tool by the model will be ignored.
3546
+ */
3547
+ maxToolCalls: z15.number().nullish(),
3548
+ metadata: z15.any().nullish(),
3549
+ parallelToolCalls: z15.boolean().nullish(),
3550
+ previousResponseId: z15.string().nullish(),
3551
+ promptCacheKey: z15.string().nullish(),
3552
+ reasoningEffort: z15.string().nullish(),
3553
+ reasoningSummary: z15.string().nullish(),
3554
+ safetyIdentifier: z15.string().nullish(),
3555
+ serviceTier: z15.enum(["auto", "flex", "priority"]).nullish(),
3556
+ store: z15.boolean().nullish(),
3557
+ strictJsonSchema: z15.boolean().nullish(),
3558
+ textVerbosity: z15.enum(["low", "medium", "high"]).nullish(),
3559
+ user: z15.string().nullish()
3477
3560
  });
3478
3561
 
3479
3562
  // src/speech/openai-speech-model.ts
@@ -3483,10 +3566,10 @@ import {
3483
3566
  parseProviderOptions as parseProviderOptions6,
3484
3567
  postJsonToApi as postJsonToApi6
3485
3568
  } from "@ai-sdk/provider-utils";
3486
- import { z as z15 } from "zod/v4";
3487
- var OpenAIProviderOptionsSchema = z15.object({
3488
- instructions: z15.string().nullish(),
3489
- speed: z15.number().min(0.25).max(4).default(1).nullish()
3569
+ import { z as z16 } from "zod/v4";
3570
+ var OpenAIProviderOptionsSchema = z16.object({
3571
+ instructions: z16.string().nullish(),
3572
+ speed: z16.number().min(0.25).max(4).default(1).nullish()
3490
3573
  });
3491
3574
  var OpenAISpeechModel = class {
3492
3575
  constructor(modelId, config) {
@@ -3597,33 +3680,33 @@ import {
3597
3680
  parseProviderOptions as parseProviderOptions7,
3598
3681
  postFormDataToApi
3599
3682
  } from "@ai-sdk/provider-utils";
3600
- import { z as z17 } from "zod/v4";
3683
+ import { z as z18 } from "zod/v4";
3601
3684
 
3602
3685
  // src/transcription/openai-transcription-options.ts
3603
- import { z as z16 } from "zod/v4";
3604
- var openAITranscriptionProviderOptions = z16.object({
3686
+ import { z as z17 } from "zod/v4";
3687
+ var openAITranscriptionProviderOptions = z17.object({
3605
3688
  /**
3606
3689
  * Additional information to include in the transcription response.
3607
3690
  */
3608
- include: z16.array(z16.string()).optional(),
3691
+ include: z17.array(z17.string()).optional(),
3609
3692
  /**
3610
3693
  * The language of the input audio in ISO-639-1 format.
3611
3694
  */
3612
- language: z16.string().optional(),
3695
+ language: z17.string().optional(),
3613
3696
  /**
3614
3697
  * An optional text to guide the model's style or continue a previous audio segment.
3615
3698
  */
3616
- prompt: z16.string().optional(),
3699
+ prompt: z17.string().optional(),
3617
3700
  /**
3618
3701
  * The sampling temperature, between 0 and 1.
3619
3702
  * @default 0
3620
3703
  */
3621
- temperature: z16.number().min(0).max(1).default(0).optional(),
3704
+ temperature: z17.number().min(0).max(1).default(0).optional(),
3622
3705
  /**
3623
3706
  * The timestamp granularities to populate for this transcription.
3624
3707
  * @default ['segment']
3625
3708
  */
3626
- timestampGranularities: z16.array(z16.enum(["word", "segment"])).default(["segment"]).optional()
3709
+ timestampGranularities: z17.array(z17.enum(["word", "segment"])).default(["segment"]).optional()
3627
3710
  });
3628
3711
 
3629
3712
  // src/transcription/openai-transcription-model.ts
@@ -3792,29 +3875,29 @@ var OpenAITranscriptionModel = class {
3792
3875
  };
3793
3876
  }
3794
3877
  };
3795
- var openaiTranscriptionResponseSchema = z17.object({
3796
- text: z17.string(),
3797
- language: z17.string().nullish(),
3798
- duration: z17.number().nullish(),
3799
- words: z17.array(
3800
- z17.object({
3801
- word: z17.string(),
3802
- start: z17.number(),
3803
- end: z17.number()
3878
+ var openaiTranscriptionResponseSchema = z18.object({
3879
+ text: z18.string(),
3880
+ language: z18.string().nullish(),
3881
+ duration: z18.number().nullish(),
3882
+ words: z18.array(
3883
+ z18.object({
3884
+ word: z18.string(),
3885
+ start: z18.number(),
3886
+ end: z18.number()
3804
3887
  })
3805
3888
  ).nullish(),
3806
- segments: z17.array(
3807
- z17.object({
3808
- id: z17.number(),
3809
- seek: z17.number(),
3810
- start: z17.number(),
3811
- end: z17.number(),
3812
- text: z17.string(),
3813
- tokens: z17.array(z17.number()),
3814
- temperature: z17.number(),
3815
- avg_logprob: z17.number(),
3816
- compression_ratio: z17.number(),
3817
- no_speech_prob: z17.number()
3889
+ segments: z18.array(
3890
+ z18.object({
3891
+ id: z18.number(),
3892
+ seek: z18.number(),
3893
+ start: z18.number(),
3894
+ end: z18.number(),
3895
+ text: z18.string(),
3896
+ tokens: z18.array(z18.number()),
3897
+ temperature: z18.number(),
3898
+ avg_logprob: z18.number(),
3899
+ compression_ratio: z18.number(),
3900
+ no_speech_prob: z18.number()
3818
3901
  })
3819
3902
  ).nullish()
3820
3903
  });