@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.
@@ -2775,6 +2775,8 @@ var openaiResponsesChunkSchema = lazySchema12(
2775
2775
  annotation: z14.discriminatedUnion("type", [
2776
2776
  z14.object({
2777
2777
  type: z14.literal("url_citation"),
2778
+ start_index: z14.number(),
2779
+ end_index: z14.number(),
2778
2780
  url: z14.string(),
2779
2781
  title: z14.string()
2780
2782
  }),
@@ -4346,6 +4348,7 @@ var OpenAIResponsesLanguageModel = class {
4346
4348
  const logprobs = [];
4347
4349
  let responseId = null;
4348
4350
  const ongoingToolCalls = {};
4351
+ const ongoingAnnotations = [];
4349
4352
  let hasFunctionCall = false;
4350
4353
  const activeReasoning = {};
4351
4354
  let serviceTier;
@@ -4395,7 +4398,7 @@ var OpenAIResponsesLanguageModel = class {
4395
4398
  controller.enqueue({
4396
4399
  type: "tool-call",
4397
4400
  toolCallId: value.item.id,
4398
- toolName: "web_search",
4401
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
4399
4402
  input: JSON.stringify({}),
4400
4403
  providerExecuted: true
4401
4404
  });
@@ -4454,6 +4457,7 @@ var OpenAIResponsesLanguageModel = class {
4454
4457
  providerExecuted: true
4455
4458
  });
4456
4459
  } else if (value.item.type === "message") {
4460
+ ongoingAnnotations.splice(0, ongoingAnnotations.length);
4457
4461
  controller.enqueue({
4458
4462
  type: "text-start",
4459
4463
  id: value.item.id,
@@ -4479,7 +4483,7 @@ var OpenAIResponsesLanguageModel = class {
4479
4483
  }
4480
4484
  });
4481
4485
  }
4482
- } else if (isResponseOutputItemDoneChunk(value)) {
4486
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type !== "message") {
4483
4487
  if (value.item.type === "function_call") {
4484
4488
  ongoingToolCalls[value.output_index] = void 0;
4485
4489
  hasFunctionCall = true;
@@ -4503,7 +4507,7 @@ var OpenAIResponsesLanguageModel = class {
4503
4507
  controller.enqueue({
4504
4508
  type: "tool-result",
4505
4509
  toolCallId: value.item.id,
4506
- toolName: "web_search",
4510
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
4507
4511
  result: mapWebSearchOutput(value.item.action)
4508
4512
  });
4509
4513
  } else if (value.item.type === "computer_call") {
@@ -4634,11 +4638,6 @@ var OpenAIResponsesLanguageModel = class {
4634
4638
  openai: { itemId: value.item.id }
4635
4639
  }
4636
4640
  });
4637
- } else if (value.item.type === "message") {
4638
- controller.enqueue({
4639
- type: "text-end",
4640
- id: value.item.id
4641
- });
4642
4641
  } else if (value.item.type === "reasoning") {
4643
4642
  const activeReasoningPart = activeReasoning[value.item.id];
4644
4643
  const summaryPartIndices = Object.entries(
@@ -4795,6 +4794,7 @@ var OpenAIResponsesLanguageModel = class {
4795
4794
  serviceTier = value.response.service_tier;
4796
4795
  }
4797
4796
  } else if (isResponseAnnotationAddedChunk(value)) {
4797
+ ongoingAnnotations.push(value.annotation);
4798
4798
  if (value.annotation.type === "url_citation") {
4799
4799
  controller.enqueue({
4800
4800
  type: "source",
@@ -4851,6 +4851,19 @@ var OpenAIResponsesLanguageModel = class {
4851
4851
  }
4852
4852
  });
4853
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
+ });
4854
4867
  } else if (isErrorChunk(value)) {
4855
4868
  controller.enqueue({ type: "error", error: value });
4856
4869
  }
@@ -4968,6 +4981,9 @@ export {
4968
4981
  openaiChatLanguageModelOptions,
4969
4982
  openaiCompletionProviderOptions,
4970
4983
  openaiEmbeddingProviderOptions,
4971
- openaiSpeechProviderOptionsSchema
4984
+ openaiSpeechProviderOptionsSchema,
4985
+ webSearchPreview,
4986
+ webSearchPreviewArgsSchema,
4987
+ webSearchPreviewInputSchema
4972
4988
  };
4973
4989
  //# sourceMappingURL=index.mjs.map