@ai-sdk/openai 3.0.7 → 3.0.8

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.
@@ -3227,25 +3227,21 @@ var openaiResponsesChunkSchema = (0, import_provider_utils23.lazySchema)(
3227
3227
  import_v416.z.object({
3228
3228
  type: import_v416.z.literal("file_citation"),
3229
3229
  file_id: import_v416.z.string(),
3230
- filename: import_v416.z.string().nullish(),
3231
- index: import_v416.z.number().nullish(),
3232
- start_index: import_v416.z.number().nullish(),
3233
- end_index: import_v416.z.number().nullish(),
3234
- quote: import_v416.z.string().nullish()
3230
+ filename: import_v416.z.string(),
3231
+ index: import_v416.z.number()
3235
3232
  }),
3236
3233
  import_v416.z.object({
3237
3234
  type: import_v416.z.literal("container_file_citation"),
3238
3235
  container_id: import_v416.z.string(),
3239
3236
  file_id: import_v416.z.string(),
3240
- filename: import_v416.z.string().nullish(),
3241
- start_index: import_v416.z.number().nullish(),
3242
- end_index: import_v416.z.number().nullish(),
3243
- index: import_v416.z.number().nullish()
3237
+ filename: import_v416.z.string(),
3238
+ start_index: import_v416.z.number(),
3239
+ end_index: import_v416.z.number()
3244
3240
  }),
3245
3241
  import_v416.z.object({
3246
3242
  type: import_v416.z.literal("file_path"),
3247
3243
  file_id: import_v416.z.string(),
3248
- index: import_v416.z.number().nullish()
3244
+ index: import_v416.z.number()
3249
3245
  })
3250
3246
  ])
3251
3247
  }),
@@ -3342,25 +3338,21 @@ var openaiResponsesResponseSchema = (0, import_provider_utils23.lazySchema)(
3342
3338
  import_v416.z.object({
3343
3339
  type: import_v416.z.literal("file_citation"),
3344
3340
  file_id: import_v416.z.string(),
3345
- filename: import_v416.z.string().nullish(),
3346
- index: import_v416.z.number().nullish(),
3347
- start_index: import_v416.z.number().nullish(),
3348
- end_index: import_v416.z.number().nullish(),
3349
- quote: import_v416.z.string().nullish()
3341
+ filename: import_v416.z.string(),
3342
+ index: import_v416.z.number()
3350
3343
  }),
3351
3344
  import_v416.z.object({
3352
3345
  type: import_v416.z.literal("container_file_citation"),
3353
3346
  container_id: import_v416.z.string(),
3354
3347
  file_id: import_v416.z.string(),
3355
- filename: import_v416.z.string().nullish(),
3356
- start_index: import_v416.z.number().nullish(),
3357
- end_index: import_v416.z.number().nullish(),
3358
- index: import_v416.z.number().nullish()
3348
+ filename: import_v416.z.string(),
3349
+ start_index: import_v416.z.number(),
3350
+ end_index: import_v416.z.number()
3359
3351
  }),
3360
3352
  import_v416.z.object({
3361
3353
  type: import_v416.z.literal("file_path"),
3362
3354
  file_id: import_v416.z.string(),
3363
- index: import_v416.z.number().nullish()
3355
+ index: import_v416.z.number()
3364
3356
  })
3365
3357
  ])
3366
3358
  )
@@ -4518,7 +4510,7 @@ var OpenAIResponsesLanguageModel = class {
4518
4510
  };
4519
4511
  }
4520
4512
  async doGenerate(options) {
4521
- 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;
4513
+ 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;
4522
4514
  const {
4523
4515
  args: body,
4524
4516
  warnings,
@@ -4665,29 +4657,29 @@ var OpenAIResponsesLanguageModel = class {
4665
4657
  sourceType: "document",
4666
4658
  id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils32.generateId)(),
4667
4659
  mediaType: "text/plain",
4668
- title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
4669
- filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
4670
- ...annotation.file_id ? {
4671
- providerMetadata: {
4672
- [providerOptionsName]: {
4673
- fileId: annotation.file_id
4674
- }
4660
+ title: annotation.filename,
4661
+ filename: annotation.filename,
4662
+ providerMetadata: {
4663
+ [providerOptionsName]: {
4664
+ type: annotation.type,
4665
+ fileId: annotation.file_id,
4666
+ index: annotation.index
4675
4667
  }
4676
- } : {}
4668
+ }
4677
4669
  });
4678
4670
  } else if (annotation.type === "container_file_citation") {
4679
4671
  content.push({
4680
4672
  type: "source",
4681
4673
  sourceType: "document",
4682
- id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils32.generateId)(),
4674
+ id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils32.generateId)(),
4683
4675
  mediaType: "text/plain",
4684
- title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
4685
- filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
4676
+ title: annotation.filename,
4677
+ filename: annotation.filename,
4686
4678
  providerMetadata: {
4687
4679
  [providerOptionsName]: {
4680
+ type: annotation.type,
4688
4681
  fileId: annotation.file_id,
4689
- containerId: annotation.container_id,
4690
- ...annotation.index != null ? { index: annotation.index } : {}
4682
+ containerId: annotation.container_id
4691
4683
  }
4692
4684
  }
4693
4685
  });
@@ -4695,14 +4687,15 @@ var OpenAIResponsesLanguageModel = class {
4695
4687
  content.push({
4696
4688
  type: "source",
4697
4689
  sourceType: "document",
4698
- id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils32.generateId)(),
4690
+ id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils32.generateId)(),
4699
4691
  mediaType: "application/octet-stream",
4700
4692
  title: annotation.file_id,
4701
4693
  filename: annotation.file_id,
4702
4694
  providerMetadata: {
4703
4695
  [providerOptionsName]: {
4696
+ type: annotation.type,
4704
4697
  fileId: annotation.file_id,
4705
- ...annotation.index != null ? { index: annotation.index } : {}
4698
+ index: annotation.index
4706
4699
  }
4707
4700
  }
4708
4701
  });
@@ -4747,7 +4740,7 @@ var OpenAIResponsesLanguageModel = class {
4747
4740
  break;
4748
4741
  }
4749
4742
  case "mcp_call": {
4750
- const toolCallId = part.approval_request_id != null ? (_v = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _v : part.id : part.id;
4743
+ const toolCallId = part.approval_request_id != null ? (_p = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _p : part.id : part.id;
4751
4744
  const toolName = `mcp.${part.name}`;
4752
4745
  content.push({
4753
4746
  type: "tool-call",
@@ -4781,8 +4774,8 @@ var OpenAIResponsesLanguageModel = class {
4781
4774
  break;
4782
4775
  }
4783
4776
  case "mcp_approval_request": {
4784
- const approvalRequestId = (_w = part.approval_request_id) != null ? _w : part.id;
4785
- const dummyToolCallId = (_z = (_y = (_x = this.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : (0, import_provider_utils32.generateId)();
4777
+ const approvalRequestId = (_q = part.approval_request_id) != null ? _q : part.id;
4778
+ const dummyToolCallId = (_t = (_s = (_r = this.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils32.generateId)();
4786
4779
  const toolName = `mcp.${part.name}`;
4787
4780
  content.push({
4788
4781
  type: "tool-call",
@@ -4832,13 +4825,13 @@ var OpenAIResponsesLanguageModel = class {
4832
4825
  toolName: toolNameMapping.toCustomToolName("file_search"),
4833
4826
  result: {
4834
4827
  queries: part.queries,
4835
- results: (_B = (_A = part.results) == null ? void 0 : _A.map((result) => ({
4828
+ results: (_v = (_u = part.results) == null ? void 0 : _u.map((result) => ({
4836
4829
  attributes: result.attributes,
4837
4830
  fileId: result.file_id,
4838
4831
  filename: result.filename,
4839
4832
  score: result.score,
4840
4833
  text: result.text
4841
- }))) != null ? _B : null
4834
+ }))) != null ? _v : null
4842
4835
  }
4843
4836
  });
4844
4837
  break;
@@ -4897,10 +4890,10 @@ var OpenAIResponsesLanguageModel = class {
4897
4890
  content,
4898
4891
  finishReason: {
4899
4892
  unified: mapOpenAIResponseFinishReason({
4900
- finishReason: (_C = response.incomplete_details) == null ? void 0 : _C.reason,
4893
+ finishReason: (_w = response.incomplete_details) == null ? void 0 : _w.reason,
4901
4894
  hasFunctionCall
4902
4895
  }),
4903
- raw: (_E = (_D = response.incomplete_details) == null ? void 0 : _D.reason) != null ? _E : void 0
4896
+ raw: (_y = (_x = response.incomplete_details) == null ? void 0 : _x.reason) != null ? _y : void 0
4904
4897
  },
4905
4898
  usage: convertOpenAIResponsesUsage(usage),
4906
4899
  request: { body },
@@ -4963,7 +4956,7 @@ var OpenAIResponsesLanguageModel = class {
4963
4956
  controller.enqueue({ type: "stream-start", warnings });
4964
4957
  },
4965
4958
  transform(chunk, controller) {
4966
- 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;
4959
+ 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;
4967
4960
  if (options.includeRawChunks) {
4968
4961
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
4969
4962
  }
@@ -5560,29 +5553,29 @@ var OpenAIResponsesLanguageModel = class {
5560
5553
  sourceType: "document",
5561
5554
  id: (_x = (_w = (_v = self.config).generateId) == null ? void 0 : _w.call(_v)) != null ? _x : (0, import_provider_utils32.generateId)(),
5562
5555
  mediaType: "text/plain",
5563
- title: (_z = (_y = value.annotation.quote) != null ? _y : value.annotation.filename) != null ? _z : "Document",
5564
- filename: (_A = value.annotation.filename) != null ? _A : value.annotation.file_id,
5565
- ...value.annotation.file_id ? {
5566
- providerMetadata: {
5567
- [providerOptionsName]: {
5568
- fileId: value.annotation.file_id
5569
- }
5556
+ title: value.annotation.filename,
5557
+ filename: value.annotation.filename,
5558
+ providerMetadata: {
5559
+ [providerOptionsName]: {
5560
+ type: value.annotation.type,
5561
+ fileId: value.annotation.file_id,
5562
+ index: value.annotation.index
5570
5563
  }
5571
- } : {}
5564
+ }
5572
5565
  });
5573
5566
  } else if (value.annotation.type === "container_file_citation") {
5574
5567
  controller.enqueue({
5575
5568
  type: "source",
5576
5569
  sourceType: "document",
5577
- id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : (0, import_provider_utils32.generateId)(),
5570
+ id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : (0, import_provider_utils32.generateId)(),
5578
5571
  mediaType: "text/plain",
5579
- title: (_F = (_E = value.annotation.filename) != null ? _E : value.annotation.file_id) != null ? _F : "Document",
5580
- filename: (_G = value.annotation.filename) != null ? _G : value.annotation.file_id,
5572
+ title: value.annotation.filename,
5573
+ filename: value.annotation.filename,
5581
5574
  providerMetadata: {
5582
5575
  [providerOptionsName]: {
5576
+ type: value.annotation.type,
5583
5577
  fileId: value.annotation.file_id,
5584
- containerId: value.annotation.container_id,
5585
- ...value.annotation.index != null ? { index: value.annotation.index } : {}
5578
+ containerId: value.annotation.container_id
5586
5579
  }
5587
5580
  }
5588
5581
  });
@@ -5590,14 +5583,15 @@ var OpenAIResponsesLanguageModel = class {
5590
5583
  controller.enqueue({
5591
5584
  type: "source",
5592
5585
  sourceType: "document",
5593
- id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : (0, import_provider_utils32.generateId)(),
5586
+ id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : (0, import_provider_utils32.generateId)(),
5594
5587
  mediaType: "application/octet-stream",
5595
5588
  title: value.annotation.file_id,
5596
5589
  filename: value.annotation.file_id,
5597
5590
  providerMetadata: {
5598
5591
  [providerOptionsName]: {
5592
+ type: value.annotation.type,
5599
5593
  fileId: value.annotation.file_id,
5600
- ...value.annotation.index != null ? { index: value.annotation.index } : {}
5594
+ index: value.annotation.index
5601
5595
  }
5602
5596
  }
5603
5597
  });