@ai-sdk/openai 2.0.0-canary.11 → 2.0.0-canary.12

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.
@@ -345,7 +345,7 @@ var OpenAIChatLanguageModel = class {
345
345
  "image/*": [/^https?:\/\/.*$/]
346
346
  };
347
347
  }
348
- getArgs({
348
+ async getArgs({
349
349
  prompt,
350
350
  maxOutputTokens,
351
351
  temperature,
@@ -362,7 +362,7 @@ var OpenAIChatLanguageModel = class {
362
362
  }) {
363
363
  var _a, _b, _c;
364
364
  const warnings = [];
365
- const openaiOptions = (_a = parseProviderOptions({
365
+ const openaiOptions = (_a = await parseProviderOptions({
366
366
  provider: "openai",
367
367
  providerOptions,
368
368
  schema: openaiProviderOptions
@@ -500,7 +500,7 @@ var OpenAIChatLanguageModel = class {
500
500
  }
501
501
  async doGenerate(options) {
502
502
  var _a, _b, _c, _d, _e, _f, _g, _h;
503
- const { args: body, warnings } = this.getArgs(options);
503
+ const { args: body, warnings } = await this.getArgs(options);
504
504
  const {
505
505
  responseHeaders,
506
506
  value: response,
@@ -567,7 +567,7 @@ var OpenAIChatLanguageModel = class {
567
567
  };
568
568
  }
569
569
  async doStream(options) {
570
- const { args, warnings } = this.getArgs(options);
570
+ const { args, warnings } = await this.getArgs(options);
571
571
  const body = {
572
572
  ...args,
573
573
  stream: true,
@@ -860,9 +860,10 @@ import {
860
860
  combineHeaders as combineHeaders2,
861
861
  createEventSourceResponseHandler as createEventSourceResponseHandler2,
862
862
  createJsonResponseHandler as createJsonResponseHandler2,
863
+ parseProviderOptions as parseProviderOptions2,
863
864
  postJsonToApi as postJsonToApi2
864
865
  } from "@ai-sdk/provider-utils";
865
- import { z as z4 } from "zod";
866
+ import { z as z5 } from "zod";
866
867
 
867
868
  // src/convert-to-openai-completion-prompt.ts
868
869
  import {
@@ -946,14 +947,49 @@ ${user}:`]
946
947
  };
947
948
  }
948
949
 
950
+ // src/openai-completion-options.ts
951
+ import { z as z4 } from "zod";
952
+ var openaiCompletionProviderOptions = z4.object({
953
+ /**
954
+ Echo back the prompt in addition to the completion.
955
+ */
956
+ echo: z4.boolean().optional(),
957
+ /**
958
+ Modify the likelihood of specified tokens appearing in the completion.
959
+
960
+ Accepts a JSON object that maps tokens (specified by their token ID in
961
+ the GPT tokenizer) to an associated bias value from -100 to 100. You
962
+ can use this tokenizer tool to convert text to token IDs. Mathematically,
963
+ the bias is added to the logits generated by the model prior to sampling.
964
+ The exact effect will vary per model, but values between -1 and 1 should
965
+ decrease or increase likelihood of selection; values like -100 or 100
966
+ should result in a ban or exclusive selection of the relevant token.
967
+
968
+ As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
969
+ token from being generated.
970
+ */
971
+ logitBias: z4.record(z4.string(), z4.number()).optional(),
972
+ /**
973
+ The suffix that comes after a completion of inserted text.
974
+ */
975
+ suffix: z4.string().optional(),
976
+ /**
977
+ A unique identifier representing your end-user, which can help OpenAI to
978
+ monitor and detect abuse. Learn more.
979
+ */
980
+ user: z4.string().optional()
981
+ });
982
+
949
983
  // src/openai-completion-language-model.ts
950
984
  var OpenAICompletionLanguageModel = class {
951
- constructor(modelId, settings, config) {
985
+ constructor(modelId, config) {
952
986
  this.specificationVersion = "v2";
953
987
  this.modelId = modelId;
954
- this.settings = settings;
955
988
  this.config = config;
956
989
  }
990
+ get providerOptionsName() {
991
+ return this.config.provider.split(".")[0].trim();
992
+ }
957
993
  get provider() {
958
994
  return this.config.provider;
959
995
  }
@@ -962,7 +998,7 @@ var OpenAICompletionLanguageModel = class {
962
998
  // no supported urls for completion models
963
999
  };
964
1000
  }
965
- getArgs({
1001
+ async getArgs({
966
1002
  inputFormat,
967
1003
  prompt,
968
1004
  maxOutputTokens,
@@ -975,9 +1011,22 @@ var OpenAICompletionLanguageModel = class {
975
1011
  responseFormat,
976
1012
  tools,
977
1013
  toolChoice,
978
- seed
1014
+ seed,
1015
+ providerOptions
979
1016
  }) {
980
1017
  const warnings = [];
1018
+ const openaiOptions = {
1019
+ ...await parseProviderOptions2({
1020
+ provider: "openai",
1021
+ providerOptions,
1022
+ schema: openaiCompletionProviderOptions
1023
+ }),
1024
+ ...await parseProviderOptions2({
1025
+ provider: this.providerOptionsName,
1026
+ providerOptions,
1027
+ schema: openaiCompletionProviderOptions
1028
+ })
1029
+ };
981
1030
  if (topK != null) {
982
1031
  warnings.push({ type: "unsupported-setting", setting: "topK" });
983
1032
  }
@@ -1001,10 +1050,10 @@ var OpenAICompletionLanguageModel = class {
1001
1050
  // model id:
1002
1051
  model: this.modelId,
1003
1052
  // model specific settings:
1004
- echo: this.settings.echo,
1005
- logit_bias: this.settings.logitBias,
1006
- suffix: this.settings.suffix,
1007
- user: this.settings.user,
1053
+ echo: openaiOptions.echo,
1054
+ logit_bias: openaiOptions.logitBias,
1055
+ suffix: openaiOptions.suffix,
1056
+ user: openaiOptions.user,
1008
1057
  // standardized settings:
1009
1058
  max_tokens: maxOutputTokens,
1010
1059
  temperature,
@@ -1021,7 +1070,7 @@ var OpenAICompletionLanguageModel = class {
1021
1070
  };
1022
1071
  }
1023
1072
  async doGenerate(options) {
1024
- const { args, warnings } = this.getArgs(options);
1073
+ const { args, warnings } = await this.getArgs(options);
1025
1074
  const {
1026
1075
  responseHeaders,
1027
1076
  value: response,
@@ -1058,7 +1107,7 @@ var OpenAICompletionLanguageModel = class {
1058
1107
  };
1059
1108
  }
1060
1109
  async doStream(options) {
1061
- const { args, warnings } = this.getArgs(options);
1110
+ const { args, warnings } = await this.getArgs(options);
1062
1111
  const body = {
1063
1112
  ...args,
1064
1113
  stream: true,
@@ -1139,36 +1188,36 @@ var OpenAICompletionLanguageModel = class {
1139
1188
  };
1140
1189
  }
1141
1190
  };
1142
- var openaiCompletionResponseSchema = z4.object({
1143
- id: z4.string().nullish(),
1144
- created: z4.number().nullish(),
1145
- model: z4.string().nullish(),
1146
- choices: z4.array(
1147
- z4.object({
1148
- text: z4.string(),
1149
- finish_reason: z4.string()
1191
+ var openaiCompletionResponseSchema = z5.object({
1192
+ id: z5.string().nullish(),
1193
+ created: z5.number().nullish(),
1194
+ model: z5.string().nullish(),
1195
+ choices: z5.array(
1196
+ z5.object({
1197
+ text: z5.string(),
1198
+ finish_reason: z5.string()
1150
1199
  })
1151
1200
  ),
1152
- usage: z4.object({
1153
- prompt_tokens: z4.number(),
1154
- completion_tokens: z4.number()
1201
+ usage: z5.object({
1202
+ prompt_tokens: z5.number(),
1203
+ completion_tokens: z5.number()
1155
1204
  })
1156
1205
  });
1157
- var openaiCompletionChunkSchema = z4.union([
1158
- z4.object({
1159
- id: z4.string().nullish(),
1160
- created: z4.number().nullish(),
1161
- model: z4.string().nullish(),
1162
- choices: z4.array(
1163
- z4.object({
1164
- text: z4.string(),
1165
- finish_reason: z4.string().nullish(),
1166
- index: z4.number()
1206
+ var openaiCompletionChunkSchema = z5.union([
1207
+ z5.object({
1208
+ id: z5.string().nullish(),
1209
+ created: z5.number().nullish(),
1210
+ model: z5.string().nullish(),
1211
+ choices: z5.array(
1212
+ z5.object({
1213
+ text: z5.string(),
1214
+ finish_reason: z5.string().nullish(),
1215
+ index: z5.number()
1167
1216
  })
1168
1217
  ),
1169
- usage: z4.object({
1170
- prompt_tokens: z4.number(),
1171
- completion_tokens: z4.number()
1218
+ usage: z5.object({
1219
+ prompt_tokens: z5.number(),
1220
+ completion_tokens: z5.number()
1172
1221
  }).nullish()
1173
1222
  }),
1174
1223
  openaiErrorDataSchema
@@ -1181,24 +1230,24 @@ import {
1181
1230
  import {
1182
1231
  combineHeaders as combineHeaders3,
1183
1232
  createJsonResponseHandler as createJsonResponseHandler3,
1184
- parseProviderOptions as parseProviderOptions2,
1233
+ parseProviderOptions as parseProviderOptions3,
1185
1234
  postJsonToApi as postJsonToApi3
1186
1235
  } from "@ai-sdk/provider-utils";
1187
- import { z as z6 } from "zod";
1236
+ import { z as z7 } from "zod";
1188
1237
 
1189
1238
  // src/openai-embedding-options.ts
1190
- import { z as z5 } from "zod";
1191
- var openaiEmbeddingProviderOptions = z5.object({
1239
+ import { z as z6 } from "zod";
1240
+ var openaiEmbeddingProviderOptions = z6.object({
1192
1241
  /**
1193
1242
  The number of dimensions the resulting output embeddings should have.
1194
1243
  Only supported in text-embedding-3 and later models.
1195
1244
  */
1196
- dimensions: z5.number().optional(),
1245
+ dimensions: z6.number().optional(),
1197
1246
  /**
1198
1247
  A unique identifier representing your end-user, which can help OpenAI to
1199
1248
  monitor and detect abuse. Learn more.
1200
1249
  */
1201
- user: z5.string().optional()
1250
+ user: z6.string().optional()
1202
1251
  });
1203
1252
 
1204
1253
  // src/openai-embedding-model.ts
@@ -1235,7 +1284,7 @@ var OpenAIEmbeddingModel = class {
1235
1284
  values
1236
1285
  });
1237
1286
  }
1238
- const openaiOptions = (_a = parseProviderOptions2({
1287
+ const openaiOptions = (_a = await parseProviderOptions3({
1239
1288
  provider: "openai",
1240
1289
  providerOptions,
1241
1290
  schema: openaiEmbeddingProviderOptions
@@ -1271,9 +1320,9 @@ var OpenAIEmbeddingModel = class {
1271
1320
  };
1272
1321
  }
1273
1322
  };
1274
- var openaiTextEmbeddingResponseSchema = z6.object({
1275
- data: z6.array(z6.object({ embedding: z6.array(z6.number()) })),
1276
- usage: z6.object({ prompt_tokens: z6.number() }).nullish()
1323
+ var openaiTextEmbeddingResponseSchema = z7.object({
1324
+ data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
1325
+ usage: z7.object({ prompt_tokens: z7.number() }).nullish()
1277
1326
  });
1278
1327
 
1279
1328
  // src/openai-image-model.ts
@@ -1282,13 +1331,15 @@ import {
1282
1331
  createJsonResponseHandler as createJsonResponseHandler4,
1283
1332
  postJsonToApi as postJsonToApi4
1284
1333
  } from "@ai-sdk/provider-utils";
1285
- import { z as z7 } from "zod";
1334
+ import { z as z8 } from "zod";
1286
1335
 
1287
1336
  // src/openai-image-settings.ts
1288
1337
  var modelMaxImagesPerCall = {
1289
1338
  "dall-e-3": 1,
1290
- "dall-e-2": 10
1339
+ "dall-e-2": 10,
1340
+ "gpt-image-1": 10
1291
1341
  };
1342
+ var hasDefaultResponseFormat = /* @__PURE__ */ new Set(["gpt-image-1"]);
1292
1343
 
1293
1344
  // src/openai-image-model.ts
1294
1345
  var OpenAIImageModel = class {
@@ -1340,7 +1391,7 @@ var OpenAIImageModel = class {
1340
1391
  n,
1341
1392
  size,
1342
1393
  ...(_d = providerOptions.openai) != null ? _d : {},
1343
- response_format: "b64_json"
1394
+ ...!hasDefaultResponseFormat.has(this.modelId) ? { response_format: "b64_json" } : {}
1344
1395
  },
1345
1396
  failedResponseHandler: openaiFailedResponseHandler,
1346
1397
  successfulResponseHandler: createJsonResponseHandler4(
@@ -1360,8 +1411,8 @@ var OpenAIImageModel = class {
1360
1411
  };
1361
1412
  }
1362
1413
  };
1363
- var openaiImageResponseSchema = z7.object({
1364
- data: z7.array(z7.object({ b64_json: z7.string() }))
1414
+ var openaiImageResponseSchema = z8.object({
1415
+ data: z8.array(z8.object({ b64_json: z8.string() }))
1365
1416
  });
1366
1417
 
1367
1418
  // src/openai-transcription-model.ts
@@ -1369,16 +1420,16 @@ import {
1369
1420
  combineHeaders as combineHeaders5,
1370
1421
  convertBase64ToUint8Array,
1371
1422
  createJsonResponseHandler as createJsonResponseHandler5,
1372
- parseProviderOptions as parseProviderOptions3,
1423
+ parseProviderOptions as parseProviderOptions4,
1373
1424
  postFormDataToApi
1374
1425
  } from "@ai-sdk/provider-utils";
1375
- import { z as z8 } from "zod";
1376
- var openAIProviderOptionsSchema = z8.object({
1377
- include: z8.array(z8.string()).nullish(),
1378
- language: z8.string().nullish(),
1379
- prompt: z8.string().nullish(),
1380
- temperature: z8.number().min(0).max(1).nullish().default(0),
1381
- timestampGranularities: z8.array(z8.enum(["word", "segment"])).nullish().default(["segment"])
1426
+ import { z as z9 } from "zod";
1427
+ var openAIProviderOptionsSchema = z9.object({
1428
+ include: z9.array(z9.string()).nullish(),
1429
+ language: z9.string().nullish(),
1430
+ prompt: z9.string().nullish(),
1431
+ temperature: z9.number().min(0).max(1).nullish().default(0),
1432
+ timestampGranularities: z9.array(z9.enum(["word", "segment"])).nullish().default(["segment"])
1382
1433
  });
1383
1434
  var languageMap = {
1384
1435
  afrikaans: "af",
@@ -1448,14 +1499,14 @@ var OpenAITranscriptionModel = class {
1448
1499
  get provider() {
1449
1500
  return this.config.provider;
1450
1501
  }
1451
- getArgs({
1502
+ async getArgs({
1452
1503
  audio,
1453
1504
  mediaType,
1454
1505
  providerOptions
1455
1506
  }) {
1456
1507
  var _a, _b, _c, _d, _e;
1457
1508
  const warnings = [];
1458
- const openAIOptions = parseProviderOptions3({
1509
+ const openAIOptions = await parseProviderOptions4({
1459
1510
  provider: "openai",
1460
1511
  providerOptions,
1461
1512
  schema: openAIProviderOptionsSchema
@@ -1487,7 +1538,7 @@ var OpenAITranscriptionModel = class {
1487
1538
  async doGenerate(options) {
1488
1539
  var _a, _b, _c, _d, _e, _f;
1489
1540
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
1490
- const { formData, warnings } = this.getArgs(options);
1541
+ const { formData, warnings } = await this.getArgs(options);
1491
1542
  const {
1492
1543
  value: response,
1493
1544
  responseHeaders,
@@ -1526,15 +1577,15 @@ var OpenAITranscriptionModel = class {
1526
1577
  };
1527
1578
  }
1528
1579
  };
1529
- var openaiTranscriptionResponseSchema = z8.object({
1530
- text: z8.string(),
1531
- language: z8.string().nullish(),
1532
- duration: z8.number().nullish(),
1533
- words: z8.array(
1534
- z8.object({
1535
- word: z8.string(),
1536
- start: z8.number(),
1537
- end: z8.number()
1580
+ var openaiTranscriptionResponseSchema = z9.object({
1581
+ text: z9.string(),
1582
+ language: z9.string().nullish(),
1583
+ duration: z9.number().nullish(),
1584
+ words: z9.array(
1585
+ z9.object({
1586
+ word: z9.string(),
1587
+ start: z9.number(),
1588
+ end: z9.number()
1538
1589
  })
1539
1590
  ).nullish()
1540
1591
  });
@@ -1543,13 +1594,13 @@ var openaiTranscriptionResponseSchema = z8.object({
1543
1594
  import {
1544
1595
  combineHeaders as combineHeaders6,
1545
1596
  createBinaryResponseHandler,
1546
- parseProviderOptions as parseProviderOptions4,
1597
+ parseProviderOptions as parseProviderOptions5,
1547
1598
  postJsonToApi as postJsonToApi5
1548
1599
  } from "@ai-sdk/provider-utils";
1549
- import { z as z9 } from "zod";
1550
- var OpenAIProviderOptionsSchema = z9.object({
1551
- instructions: z9.string().nullish(),
1552
- speed: z9.number().min(0.25).max(4).default(1).nullish()
1600
+ import { z as z10 } from "zod";
1601
+ var OpenAIProviderOptionsSchema = z10.object({
1602
+ instructions: z10.string().nullish(),
1603
+ speed: z10.number().min(0.25).max(4).default(1).nullish()
1553
1604
  });
1554
1605
  var OpenAISpeechModel = class {
1555
1606
  constructor(modelId, config) {
@@ -1560,7 +1611,7 @@ var OpenAISpeechModel = class {
1560
1611
  get provider() {
1561
1612
  return this.config.provider;
1562
1613
  }
1563
- getArgs({
1614
+ async getArgs({
1564
1615
  text,
1565
1616
  voice = "alloy",
1566
1617
  outputFormat = "mp3",
@@ -1569,7 +1620,7 @@ var OpenAISpeechModel = class {
1569
1620
  providerOptions
1570
1621
  }) {
1571
1622
  const warnings = [];
1572
- const openAIOptions = parseProviderOptions4({
1623
+ const openAIOptions = await parseProviderOptions5({
1573
1624
  provider: "openai",
1574
1625
  providerOptions,
1575
1626
  schema: OpenAIProviderOptionsSchema
@@ -1610,7 +1661,7 @@ var OpenAISpeechModel = class {
1610
1661
  async doGenerate(options) {
1611
1662
  var _a, _b, _c;
1612
1663
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
1613
- const { requestBody, warnings } = this.getArgs(options);
1664
+ const { requestBody, warnings } = await this.getArgs(options);
1614
1665
  const {
1615
1666
  value: audio,
1616
1667
  responseHeaders,
@@ -1649,10 +1700,10 @@ import {
1649
1700
  createEventSourceResponseHandler as createEventSourceResponseHandler3,
1650
1701
  createJsonResponseHandler as createJsonResponseHandler6,
1651
1702
  generateId as generateId2,
1652
- parseProviderOptions as parseProviderOptions5,
1703
+ parseProviderOptions as parseProviderOptions6,
1653
1704
  postJsonToApi as postJsonToApi6
1654
1705
  } from "@ai-sdk/provider-utils";
1655
- import { z as z10 } from "zod";
1706
+ import { z as z11 } from "zod";
1656
1707
 
1657
1708
  // src/responses/convert-to-openai-responses-messages.ts
1658
1709
  import {
@@ -1876,7 +1927,7 @@ var OpenAIResponsesLanguageModel = class {
1876
1927
  get provider() {
1877
1928
  return this.config.provider;
1878
1929
  }
1879
- getArgs({
1930
+ async getArgs({
1880
1931
  maxOutputTokens,
1881
1932
  temperature,
1882
1933
  stopSequences,
@@ -1920,7 +1971,7 @@ var OpenAIResponsesLanguageModel = class {
1920
1971
  systemMessageMode: modelConfig.systemMessageMode
1921
1972
  });
1922
1973
  warnings.push(...messageWarnings);
1923
- const openaiOptions = parseProviderOptions5({
1974
+ const openaiOptions = await parseProviderOptions6({
1924
1975
  provider: "openai",
1925
1976
  providerOptions,
1926
1977
  schema: openaiResponsesProviderOptionsSchema
@@ -2003,7 +2054,7 @@ var OpenAIResponsesLanguageModel = class {
2003
2054
  }
2004
2055
  async doGenerate(options) {
2005
2056
  var _a, _b, _c, _d, _e, _f, _g, _h;
2006
- const { args: body, warnings } = this.getArgs(options);
2057
+ const { args: body, warnings } = await this.getArgs(options);
2007
2058
  const {
2008
2059
  responseHeaders,
2009
2060
  value: response,
@@ -2017,55 +2068,55 @@ var OpenAIResponsesLanguageModel = class {
2017
2068
  body,
2018
2069
  failedResponseHandler: openaiFailedResponseHandler,
2019
2070
  successfulResponseHandler: createJsonResponseHandler6(
2020
- z10.object({
2021
- id: z10.string(),
2022
- created_at: z10.number(),
2023
- model: z10.string(),
2024
- output: z10.array(
2025
- z10.discriminatedUnion("type", [
2026
- z10.object({
2027
- type: z10.literal("message"),
2028
- role: z10.literal("assistant"),
2029
- content: z10.array(
2030
- z10.object({
2031
- type: z10.literal("output_text"),
2032
- text: z10.string(),
2033
- annotations: z10.array(
2034
- z10.object({
2035
- type: z10.literal("url_citation"),
2036
- start_index: z10.number(),
2037
- end_index: z10.number(),
2038
- url: z10.string(),
2039
- title: z10.string()
2071
+ z11.object({
2072
+ id: z11.string(),
2073
+ created_at: z11.number(),
2074
+ model: z11.string(),
2075
+ output: z11.array(
2076
+ z11.discriminatedUnion("type", [
2077
+ z11.object({
2078
+ type: z11.literal("message"),
2079
+ role: z11.literal("assistant"),
2080
+ content: z11.array(
2081
+ z11.object({
2082
+ type: z11.literal("output_text"),
2083
+ text: z11.string(),
2084
+ annotations: z11.array(
2085
+ z11.object({
2086
+ type: z11.literal("url_citation"),
2087
+ start_index: z11.number(),
2088
+ end_index: z11.number(),
2089
+ url: z11.string(),
2090
+ title: z11.string()
2040
2091
  })
2041
2092
  )
2042
2093
  })
2043
2094
  )
2044
2095
  }),
2045
- z10.object({
2046
- type: z10.literal("function_call"),
2047
- call_id: z10.string(),
2048
- name: z10.string(),
2049
- arguments: z10.string()
2096
+ z11.object({
2097
+ type: z11.literal("function_call"),
2098
+ call_id: z11.string(),
2099
+ name: z11.string(),
2100
+ arguments: z11.string()
2050
2101
  }),
2051
- z10.object({
2052
- type: z10.literal("web_search_call")
2102
+ z11.object({
2103
+ type: z11.literal("web_search_call")
2053
2104
  }),
2054
- z10.object({
2055
- type: z10.literal("computer_call")
2105
+ z11.object({
2106
+ type: z11.literal("computer_call")
2056
2107
  }),
2057
- z10.object({
2058
- type: z10.literal("reasoning"),
2059
- summary: z10.array(
2060
- z10.object({
2061
- type: z10.literal("summary_text"),
2062
- text: z10.string()
2108
+ z11.object({
2109
+ type: z11.literal("reasoning"),
2110
+ summary: z11.array(
2111
+ z11.object({
2112
+ type: z11.literal("summary_text"),
2113
+ text: z11.string()
2063
2114
  })
2064
2115
  )
2065
2116
  })
2066
2117
  ])
2067
2118
  ),
2068
- incomplete_details: z10.object({ reason: z10.string() }).nullable(),
2119
+ incomplete_details: z11.object({ reason: z11.string() }).nullable(),
2069
2120
  usage: usageSchema
2070
2121
  })
2071
2122
  ),
@@ -2078,7 +2129,6 @@ var OpenAIResponsesLanguageModel = class {
2078
2129
  case "reasoning": {
2079
2130
  content.push({
2080
2131
  type: "reasoning",
2081
- reasoningType: "text",
2082
2132
  text: part.summary.map((summary) => summary.text).join()
2083
2133
  });
2084
2134
  break;
@@ -2142,7 +2192,7 @@ var OpenAIResponsesLanguageModel = class {
2142
2192
  };
2143
2193
  }
2144
2194
  async doStream(options) {
2145
- const { args: body, warnings } = this.getArgs(options);
2195
+ const { args: body, warnings } = await this.getArgs(options);
2146
2196
  const { responseHeaders, value: response } = await postJsonToApi6({
2147
2197
  url: this.config.url({
2148
2198
  path: "/responses",
@@ -2226,7 +2276,6 @@ var OpenAIResponsesLanguageModel = class {
2226
2276
  } else if (isResponseReasoningSummaryTextDeltaChunk(value)) {
2227
2277
  controller.enqueue({
2228
2278
  type: "reasoning",
2229
- reasoningType: "text",
2230
2279
  text: value.delta
2231
2280
  });
2232
2281
  } else if (isResponseOutputItemDoneChunk(value) && value.item.type === "function_call") {
@@ -2281,86 +2330,86 @@ var OpenAIResponsesLanguageModel = class {
2281
2330
  };
2282
2331
  }
2283
2332
  };
2284
- var usageSchema = z10.object({
2285
- input_tokens: z10.number(),
2286
- input_tokens_details: z10.object({ cached_tokens: z10.number().nullish() }).nullish(),
2287
- output_tokens: z10.number(),
2288
- output_tokens_details: z10.object({ reasoning_tokens: z10.number().nullish() }).nullish()
2333
+ var usageSchema = z11.object({
2334
+ input_tokens: z11.number(),
2335
+ input_tokens_details: z11.object({ cached_tokens: z11.number().nullish() }).nullish(),
2336
+ output_tokens: z11.number(),
2337
+ output_tokens_details: z11.object({ reasoning_tokens: z11.number().nullish() }).nullish()
2289
2338
  });
2290
- var textDeltaChunkSchema = z10.object({
2291
- type: z10.literal("response.output_text.delta"),
2292
- delta: z10.string()
2339
+ var textDeltaChunkSchema = z11.object({
2340
+ type: z11.literal("response.output_text.delta"),
2341
+ delta: z11.string()
2293
2342
  });
2294
- var responseFinishedChunkSchema = z10.object({
2295
- type: z10.enum(["response.completed", "response.incomplete"]),
2296
- response: z10.object({
2297
- incomplete_details: z10.object({ reason: z10.string() }).nullish(),
2343
+ var responseFinishedChunkSchema = z11.object({
2344
+ type: z11.enum(["response.completed", "response.incomplete"]),
2345
+ response: z11.object({
2346
+ incomplete_details: z11.object({ reason: z11.string() }).nullish(),
2298
2347
  usage: usageSchema
2299
2348
  })
2300
2349
  });
2301
- var responseCreatedChunkSchema = z10.object({
2302
- type: z10.literal("response.created"),
2303
- response: z10.object({
2304
- id: z10.string(),
2305
- created_at: z10.number(),
2306
- model: z10.string()
2350
+ var responseCreatedChunkSchema = z11.object({
2351
+ type: z11.literal("response.created"),
2352
+ response: z11.object({
2353
+ id: z11.string(),
2354
+ created_at: z11.number(),
2355
+ model: z11.string()
2307
2356
  })
2308
2357
  });
2309
- var responseOutputItemDoneSchema = z10.object({
2310
- type: z10.literal("response.output_item.done"),
2311
- output_index: z10.number(),
2312
- item: z10.discriminatedUnion("type", [
2313
- z10.object({
2314
- type: z10.literal("message")
2358
+ var responseOutputItemDoneSchema = z11.object({
2359
+ type: z11.literal("response.output_item.done"),
2360
+ output_index: z11.number(),
2361
+ item: z11.discriminatedUnion("type", [
2362
+ z11.object({
2363
+ type: z11.literal("message")
2315
2364
  }),
2316
- z10.object({
2317
- type: z10.literal("function_call"),
2318
- id: z10.string(),
2319
- call_id: z10.string(),
2320
- name: z10.string(),
2321
- arguments: z10.string(),
2322
- status: z10.literal("completed")
2365
+ z11.object({
2366
+ type: z11.literal("function_call"),
2367
+ id: z11.string(),
2368
+ call_id: z11.string(),
2369
+ name: z11.string(),
2370
+ arguments: z11.string(),
2371
+ status: z11.literal("completed")
2323
2372
  })
2324
2373
  ])
2325
2374
  });
2326
- var responseFunctionCallArgumentsDeltaSchema = z10.object({
2327
- type: z10.literal("response.function_call_arguments.delta"),
2328
- item_id: z10.string(),
2329
- output_index: z10.number(),
2330
- delta: z10.string()
2375
+ var responseFunctionCallArgumentsDeltaSchema = z11.object({
2376
+ type: z11.literal("response.function_call_arguments.delta"),
2377
+ item_id: z11.string(),
2378
+ output_index: z11.number(),
2379
+ delta: z11.string()
2331
2380
  });
2332
- var responseOutputItemAddedSchema = z10.object({
2333
- type: z10.literal("response.output_item.added"),
2334
- output_index: z10.number(),
2335
- item: z10.discriminatedUnion("type", [
2336
- z10.object({
2337
- type: z10.literal("message")
2381
+ var responseOutputItemAddedSchema = z11.object({
2382
+ type: z11.literal("response.output_item.added"),
2383
+ output_index: z11.number(),
2384
+ item: z11.discriminatedUnion("type", [
2385
+ z11.object({
2386
+ type: z11.literal("message")
2338
2387
  }),
2339
- z10.object({
2340
- type: z10.literal("function_call"),
2341
- id: z10.string(),
2342
- call_id: z10.string(),
2343
- name: z10.string(),
2344
- arguments: z10.string()
2388
+ z11.object({
2389
+ type: z11.literal("function_call"),
2390
+ id: z11.string(),
2391
+ call_id: z11.string(),
2392
+ name: z11.string(),
2393
+ arguments: z11.string()
2345
2394
  })
2346
2395
  ])
2347
2396
  });
2348
- var responseAnnotationAddedSchema = z10.object({
2349
- type: z10.literal("response.output_text.annotation.added"),
2350
- annotation: z10.object({
2351
- type: z10.literal("url_citation"),
2352
- url: z10.string(),
2353
- title: z10.string()
2397
+ var responseAnnotationAddedSchema = z11.object({
2398
+ type: z11.literal("response.output_text.annotation.added"),
2399
+ annotation: z11.object({
2400
+ type: z11.literal("url_citation"),
2401
+ url: z11.string(),
2402
+ title: z11.string()
2354
2403
  })
2355
2404
  });
2356
- var responseReasoningSummaryTextDeltaSchema = z10.object({
2357
- type: z10.literal("response.reasoning_summary_text.delta"),
2358
- item_id: z10.string(),
2359
- output_index: z10.number(),
2360
- summary_index: z10.number(),
2361
- delta: z10.string()
2405
+ var responseReasoningSummaryTextDeltaSchema = z11.object({
2406
+ type: z11.literal("response.reasoning_summary_text.delta"),
2407
+ item_id: z11.string(),
2408
+ output_index: z11.number(),
2409
+ summary_index: z11.number(),
2410
+ delta: z11.string()
2362
2411
  });
2363
- var openaiResponsesChunkSchema = z10.union([
2412
+ var openaiResponsesChunkSchema = z11.union([
2364
2413
  textDeltaChunkSchema,
2365
2414
  responseFinishedChunkSchema,
2366
2415
  responseCreatedChunkSchema,
@@ -2369,7 +2418,7 @@ var openaiResponsesChunkSchema = z10.union([
2369
2418
  responseOutputItemAddedSchema,
2370
2419
  responseAnnotationAddedSchema,
2371
2420
  responseReasoningSummaryTextDeltaSchema,
2372
- z10.object({ type: z10.string() }).passthrough()
2421
+ z11.object({ type: z11.string() }).passthrough()
2373
2422
  // fallback for unknown chunks
2374
2423
  ]);
2375
2424
  function isTextDeltaChunk(chunk) {
@@ -2417,16 +2466,16 @@ function getResponsesModelConfig(modelId) {
2417
2466
  requiredAutoTruncation: false
2418
2467
  };
2419
2468
  }
2420
- var openaiResponsesProviderOptionsSchema = z10.object({
2421
- metadata: z10.any().nullish(),
2422
- parallelToolCalls: z10.boolean().nullish(),
2423
- previousResponseId: z10.string().nullish(),
2424
- store: z10.boolean().nullish(),
2425
- user: z10.string().nullish(),
2426
- reasoningEffort: z10.string().nullish(),
2427
- strictSchemas: z10.boolean().nullish(),
2428
- instructions: z10.string().nullish(),
2429
- reasoningSummary: z10.string().nullish()
2469
+ var openaiResponsesProviderOptionsSchema = z11.object({
2470
+ metadata: z11.any().nullish(),
2471
+ parallelToolCalls: z11.boolean().nullish(),
2472
+ previousResponseId: z11.string().nullish(),
2473
+ store: z11.boolean().nullish(),
2474
+ user: z11.string().nullish(),
2475
+ reasoningEffort: z11.string().nullish(),
2476
+ strictSchemas: z11.boolean().nullish(),
2477
+ instructions: z11.string().nullish(),
2478
+ reasoningSummary: z11.string().nullish()
2430
2479
  });
2431
2480
  export {
2432
2481
  OpenAIChatLanguageModel,
@@ -2436,7 +2485,9 @@ export {
2436
2485
  OpenAIResponsesLanguageModel,
2437
2486
  OpenAISpeechModel,
2438
2487
  OpenAITranscriptionModel,
2488
+ hasDefaultResponseFormat,
2439
2489
  modelMaxImagesPerCall,
2490
+ openaiCompletionProviderOptions,
2440
2491
  openaiEmbeddingProviderOptions,
2441
2492
  openaiProviderOptions
2442
2493
  };