@ai-sdk/openai 3.0.0-beta.61 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.0-beta.63
4
+
5
+ ### Patch Changes
6
+
7
+ - 423ba08: Set the annotations from the Responses API to doStream
8
+
9
+ ## 3.0.0-beta.62
10
+
11
+ ### Patch Changes
12
+
13
+ - 64aa48f: Azure OpenAI enabled web-search-preview
14
+
3
15
  ## 3.0.0-beta.61
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2801,6 +2801,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazySchema)(
2801
2801
  annotation: import_v417.z.discriminatedUnion("type", [
2802
2802
  import_v417.z.object({
2803
2803
  type: import_v417.z.literal("url_citation"),
2804
+ start_index: import_v417.z.number(),
2805
+ end_index: import_v417.z.number(),
2804
2806
  url: import_v417.z.string(),
2805
2807
  title: import_v417.z.string()
2806
2808
  }),
@@ -4025,6 +4027,7 @@ var OpenAIResponsesLanguageModel = class {
4025
4027
  const logprobs = [];
4026
4028
  let responseId = null;
4027
4029
  const ongoingToolCalls = {};
4030
+ const ongoingAnnotations = [];
4028
4031
  let hasFunctionCall = false;
4029
4032
  const activeReasoning = {};
4030
4033
  let serviceTier;
@@ -4074,7 +4077,7 @@ var OpenAIResponsesLanguageModel = class {
4074
4077
  controller.enqueue({
4075
4078
  type: "tool-call",
4076
4079
  toolCallId: value.item.id,
4077
- toolName: "web_search",
4080
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
4078
4081
  input: JSON.stringify({}),
4079
4082
  providerExecuted: true
4080
4083
  });
@@ -4133,6 +4136,7 @@ var OpenAIResponsesLanguageModel = class {
4133
4136
  providerExecuted: true
4134
4137
  });
4135
4138
  } else if (value.item.type === "message") {
4139
+ ongoingAnnotations.splice(0, ongoingAnnotations.length);
4136
4140
  controller.enqueue({
4137
4141
  type: "text-start",
4138
4142
  id: value.item.id,
@@ -4158,7 +4162,7 @@ var OpenAIResponsesLanguageModel = class {
4158
4162
  }
4159
4163
  });
4160
4164
  }
4161
- } else if (isResponseOutputItemDoneChunk(value)) {
4165
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type !== "message") {
4162
4166
  if (value.item.type === "function_call") {
4163
4167
  ongoingToolCalls[value.output_index] = void 0;
4164
4168
  hasFunctionCall = true;
@@ -4182,7 +4186,7 @@ var OpenAIResponsesLanguageModel = class {
4182
4186
  controller.enqueue({
4183
4187
  type: "tool-result",
4184
4188
  toolCallId: value.item.id,
4185
- toolName: "web_search",
4189
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
4186
4190
  result: mapWebSearchOutput(value.item.action)
4187
4191
  });
4188
4192
  } else if (value.item.type === "computer_call") {
@@ -4313,11 +4317,6 @@ var OpenAIResponsesLanguageModel = class {
4313
4317
  openai: { itemId: value.item.id }
4314
4318
  }
4315
4319
  });
4316
- } else if (value.item.type === "message") {
4317
- controller.enqueue({
4318
- type: "text-end",
4319
- id: value.item.id
4320
- });
4321
4320
  } else if (value.item.type === "reasoning") {
4322
4321
  const activeReasoningPart = activeReasoning[value.item.id];
4323
4322
  const summaryPartIndices = Object.entries(
@@ -4474,6 +4473,7 @@ var OpenAIResponsesLanguageModel = class {
4474
4473
  serviceTier = value.response.service_tier;
4475
4474
  }
4476
4475
  } else if (isResponseAnnotationAddedChunk(value)) {
4476
+ ongoingAnnotations.push(value.annotation);
4477
4477
  if (value.annotation.type === "url_citation") {
4478
4478
  controller.enqueue({
4479
4479
  type: "source",
@@ -4530,6 +4530,19 @@ var OpenAIResponsesLanguageModel = class {
4530
4530
  }
4531
4531
  });
4532
4532
  }
4533
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type === "message") {
4534
+ controller.enqueue({
4535
+ type: "text-end",
4536
+ id: value.item.id,
4537
+ providerMetadata: {
4538
+ openai: {
4539
+ itemId: value.item.id,
4540
+ ...ongoingAnnotations.length > 0 && {
4541
+ annotations: ongoingAnnotations
4542
+ }
4543
+ }
4544
+ }
4545
+ });
4533
4546
  } else if (isErrorChunk(value)) {
4534
4547
  controller.enqueue({ type: "error", error: value });
4535
4548
  }
@@ -4976,7 +4989,7 @@ var OpenAITranscriptionModel = class {
4976
4989
  };
4977
4990
 
4978
4991
  // src/version.ts
4979
- var VERSION = true ? "3.0.0-beta.61" : "0.0.0-test";
4992
+ var VERSION = true ? "3.0.0-beta.63" : "0.0.0-test";
4980
4993
 
4981
4994
  // src/openai-provider.ts
4982
4995
  function createOpenAI(options = {}) {