@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/dist/index.mjs CHANGED
@@ -2856,6 +2856,8 @@ var openaiResponsesChunkSchema = lazySchema15(
2856
2856
  annotation: z17.discriminatedUnion("type", [
2857
2857
  z17.object({
2858
2858
  type: z17.literal("url_citation"),
2859
+ start_index: z17.number(),
2860
+ end_index: z17.number(),
2859
2861
  url: z17.string(),
2860
2862
  title: z17.string()
2861
2863
  }),
@@ -4082,6 +4084,7 @@ var OpenAIResponsesLanguageModel = class {
4082
4084
  const logprobs = [];
4083
4085
  let responseId = null;
4084
4086
  const ongoingToolCalls = {};
4087
+ const ongoingAnnotations = [];
4085
4088
  let hasFunctionCall = false;
4086
4089
  const activeReasoning = {};
4087
4090
  let serviceTier;
@@ -4131,7 +4134,7 @@ var OpenAIResponsesLanguageModel = class {
4131
4134
  controller.enqueue({
4132
4135
  type: "tool-call",
4133
4136
  toolCallId: value.item.id,
4134
- toolName: "web_search",
4137
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
4135
4138
  input: JSON.stringify({}),
4136
4139
  providerExecuted: true
4137
4140
  });
@@ -4190,6 +4193,7 @@ var OpenAIResponsesLanguageModel = class {
4190
4193
  providerExecuted: true
4191
4194
  });
4192
4195
  } else if (value.item.type === "message") {
4196
+ ongoingAnnotations.splice(0, ongoingAnnotations.length);
4193
4197
  controller.enqueue({
4194
4198
  type: "text-start",
4195
4199
  id: value.item.id,
@@ -4215,7 +4219,7 @@ var OpenAIResponsesLanguageModel = class {
4215
4219
  }
4216
4220
  });
4217
4221
  }
4218
- } else if (isResponseOutputItemDoneChunk(value)) {
4222
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type !== "message") {
4219
4223
  if (value.item.type === "function_call") {
4220
4224
  ongoingToolCalls[value.output_index] = void 0;
4221
4225
  hasFunctionCall = true;
@@ -4239,7 +4243,7 @@ var OpenAIResponsesLanguageModel = class {
4239
4243
  controller.enqueue({
4240
4244
  type: "tool-result",
4241
4245
  toolCallId: value.item.id,
4242
- toolName: "web_search",
4246
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
4243
4247
  result: mapWebSearchOutput(value.item.action)
4244
4248
  });
4245
4249
  } else if (value.item.type === "computer_call") {
@@ -4370,11 +4374,6 @@ var OpenAIResponsesLanguageModel = class {
4370
4374
  openai: { itemId: value.item.id }
4371
4375
  }
4372
4376
  });
4373
- } else if (value.item.type === "message") {
4374
- controller.enqueue({
4375
- type: "text-end",
4376
- id: value.item.id
4377
- });
4378
4377
  } else if (value.item.type === "reasoning") {
4379
4378
  const activeReasoningPart = activeReasoning[value.item.id];
4380
4379
  const summaryPartIndices = Object.entries(
@@ -4531,6 +4530,7 @@ var OpenAIResponsesLanguageModel = class {
4531
4530
  serviceTier = value.response.service_tier;
4532
4531
  }
4533
4532
  } else if (isResponseAnnotationAddedChunk(value)) {
4533
+ ongoingAnnotations.push(value.annotation);
4534
4534
  if (value.annotation.type === "url_citation") {
4535
4535
  controller.enqueue({
4536
4536
  type: "source",
@@ -4587,6 +4587,19 @@ var OpenAIResponsesLanguageModel = class {
4587
4587
  }
4588
4588
  });
4589
4589
  }
4590
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type === "message") {
4591
+ controller.enqueue({
4592
+ type: "text-end",
4593
+ id: value.item.id,
4594
+ providerMetadata: {
4595
+ openai: {
4596
+ itemId: value.item.id,
4597
+ ...ongoingAnnotations.length > 0 && {
4598
+ annotations: ongoingAnnotations
4599
+ }
4600
+ }
4601
+ }
4602
+ });
4590
4603
  } else if (isErrorChunk(value)) {
4591
4604
  controller.enqueue({ type: "error", error: value });
4592
4605
  }
@@ -5045,7 +5058,7 @@ var OpenAITranscriptionModel = class {
5045
5058
  };
5046
5059
 
5047
5060
  // src/version.ts
5048
- var VERSION = true ? "3.0.0-beta.61" : "0.0.0-test";
5061
+ var VERSION = true ? "3.0.0-beta.63" : "0.0.0-test";
5049
5062
 
5050
5063
  // src/openai-provider.ts
5051
5064
  function createOpenAI(options = {}) {