@ai-sdk/openai 2.0.69 → 2.0.71

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
@@ -2684,6 +2684,8 @@ var openaiResponsesChunkSchema = lazyValidator8(
2684
2684
  annotation: z16.discriminatedUnion("type", [
2685
2685
  z16.object({
2686
2686
  type: z16.literal("url_citation"),
2687
+ start_index: z16.number(),
2688
+ end_index: z16.number(),
2687
2689
  url: z16.string(),
2688
2690
  title: z16.string()
2689
2691
  }),
@@ -3720,6 +3722,7 @@ var OpenAIResponsesLanguageModel = class {
3720
3722
  const logprobs = [];
3721
3723
  let responseId = null;
3722
3724
  const ongoingToolCalls = {};
3725
+ const ongoingAnnotations = [];
3723
3726
  let hasFunctionCall = false;
3724
3727
  const activeReasoning = {};
3725
3728
  let serviceTier;
@@ -3769,7 +3772,7 @@ var OpenAIResponsesLanguageModel = class {
3769
3772
  controller.enqueue({
3770
3773
  type: "tool-call",
3771
3774
  toolCallId: value.item.id,
3772
- toolName: "web_search",
3775
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
3773
3776
  input: JSON.stringify({}),
3774
3777
  providerExecuted: true
3775
3778
  });
@@ -3820,6 +3823,7 @@ var OpenAIResponsesLanguageModel = class {
3820
3823
  providerExecuted: true
3821
3824
  });
3822
3825
  } else if (value.item.type === "message") {
3826
+ ongoingAnnotations.splice(0, ongoingAnnotations.length);
3823
3827
  controller.enqueue({
3824
3828
  type: "text-start",
3825
3829
  id: value.item.id,
@@ -3845,7 +3849,7 @@ var OpenAIResponsesLanguageModel = class {
3845
3849
  }
3846
3850
  });
3847
3851
  }
3848
- } else if (isResponseOutputItemDoneChunk(value)) {
3852
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type !== "message") {
3849
3853
  if (value.item.type === "function_call") {
3850
3854
  ongoingToolCalls[value.output_index] = void 0;
3851
3855
  hasFunctionCall = true;
@@ -3869,7 +3873,7 @@ var OpenAIResponsesLanguageModel = class {
3869
3873
  controller.enqueue({
3870
3874
  type: "tool-result",
3871
3875
  toolCallId: value.item.id,
3872
- toolName: "web_search",
3876
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
3873
3877
  result: mapWebSearchOutput(value.item.action),
3874
3878
  providerExecuted: true
3875
3879
  });
@@ -3955,11 +3959,6 @@ var OpenAIResponsesLanguageModel = class {
3955
3959
  openai: { itemId: value.item.id }
3956
3960
  }
3957
3961
  });
3958
- } else if (value.item.type === "message") {
3959
- controller.enqueue({
3960
- type: "text-end",
3961
- id: value.item.id
3962
- });
3963
3962
  } else if (value.item.type === "reasoning") {
3964
3963
  const activeReasoningPart = activeReasoning[value.item.id];
3965
3964
  const summaryPartIndices = Object.entries(
@@ -4106,6 +4105,7 @@ var OpenAIResponsesLanguageModel = class {
4106
4105
  serviceTier = value.response.service_tier;
4107
4106
  }
4108
4107
  } else if (isResponseAnnotationAddedChunk(value)) {
4108
+ ongoingAnnotations.push(value.annotation);
4109
4109
  if (value.annotation.type === "url_citation") {
4110
4110
  controller.enqueue({
4111
4111
  type: "source",
@@ -4131,6 +4131,19 @@ var OpenAIResponsesLanguageModel = class {
4131
4131
  } : {}
4132
4132
  });
4133
4133
  }
4134
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type === "message") {
4135
+ controller.enqueue({
4136
+ type: "text-end",
4137
+ id: value.item.id,
4138
+ providerMetadata: {
4139
+ openai: {
4140
+ itemId: value.item.id,
4141
+ ...ongoingAnnotations.length > 0 && {
4142
+ annotations: ongoingAnnotations
4143
+ }
4144
+ }
4145
+ }
4146
+ });
4134
4147
  } else if (isErrorChunk(value)) {
4135
4148
  controller.enqueue({ type: "error", error: value });
4136
4149
  }
@@ -4606,7 +4619,7 @@ var OpenAITranscriptionModel = class {
4606
4619
  };
4607
4620
 
4608
4621
  // src/version.ts
4609
- var VERSION = true ? "2.0.69" : "0.0.0-test";
4622
+ var VERSION = true ? "2.0.71" : "0.0.0-test";
4610
4623
 
4611
4624
  // src/openai-provider.ts
4612
4625
  function createOpenAI(options = {}) {