@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.
@@ -2722,6 +2722,8 @@ var openaiResponsesChunkSchema = lazyValidator11(
2722
2722
  annotation: z14.discriminatedUnion("type", [
2723
2723
  z14.object({
2724
2724
  type: z14.literal("url_citation"),
2725
+ start_index: z14.number(),
2726
+ end_index: z14.number(),
2725
2727
  url: z14.string(),
2726
2728
  title: z14.string()
2727
2729
  }),
@@ -4012,6 +4014,7 @@ var OpenAIResponsesLanguageModel = class {
4012
4014
  const logprobs = [];
4013
4015
  let responseId = null;
4014
4016
  const ongoingToolCalls = {};
4017
+ const ongoingAnnotations = [];
4015
4018
  let hasFunctionCall = false;
4016
4019
  const activeReasoning = {};
4017
4020
  let serviceTier;
@@ -4061,7 +4064,7 @@ var OpenAIResponsesLanguageModel = class {
4061
4064
  controller.enqueue({
4062
4065
  type: "tool-call",
4063
4066
  toolCallId: value.item.id,
4064
- toolName: "web_search",
4067
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
4065
4068
  input: JSON.stringify({}),
4066
4069
  providerExecuted: true
4067
4070
  });
@@ -4112,6 +4115,7 @@ var OpenAIResponsesLanguageModel = class {
4112
4115
  providerExecuted: true
4113
4116
  });
4114
4117
  } else if (value.item.type === "message") {
4118
+ ongoingAnnotations.splice(0, ongoingAnnotations.length);
4115
4119
  controller.enqueue({
4116
4120
  type: "text-start",
4117
4121
  id: value.item.id,
@@ -4137,7 +4141,7 @@ var OpenAIResponsesLanguageModel = class {
4137
4141
  }
4138
4142
  });
4139
4143
  }
4140
- } else if (isResponseOutputItemDoneChunk(value)) {
4144
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type !== "message") {
4141
4145
  if (value.item.type === "function_call") {
4142
4146
  ongoingToolCalls[value.output_index] = void 0;
4143
4147
  hasFunctionCall = true;
@@ -4161,7 +4165,7 @@ var OpenAIResponsesLanguageModel = class {
4161
4165
  controller.enqueue({
4162
4166
  type: "tool-result",
4163
4167
  toolCallId: value.item.id,
4164
- toolName: "web_search",
4168
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
4165
4169
  result: mapWebSearchOutput(value.item.action),
4166
4170
  providerExecuted: true
4167
4171
  });
@@ -4247,11 +4251,6 @@ var OpenAIResponsesLanguageModel = class {
4247
4251
  openai: { itemId: value.item.id }
4248
4252
  }
4249
4253
  });
4250
- } else if (value.item.type === "message") {
4251
- controller.enqueue({
4252
- type: "text-end",
4253
- id: value.item.id
4254
- });
4255
4254
  } else if (value.item.type === "reasoning") {
4256
4255
  const activeReasoningPart = activeReasoning[value.item.id];
4257
4256
  const summaryPartIndices = Object.entries(
@@ -4398,6 +4397,7 @@ var OpenAIResponsesLanguageModel = class {
4398
4397
  serviceTier = value.response.service_tier;
4399
4398
  }
4400
4399
  } else if (isResponseAnnotationAddedChunk(value)) {
4400
+ ongoingAnnotations.push(value.annotation);
4401
4401
  if (value.annotation.type === "url_citation") {
4402
4402
  controller.enqueue({
4403
4403
  type: "source",
@@ -4423,6 +4423,19 @@ var OpenAIResponsesLanguageModel = class {
4423
4423
  } : {}
4424
4424
  });
4425
4425
  }
4426
+ } else if (isResponseOutputItemDoneChunk(value) && value.item.type === "message") {
4427
+ controller.enqueue({
4428
+ type: "text-end",
4429
+ id: value.item.id,
4430
+ providerMetadata: {
4431
+ openai: {
4432
+ itemId: value.item.id,
4433
+ ...ongoingAnnotations.length > 0 && {
4434
+ annotations: ongoingAnnotations
4435
+ }
4436
+ }
4437
+ }
4438
+ });
4426
4439
  } else if (isErrorChunk(value)) {
4427
4440
  controller.enqueue({ type: "error", error: value });
4428
4441
  }
@@ -4551,6 +4564,9 @@ export {
4551
4564
  openaiChatLanguageModelOptions,
4552
4565
  openaiCompletionProviderOptions,
4553
4566
  openaiEmbeddingProviderOptions,
4554
- openaiSpeechProviderOptionsSchema
4567
+ openaiSpeechProviderOptionsSchema,
4568
+ webSearchPreview,
4569
+ webSearchPreviewArgsSchema,
4570
+ webSearchPreviewInputSchema
4555
4571
  };
4556
4572
  //# sourceMappingURL=index.mjs.map