@ai-sdk/openai 3.0.0-beta.62 → 3.0.0-beta.64

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.
@@ -4348,6 +4348,7 @@ var OpenAIResponsesLanguageModel = class {
4348
4348
  const logprobs = [];
4349
4349
  let responseId = null;
4350
4350
  const ongoingToolCalls = {};
4351
+ const ongoingAnnotations = [];
4351
4352
  let hasFunctionCall = false;
4352
4353
  const activeReasoning = {};
4353
4354
  let serviceTier;
@@ -4456,6 +4457,7 @@ var OpenAIResponsesLanguageModel = class {
4456
4457
  providerExecuted: true
4457
4458
  });
4458
4459
  } else if (value.item.type === "message") {
4460
+ ongoingAnnotations.splice(0, ongoingAnnotations.length);
4459
4461
  controller.enqueue({
4460
4462
  type: "text-start",
4461
4463
  id: value.item.id,
@@ -4481,7 +4483,7 @@ var OpenAIResponsesLanguageModel = class {
4481
4483
  }
4482
4484
  });
4483
4485
  }
4484
- } else if (isResponseOutputItemDoneChunk(value)) {
4486
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type !== "message") {
4485
4487
  if (value.item.type === "function_call") {
4486
4488
  ongoingToolCalls[value.output_index] = void 0;
4487
4489
  hasFunctionCall = true;
@@ -4636,11 +4638,6 @@ var OpenAIResponsesLanguageModel = class {
4636
4638
  openai: { itemId: value.item.id }
4637
4639
  }
4638
4640
  });
4639
- } else if (value.item.type === "message") {
4640
- controller.enqueue({
4641
- type: "text-end",
4642
- id: value.item.id
4643
- });
4644
4641
  } else if (value.item.type === "reasoning") {
4645
4642
  const activeReasoningPart = activeReasoning[value.item.id];
4646
4643
  const summaryPartIndices = Object.entries(
@@ -4797,6 +4794,7 @@ var OpenAIResponsesLanguageModel = class {
4797
4794
  serviceTier = value.response.service_tier;
4798
4795
  }
4799
4796
  } else if (isResponseAnnotationAddedChunk(value)) {
4797
+ ongoingAnnotations.push(value.annotation);
4800
4798
  if (value.annotation.type === "url_citation") {
4801
4799
  controller.enqueue({
4802
4800
  type: "source",
@@ -4853,6 +4851,19 @@ var OpenAIResponsesLanguageModel = class {
4853
4851
  }
4854
4852
  });
4855
4853
  }
4854
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type === "message") {
4855
+ controller.enqueue({
4856
+ type: "text-end",
4857
+ id: value.item.id,
4858
+ providerMetadata: {
4859
+ openai: {
4860
+ itemId: value.item.id,
4861
+ ...ongoingAnnotations.length > 0 && {
4862
+ annotations: ongoingAnnotations
4863
+ }
4864
+ }
4865
+ }
4866
+ });
4856
4867
  } else if (isErrorChunk(value)) {
4857
4868
  controller.enqueue({ type: "error", error: value });
4858
4869
  }