@ai-sdk/openai 3.0.0-beta.65 → 3.0.0-beta.66

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.0-beta.66
4
+
5
+ ### Patch Changes
6
+
7
+ - d86b52f: distinguish between OpenAI and Azure in Responses API providerMetadata
8
+
3
9
  ## 3.0.0-beta.65
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3626,6 +3626,7 @@ var OpenAIResponsesLanguageModel = class {
3626
3626
  path: "/responses",
3627
3627
  modelId: this.modelId
3628
3628
  });
3629
+ const providerKey = this.config.provider.replace(".responses", "");
3629
3630
  const {
3630
3631
  responseHeaders,
3631
3632
  value: response,
@@ -3666,7 +3667,7 @@ var OpenAIResponsesLanguageModel = class {
3666
3667
  type: "reasoning",
3667
3668
  text: summary.text,
3668
3669
  providerMetadata: {
3669
- openai: {
3670
+ [providerKey]: {
3670
3671
  itemId: part.id,
3671
3672
  reasoningEncryptedContent: (_a = part.encrypted_content) != null ? _a : null
3672
3673
  }
@@ -3702,7 +3703,7 @@ var OpenAIResponsesLanguageModel = class {
3702
3703
  action: part.action
3703
3704
  }),
3704
3705
  providerMetadata: {
3705
- openai: {
3706
+ [providerKey]: {
3706
3707
  itemId: part.id
3707
3708
  }
3708
3709
  }
@@ -3724,7 +3725,7 @@ var OpenAIResponsesLanguageModel = class {
3724
3725
  type: "text",
3725
3726
  text: contentPart.text,
3726
3727
  providerMetadata: {
3727
- openai: providerMetadata2
3728
+ [providerKey]: providerMetadata2
3728
3729
  }
3729
3730
  });
3730
3731
  for (const annotation of contentPart.annotations) {
@@ -3746,7 +3747,7 @@ var OpenAIResponsesLanguageModel = class {
3746
3747
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
3747
3748
  ...annotation.file_id ? {
3748
3749
  providerMetadata: {
3749
- openai: {
3750
+ [providerKey]: {
3750
3751
  fileId: annotation.file_id
3751
3752
  }
3752
3753
  }
@@ -3761,7 +3762,7 @@ var OpenAIResponsesLanguageModel = class {
3761
3762
  title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
3762
3763
  filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
3763
3764
  providerMetadata: {
3764
- openai: {
3765
+ [providerKey]: {
3765
3766
  fileId: annotation.file_id,
3766
3767
  containerId: annotation.container_id,
3767
3768
  ...annotation.index != null ? { index: annotation.index } : {}
@@ -3777,7 +3778,7 @@ var OpenAIResponsesLanguageModel = class {
3777
3778
  title: annotation.file_id,
3778
3779
  filename: annotation.file_id,
3779
3780
  providerMetadata: {
3780
- openai: {
3781
+ [providerKey]: {
3781
3782
  fileId: annotation.file_id,
3782
3783
  ...annotation.index != null ? { index: annotation.index } : {}
3783
3784
  }
@@ -3796,7 +3797,7 @@ var OpenAIResponsesLanguageModel = class {
3796
3797
  toolName: part.name,
3797
3798
  input: part.arguments,
3798
3799
  providerMetadata: {
3799
- openai: {
3800
+ [providerKey]: {
3800
3801
  itemId: part.id
3801
3802
  }
3802
3803
  }
@@ -3961,13 +3962,13 @@ var OpenAIResponsesLanguageModel = class {
3961
3962
  }
3962
3963
  }
3963
3964
  const providerMetadata = {
3964
- openai: { responseId: response.id }
3965
+ [providerKey]: { responseId: response.id }
3965
3966
  };
3966
3967
  if (logprobs.length > 0) {
3967
- providerMetadata.openai.logprobs = logprobs;
3968
+ providerMetadata[providerKey].logprobs = logprobs;
3968
3969
  }
3969
3970
  if (typeof response.service_tier === "string") {
3970
- providerMetadata.openai.serviceTier = response.service_tier;
3971
+ providerMetadata[providerKey].serviceTier = response.service_tier;
3971
3972
  }
3972
3973
  const usage = response.usage;
3973
3974
  return {
@@ -4020,6 +4021,7 @@ var OpenAIResponsesLanguageModel = class {
4020
4021
  fetch: this.config.fetch
4021
4022
  });
4022
4023
  const self = this;
4024
+ const providerKey = this.config.provider.replace(".responses", "");
4023
4025
  let finishReason = "unknown";
4024
4026
  const usage = {
4025
4027
  inputTokens: void 0,
@@ -4143,7 +4145,7 @@ var OpenAIResponsesLanguageModel = class {
4143
4145
  type: "text-start",
4144
4146
  id: value.item.id,
4145
4147
  providerMetadata: {
4146
- openai: {
4148
+ [providerKey]: {
4147
4149
  itemId: value.item.id
4148
4150
  }
4149
4151
  }
@@ -4157,7 +4159,7 @@ var OpenAIResponsesLanguageModel = class {
4157
4159
  type: "reasoning-start",
4158
4160
  id: `${value.item.id}:0`,
4159
4161
  providerMetadata: {
4160
- openai: {
4162
+ [providerKey]: {
4161
4163
  itemId: value.item.id,
4162
4164
  reasoningEncryptedContent: (_a = value.item.encrypted_content) != null ? _a : null
4163
4165
  }
@@ -4178,7 +4180,7 @@ var OpenAIResponsesLanguageModel = class {
4178
4180
  toolName: value.item.name,
4179
4181
  input: value.item.arguments,
4180
4182
  providerMetadata: {
4181
- openai: {
4183
+ [providerKey]: {
4182
4184
  itemId: value.item.id
4183
4185
  }
4184
4186
  }
@@ -4316,7 +4318,7 @@ var OpenAIResponsesLanguageModel = class {
4316
4318
  }
4317
4319
  }),
4318
4320
  providerMetadata: {
4319
- openai: { itemId: value.item.id }
4321
+ [providerKey]: { itemId: value.item.id }
4320
4322
  }
4321
4323
  });
4322
4324
  } else if (value.item.type === "reasoning") {
@@ -4331,7 +4333,7 @@ var OpenAIResponsesLanguageModel = class {
4331
4333
  type: "reasoning-end",
4332
4334
  id: `${value.item.id}:${summaryIndex}`,
4333
4335
  providerMetadata: {
4334
- openai: {
4336
+ [providerKey]: {
4335
4337
  itemId: value.item.id,
4336
4338
  reasoningEncryptedContent: (_d = value.item.encrypted_content) != null ? _d : null
4337
4339
  }
@@ -4421,7 +4423,9 @@ var OpenAIResponsesLanguageModel = class {
4421
4423
  controller.enqueue({
4422
4424
  type: "reasoning-end",
4423
4425
  id: `${value.item_id}:${summaryIndex}`,
4424
- providerMetadata: { openai: { itemId: value.item_id } }
4426
+ providerMetadata: {
4427
+ [providerKey]: { itemId: value.item_id }
4428
+ }
4425
4429
  });
4426
4430
  activeReasoningPart.summaryParts[summaryIndex] = "concluded";
4427
4431
  }
@@ -4430,7 +4434,7 @@ var OpenAIResponsesLanguageModel = class {
4430
4434
  type: "reasoning-start",
4431
4435
  id: `${value.item_id}:${value.summary_index}`,
4432
4436
  providerMetadata: {
4433
- openai: {
4437
+ [providerKey]: {
4434
4438
  itemId: value.item_id,
4435
4439
  reasoningEncryptedContent: (_h = (_g = activeReasoning[value.item_id]) == null ? void 0 : _g.encryptedContent) != null ? _h : null
4436
4440
  }
@@ -4443,7 +4447,7 @@ var OpenAIResponsesLanguageModel = class {
4443
4447
  id: `${value.item_id}:${value.summary_index}`,
4444
4448
  delta: value.delta,
4445
4449
  providerMetadata: {
4446
- openai: {
4450
+ [providerKey]: {
4447
4451
  itemId: value.item_id
4448
4452
  }
4449
4453
  }
@@ -4454,7 +4458,7 @@ var OpenAIResponsesLanguageModel = class {
4454
4458
  type: "reasoning-end",
4455
4459
  id: `${value.item_id}:${value.summary_index}`,
4456
4460
  providerMetadata: {
4457
- openai: { itemId: value.item_id }
4461
+ [providerKey]: { itemId: value.item_id }
4458
4462
  }
4459
4463
  });
4460
4464
  activeReasoning[value.item_id].summaryParts[value.summary_index] = "concluded";
@@ -4494,7 +4498,7 @@ var OpenAIResponsesLanguageModel = class {
4494
4498
  filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
4495
4499
  ...value.annotation.file_id ? {
4496
4500
  providerMetadata: {
4497
- openai: {
4501
+ [providerKey]: {
4498
4502
  fileId: value.annotation.file_id
4499
4503
  }
4500
4504
  }
@@ -4509,7 +4513,7 @@ var OpenAIResponsesLanguageModel = class {
4509
4513
  title: (_A = (_z = value.annotation.filename) != null ? _z : value.annotation.file_id) != null ? _A : "Document",
4510
4514
  filename: (_B = value.annotation.filename) != null ? _B : value.annotation.file_id,
4511
4515
  providerMetadata: {
4512
- openai: {
4516
+ [providerKey]: {
4513
4517
  fileId: value.annotation.file_id,
4514
4518
  containerId: value.annotation.container_id,
4515
4519
  ...value.annotation.index != null ? { index: value.annotation.index } : {}
@@ -4525,7 +4529,7 @@ var OpenAIResponsesLanguageModel = class {
4525
4529
  title: value.annotation.file_id,
4526
4530
  filename: value.annotation.file_id,
4527
4531
  providerMetadata: {
4528
- openai: {
4532
+ [providerKey]: {
4529
4533
  fileId: value.annotation.file_id,
4530
4534
  ...value.annotation.index != null ? { index: value.annotation.index } : {}
4531
4535
  }
@@ -4537,7 +4541,7 @@ var OpenAIResponsesLanguageModel = class {
4537
4541
  type: "text-end",
4538
4542
  id: value.item.id,
4539
4543
  providerMetadata: {
4540
- openai: {
4544
+ [providerKey]: {
4541
4545
  itemId: value.item.id,
4542
4546
  ...ongoingAnnotations.length > 0 && {
4543
4547
  annotations: ongoingAnnotations
@@ -4551,15 +4555,15 @@ var OpenAIResponsesLanguageModel = class {
4551
4555
  },
4552
4556
  flush(controller) {
4553
4557
  const providerMetadata = {
4554
- openai: {
4558
+ [providerKey]: {
4555
4559
  responseId
4556
4560
  }
4557
4561
  };
4558
4562
  if (logprobs.length > 0) {
4559
- providerMetadata.openai.logprobs = logprobs;
4563
+ providerMetadata[providerKey].logprobs = logprobs;
4560
4564
  }
4561
4565
  if (serviceTier !== void 0) {
4562
- providerMetadata.openai.serviceTier = serviceTier;
4566
+ providerMetadata[providerKey].serviceTier = serviceTier;
4563
4567
  }
4564
4568
  controller.enqueue({
4565
4569
  type: "finish",
@@ -4991,7 +4995,7 @@ var OpenAITranscriptionModel = class {
4991
4995
  };
4992
4996
 
4993
4997
  // src/version.ts
4994
- var VERSION = true ? "3.0.0-beta.65" : "0.0.0-test";
4998
+ var VERSION = true ? "3.0.0-beta.66" : "0.0.0-test";
4995
4999
 
4996
5000
  // src/openai-provider.ts
4997
5001
  function createOpenAI(options = {}) {