@ai-sdk/openai 2.0.69 → 2.0.70

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
+ ## 2.0.70
4
+
5
+ ### Patch Changes
6
+
7
+ - dafda29: Set the annotations from the Responses API to doStream
8
+
3
9
  ## 2.0.69
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3647,6 +3647,7 @@ var OpenAIResponsesLanguageModel = class {
3647
3647
  const logprobs = [];
3648
3648
  let responseId = null;
3649
3649
  const ongoingToolCalls = {};
3650
+ const ongoingAnnotations = [];
3650
3651
  let hasFunctionCall = false;
3651
3652
  const activeReasoning = {};
3652
3653
  let serviceTier;
@@ -3747,6 +3748,7 @@ var OpenAIResponsesLanguageModel = class {
3747
3748
  providerExecuted: true
3748
3749
  });
3749
3750
  } else if (value.item.type === "message") {
3751
+ ongoingAnnotations.splice(0, ongoingAnnotations.length);
3750
3752
  controller.enqueue({
3751
3753
  type: "text-start",
3752
3754
  id: value.item.id,
@@ -3772,7 +3774,7 @@ var OpenAIResponsesLanguageModel = class {
3772
3774
  }
3773
3775
  });
3774
3776
  }
3775
- } else if (isResponseOutputItemDoneChunk(value)) {
3777
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type !== "message") {
3776
3778
  if (value.item.type === "function_call") {
3777
3779
  ongoingToolCalls[value.output_index] = void 0;
3778
3780
  hasFunctionCall = true;
@@ -3882,11 +3884,6 @@ var OpenAIResponsesLanguageModel = class {
3882
3884
  openai: { itemId: value.item.id }
3883
3885
  }
3884
3886
  });
3885
- } else if (value.item.type === "message") {
3886
- controller.enqueue({
3887
- type: "text-end",
3888
- id: value.item.id
3889
- });
3890
3887
  } else if (value.item.type === "reasoning") {
3891
3888
  const activeReasoningPart = activeReasoning[value.item.id];
3892
3889
  const summaryPartIndices = Object.entries(
@@ -4033,6 +4030,7 @@ var OpenAIResponsesLanguageModel = class {
4033
4030
  serviceTier = value.response.service_tier;
4034
4031
  }
4035
4032
  } else if (isResponseAnnotationAddedChunk(value)) {
4033
+ ongoingAnnotations.push(value.annotation);
4036
4034
  if (value.annotation.type === "url_citation") {
4037
4035
  controller.enqueue({
4038
4036
  type: "source",
@@ -4058,6 +4056,19 @@ var OpenAIResponsesLanguageModel = class {
4058
4056
  } : {}
4059
4057
  });
4060
4058
  }
4059
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type === "message") {
4060
+ controller.enqueue({
4061
+ type: "text-end",
4062
+ id: value.item.id,
4063
+ providerMetadata: {
4064
+ openai: {
4065
+ itemId: value.item.id,
4066
+ ...ongoingAnnotations.length > 0 && {
4067
+ annotations: ongoingAnnotations
4068
+ }
4069
+ }
4070
+ }
4071
+ });
4061
4072
  } else if (isErrorChunk(value)) {
4062
4073
  controller.enqueue({ type: "error", error: value });
4063
4074
  }
@@ -4515,7 +4526,7 @@ var OpenAITranscriptionModel = class {
4515
4526
  };
4516
4527
 
4517
4528
  // src/version.ts
4518
- var VERSION = true ? "2.0.69" : "0.0.0-test";
4529
+ var VERSION = true ? "2.0.70" : "0.0.0-test";
4519
4530
 
4520
4531
  // src/openai-provider.ts
4521
4532
  function createOpenAI(options = {}) {