@ai-sdk/openai 3.0.47 → 3.0.48

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.
@@ -34,7 +34,7 @@ var openaiFailedResponseHandler = createJsonErrorResponseHandler({
34
34
  // src/openai-language-model-capabilities.ts
35
35
  function getOpenAILanguageModelCapabilities(modelId) {
36
36
  const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
37
- const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
37
+ const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") && !modelId.startsWith("gpt-5.4-nano") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
38
38
  const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
39
39
  const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4");
40
40
  const systemMessageMode = isReasoningModel ? "developer" : "system";
@@ -3267,6 +3267,23 @@ var openaiResponsesChunkSchema = lazySchema15(
3267
3267
  service_tier: z17.string().nullish()
3268
3268
  })
3269
3269
  }),
3270
+ z17.object({
3271
+ type: z17.literal("response.failed"),
3272
+ response: z17.object({
3273
+ error: z17.object({
3274
+ code: z17.string().nullish(),
3275
+ message: z17.string()
3276
+ }).nullish(),
3277
+ incomplete_details: z17.object({ reason: z17.string() }).nullish(),
3278
+ usage: z17.object({
3279
+ input_tokens: z17.number(),
3280
+ input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
3281
+ output_tokens: z17.number(),
3282
+ output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
3283
+ }).nullish(),
3284
+ service_tier: z17.string().nullish()
3285
+ })
3286
+ }),
3270
3287
  z17.object({
3271
3288
  type: z17.literal("response.created"),
3272
3289
  response: z17.object({
@@ -4084,6 +4101,10 @@ var openaiResponsesReasoningModelIds = [
4084
4101
  "gpt-5.3-codex",
4085
4102
  "gpt-5.4",
4086
4103
  "gpt-5.4-2026-03-05",
4104
+ "gpt-5.4-mini",
4105
+ "gpt-5.4-mini-2026-03-17",
4106
+ "gpt-5.4-nano",
4107
+ "gpt-5.4-nano-2026-03-17",
4087
4108
  "gpt-5.4-pro",
4088
4109
  "gpt-5.4-pro-2026-03-05"
4089
4110
  ];
@@ -5686,7 +5707,7 @@ var OpenAIResponsesLanguageModel = class {
5686
5707
  controller.enqueue({ type: "stream-start", warnings });
5687
5708
  },
5688
5709
  transform(chunk, controller) {
5689
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J;
5710
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
5690
5711
  if (options.includeRawChunks) {
5691
5712
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
5692
5713
  }
@@ -6411,13 +6432,23 @@ var OpenAIResponsesLanguageModel = class {
6411
6432
  if (typeof value.response.service_tier === "string") {
6412
6433
  serviceTier = value.response.service_tier;
6413
6434
  }
6435
+ } else if (isResponseFailedChunk(value)) {
6436
+ const incompleteReason = (_y = value.response.incomplete_details) == null ? void 0 : _y.reason;
6437
+ finishReason = {
6438
+ unified: incompleteReason ? mapOpenAIResponseFinishReason({
6439
+ finishReason: incompleteReason,
6440
+ hasFunctionCall
6441
+ }) : "error",
6442
+ raw: incompleteReason != null ? incompleteReason : "error"
6443
+ };
6444
+ usage = (_z = value.response.usage) != null ? _z : void 0;
6414
6445
  } else if (isResponseAnnotationAddedChunk(value)) {
6415
6446
  ongoingAnnotations.push(value.annotation);
6416
6447
  if (value.annotation.type === "url_citation") {
6417
6448
  controller.enqueue({
6418
6449
  type: "source",
6419
6450
  sourceType: "url",
6420
- id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : generateId2(),
6451
+ id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : generateId2(),
6421
6452
  url: value.annotation.url,
6422
6453
  title: value.annotation.title
6423
6454
  });
@@ -6425,7 +6456,7 @@ var OpenAIResponsesLanguageModel = class {
6425
6456
  controller.enqueue({
6426
6457
  type: "source",
6427
6458
  sourceType: "document",
6428
- id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : generateId2(),
6459
+ id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : generateId2(),
6429
6460
  mediaType: "text/plain",
6430
6461
  title: value.annotation.filename,
6431
6462
  filename: value.annotation.filename,
@@ -6441,7 +6472,7 @@ var OpenAIResponsesLanguageModel = class {
6441
6472
  controller.enqueue({
6442
6473
  type: "source",
6443
6474
  sourceType: "document",
6444
- id: (_G = (_F = (_E = self.config).generateId) == null ? void 0 : _F.call(_E)) != null ? _G : generateId2(),
6475
+ id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : generateId2(),
6445
6476
  mediaType: "text/plain",
6446
6477
  title: value.annotation.filename,
6447
6478
  filename: value.annotation.filename,
@@ -6457,7 +6488,7 @@ var OpenAIResponsesLanguageModel = class {
6457
6488
  controller.enqueue({
6458
6489
  type: "source",
6459
6490
  sourceType: "document",
6460
- id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : generateId2(),
6491
+ id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : generateId2(),
6461
6492
  mediaType: "application/octet-stream",
6462
6493
  title: value.annotation.file_id,
6463
6494
  filename: value.annotation.file_id,
@@ -6505,6 +6536,9 @@ function isResponseOutputItemDoneChunk(chunk) {
6505
6536
  function isResponseFinishedChunk(chunk) {
6506
6537
  return chunk.type === "response.completed" || chunk.type === "response.incomplete";
6507
6538
  }
6539
+ function isResponseFailedChunk(chunk) {
6540
+ return chunk.type === "response.failed";
6541
+ }
6508
6542
  function isResponseCreatedChunk(chunk) {
6509
6543
  return chunk.type === "response.created";
6510
6544
  }