@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/dist/index.mjs CHANGED
@@ -3720,6 +3720,7 @@ var OpenAIResponsesLanguageModel = class {
3720
3720
  const logprobs = [];
3721
3721
  let responseId = null;
3722
3722
  const ongoingToolCalls = {};
3723
+ const ongoingAnnotations = [];
3723
3724
  let hasFunctionCall = false;
3724
3725
  const activeReasoning = {};
3725
3726
  let serviceTier;
@@ -3820,6 +3821,7 @@ var OpenAIResponsesLanguageModel = class {
3820
3821
  providerExecuted: true
3821
3822
  });
3822
3823
  } else if (value.item.type === "message") {
3824
+ ongoingAnnotations.splice(0, ongoingAnnotations.length);
3823
3825
  controller.enqueue({
3824
3826
  type: "text-start",
3825
3827
  id: value.item.id,
@@ -3845,7 +3847,7 @@ var OpenAIResponsesLanguageModel = class {
3845
3847
  }
3846
3848
  });
3847
3849
  }
3848
- } else if (isResponseOutputItemDoneChunk(value)) {
3850
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type !== "message") {
3849
3851
  if (value.item.type === "function_call") {
3850
3852
  ongoingToolCalls[value.output_index] = void 0;
3851
3853
  hasFunctionCall = true;
@@ -3955,11 +3957,6 @@ var OpenAIResponsesLanguageModel = class {
3955
3957
  openai: { itemId: value.item.id }
3956
3958
  }
3957
3959
  });
3958
- } else if (value.item.type === "message") {
3959
- controller.enqueue({
3960
- type: "text-end",
3961
- id: value.item.id
3962
- });
3963
3960
  } else if (value.item.type === "reasoning") {
3964
3961
  const activeReasoningPart = activeReasoning[value.item.id];
3965
3962
  const summaryPartIndices = Object.entries(
@@ -4106,6 +4103,7 @@ var OpenAIResponsesLanguageModel = class {
4106
4103
  serviceTier = value.response.service_tier;
4107
4104
  }
4108
4105
  } else if (isResponseAnnotationAddedChunk(value)) {
4106
+ ongoingAnnotations.push(value.annotation);
4109
4107
  if (value.annotation.type === "url_citation") {
4110
4108
  controller.enqueue({
4111
4109
  type: "source",
@@ -4131,6 +4129,19 @@ var OpenAIResponsesLanguageModel = class {
4131
4129
  } : {}
4132
4130
  });
4133
4131
  }
4132
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type === "message") {
4133
+ controller.enqueue({
4134
+ type: "text-end",
4135
+ id: value.item.id,
4136
+ providerMetadata: {
4137
+ openai: {
4138
+ itemId: value.item.id,
4139
+ ...ongoingAnnotations.length > 0 && {
4140
+ annotations: ongoingAnnotations
4141
+ }
4142
+ }
4143
+ }
4144
+ });
4134
4145
  } else if (isErrorChunk(value)) {
4135
4146
  controller.enqueue({ type: "error", error: value });
4136
4147
  }
@@ -4606,7 +4617,7 @@ var OpenAITranscriptionModel = class {
4606
4617
  };
4607
4618
 
4608
4619
  // src/version.ts
4609
- var VERSION = true ? "2.0.69" : "0.0.0-test";
4620
+ var VERSION = true ? "2.0.70" : "0.0.0-test";
4610
4621
 
4611
4622
  // src/openai-provider.ts
4612
4623
  function createOpenAI(options = {}) {