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

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.
@@ -4309,6 +4309,7 @@ var OpenAIResponsesLanguageModel = class {
4309
4309
  const logprobs = [];
4310
4310
  let responseId = null;
4311
4311
  const ongoingToolCalls = {};
4312
+ const ongoingAnnotations = [];
4312
4313
  let hasFunctionCall = false;
4313
4314
  const activeReasoning = {};
4314
4315
  let serviceTier;
@@ -4417,6 +4418,7 @@ var OpenAIResponsesLanguageModel = class {
4417
4418
  providerExecuted: true
4418
4419
  });
4419
4420
  } else if (value.item.type === "message") {
4421
+ ongoingAnnotations.splice(0, ongoingAnnotations.length);
4420
4422
  controller.enqueue({
4421
4423
  type: "text-start",
4422
4424
  id: value.item.id,
@@ -4442,7 +4444,7 @@ var OpenAIResponsesLanguageModel = class {
4442
4444
  }
4443
4445
  });
4444
4446
  }
4445
- } else if (isResponseOutputItemDoneChunk(value)) {
4447
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type !== "message") {
4446
4448
  if (value.item.type === "function_call") {
4447
4449
  ongoingToolCalls[value.output_index] = void 0;
4448
4450
  hasFunctionCall = true;
@@ -4597,11 +4599,6 @@ var OpenAIResponsesLanguageModel = class {
4597
4599
  openai: { itemId: value.item.id }
4598
4600
  }
4599
4601
  });
4600
- } else if (value.item.type === "message") {
4601
- controller.enqueue({
4602
- type: "text-end",
4603
- id: value.item.id
4604
- });
4605
4602
  } else if (value.item.type === "reasoning") {
4606
4603
  const activeReasoningPart = activeReasoning[value.item.id];
4607
4604
  const summaryPartIndices = Object.entries(
@@ -4758,6 +4755,7 @@ var OpenAIResponsesLanguageModel = class {
4758
4755
  serviceTier = value.response.service_tier;
4759
4756
  }
4760
4757
  } else if (isResponseAnnotationAddedChunk(value)) {
4758
+ ongoingAnnotations.push(value.annotation);
4761
4759
  if (value.annotation.type === "url_citation") {
4762
4760
  controller.enqueue({
4763
4761
  type: "source",
@@ -4814,6 +4812,19 @@ var OpenAIResponsesLanguageModel = class {
4814
4812
  }
4815
4813
  });
4816
4814
  }
4815
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type === "message") {
4816
+ controller.enqueue({
4817
+ type: "text-end",
4818
+ id: value.item.id,
4819
+ providerMetadata: {
4820
+ openai: {
4821
+ itemId: value.item.id,
4822
+ ...ongoingAnnotations.length > 0 && {
4823
+ annotations: ongoingAnnotations
4824
+ }
4825
+ }
4826
+ }
4827
+ });
4817
4828
  } else if (isErrorChunk(value)) {
4818
4829
  controller.enqueue({ type: "error", error: value });
4819
4830
  }