@ai-sdk/openai 3.0.0 → 3.0.1

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
@@ -2358,7 +2358,7 @@ var mcpOutputSchema = lazySchema16(
2358
2358
  serverLabel: z17.string(),
2359
2359
  name: z17.string(),
2360
2360
  arguments: z17.string(),
2361
- output: z17.string().nullable().optional(),
2361
+ output: z17.string().nullish(),
2362
2362
  error: z17.union([z17.string(), jsonValueSchema]).optional()
2363
2363
  })
2364
2364
  )
@@ -2546,9 +2546,10 @@ async function convertToOpenAIResponsesInput({
2546
2546
  hasShellTool = false,
2547
2547
  hasApplyPatchTool = false
2548
2548
  }) {
2549
- var _a, _b, _c, _d, _e;
2549
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2550
2550
  const input = [];
2551
2551
  const warnings = [];
2552
+ const processedApprovalIds = /* @__PURE__ */ new Set();
2552
2553
  for (const { role, content } of prompt) {
2553
2554
  switch (role) {
2554
2555
  case "system": {
@@ -2639,10 +2640,13 @@ async function convertToOpenAIResponsesInput({
2639
2640
  break;
2640
2641
  }
2641
2642
  case "tool-call": {
2643
+ const id = (_g = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.itemId) != null ? _g : (_f = (_e = part.providerMetadata) == null ? void 0 : _e.openai) == null ? void 0 : _f.itemId;
2642
2644
  if (part.providerExecuted) {
2645
+ if (store && id != null) {
2646
+ input.push({ type: "item_reference", id });
2647
+ }
2643
2648
  break;
2644
2649
  }
2645
- const id = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.itemId;
2646
2650
  if (store && id != null) {
2647
2651
  input.push({ type: "item_reference", id });
2648
2652
  break;
@@ -2699,8 +2703,12 @@ async function convertToOpenAIResponsesInput({
2699
2703
  }
2700
2704
  // assistant tool result parts are from provider-executed tools:
2701
2705
  case "tool-result": {
2706
+ if (part.output.type === "execution-denied" || part.output.type === "json" && typeof part.output.value === "object" && part.output.value != null && "type" in part.output.value && part.output.value.type === "execution-denied") {
2707
+ break;
2708
+ }
2702
2709
  if (store) {
2703
- input.push({ type: "item_reference", id: part.toolCallId });
2710
+ const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h.openai) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2711
+ input.push({ type: "item_reference", id: itemId });
2704
2712
  } else {
2705
2713
  warnings.push({
2706
2714
  type: "other",
@@ -2770,9 +2778,31 @@ async function convertToOpenAIResponsesInput({
2770
2778
  case "tool": {
2771
2779
  for (const part of content) {
2772
2780
  if (part.type === "tool-approval-response") {
2781
+ const approvalResponse = part;
2782
+ if (processedApprovalIds.has(approvalResponse.approvalId)) {
2783
+ continue;
2784
+ }
2785
+ processedApprovalIds.add(approvalResponse.approvalId);
2786
+ if (store) {
2787
+ input.push({
2788
+ type: "item_reference",
2789
+ id: approvalResponse.approvalId
2790
+ });
2791
+ }
2792
+ input.push({
2793
+ type: "mcp_approval_response",
2794
+ approval_request_id: approvalResponse.approvalId,
2795
+ approve: approvalResponse.approved
2796
+ });
2773
2797
  continue;
2774
2798
  }
2775
2799
  const output = part.output;
2800
+ if (output.type === "execution-denied") {
2801
+ const approvalId = (_l = (_k = output.providerOptions) == null ? void 0 : _k.openai) == null ? void 0 : _l.approvalId;
2802
+ if (approvalId) {
2803
+ continue;
2804
+ }
2805
+ }
2776
2806
  const resolvedToolName = toolNameMapping.toProviderToolName(
2777
2807
  part.toolName
2778
2808
  );
@@ -2827,7 +2857,7 @@ async function convertToOpenAIResponsesInput({
2827
2857
  contentValue = output.value;
2828
2858
  break;
2829
2859
  case "execution-denied":
2830
- contentValue = (_e = output.reason) != null ? _e : "Tool execution denied.";
2860
+ contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
2831
2861
  break;
2832
2862
  case "json":
2833
2863
  case "error-json":
@@ -3002,7 +3032,8 @@ var openaiResponsesChunkSchema = lazySchema17(
3002
3032
  z19.object({
3003
3033
  type: z19.literal("mcp_call"),
3004
3034
  id: z19.string(),
3005
- status: z19.string()
3035
+ status: z19.string(),
3036
+ approval_request_id: z19.string().nullish()
3006
3037
  }),
3007
3038
  z19.object({
3008
3039
  type: z19.literal("mcp_list_tools"),
@@ -3159,7 +3190,8 @@ var openaiResponsesChunkSchema = lazySchema17(
3159
3190
  code: z19.union([z19.number(), z19.string()]).optional(),
3160
3191
  message: z19.string().optional()
3161
3192
  }).loose()
3162
- ]).nullish()
3193
+ ]).nullish(),
3194
+ approval_request_id: z19.string().nullish()
3163
3195
  }),
3164
3196
  z19.object({
3165
3197
  type: z19.literal("mcp_list_tools"),
@@ -3188,7 +3220,7 @@ var openaiResponsesChunkSchema = lazySchema17(
3188
3220
  server_label: z19.string(),
3189
3221
  name: z19.string(),
3190
3222
  arguments: z19.string(),
3191
- approval_request_id: z19.string()
3223
+ approval_request_id: z19.string().optional()
3192
3224
  }),
3193
3225
  z19.object({
3194
3226
  type: z19.literal("apply_patch_call"),
@@ -3511,7 +3543,8 @@ var openaiResponsesResponseSchema = lazySchema17(
3511
3543
  code: z19.union([z19.number(), z19.string()]).optional(),
3512
3544
  message: z19.string().optional()
3513
3545
  }).loose()
3514
- ]).nullish()
3546
+ ]).nullish(),
3547
+ approval_request_id: z19.string().nullish()
3515
3548
  }),
3516
3549
  z19.object({
3517
3550
  type: z19.literal("mcp_list_tools"),
@@ -3540,7 +3573,7 @@ var openaiResponsesResponseSchema = lazySchema17(
3540
3573
  server_label: z19.string(),
3541
3574
  name: z19.string(),
3542
3575
  arguments: z19.string(),
3543
- approval_request_id: z19.string()
3576
+ approval_request_id: z19.string().optional()
3544
3577
  }),
3545
3578
  z19.object({
3546
3579
  type: z19.literal("apply_patch_call"),
@@ -3943,6 +3976,11 @@ async function prepareResponsesTools({
3943
3976
  value: tool.args,
3944
3977
  schema: mcpArgsSchema
3945
3978
  });
3979
+ const mapApprovalFilter = (filter) => ({
3980
+ tool_names: filter.toolNames
3981
+ });
3982
+ const requireApproval = args.requireApproval;
3983
+ const requireApprovalParam = requireApproval == null ? void 0 : typeof requireApproval === "string" ? requireApproval : requireApproval.never != null ? { never: mapApprovalFilter(requireApproval.never) } : void 0;
3946
3984
  openaiTools2.push({
3947
3985
  type: "mcp",
3948
3986
  server_label: args.serverLabel,
@@ -3953,7 +3991,7 @@ async function prepareResponsesTools({
3953
3991
  authorization: args.authorization,
3954
3992
  connector_id: args.connectorId,
3955
3993
  headers: args.headers,
3956
- require_approval: "never",
3994
+ require_approval: requireApprovalParam != null ? requireApprovalParam : "never",
3957
3995
  server_description: args.serverDescription,
3958
3996
  server_url: args.serverUrl
3959
3997
  });
@@ -3995,6 +4033,21 @@ async function prepareResponsesTools({
3995
4033
  }
3996
4034
 
3997
4035
  // src/responses/openai-responses-language-model.ts
4036
+ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
4037
+ var _a, _b;
4038
+ const mapping = {};
4039
+ for (const message of prompt) {
4040
+ if (message.role !== "assistant") continue;
4041
+ for (const part of message.content) {
4042
+ if (part.type !== "tool-call") continue;
4043
+ const approvalRequestId = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.approvalRequestId;
4044
+ if (approvalRequestId != null) {
4045
+ mapping[approvalRequestId] = part.toolCallId;
4046
+ }
4047
+ }
4048
+ }
4049
+ return mapping;
4050
+ }
3998
4051
  var OpenAIResponsesLanguageModel = class {
3999
4052
  constructor(modelId, config) {
4000
4053
  this.specificationVersion = "v3";
@@ -4230,7 +4283,7 @@ var OpenAIResponsesLanguageModel = class {
4230
4283
  };
4231
4284
  }
4232
4285
  async doGenerate(options) {
4233
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
4286
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E;
4234
4287
  const {
4235
4288
  args: body,
4236
4289
  warnings,
@@ -4242,6 +4295,7 @@ var OpenAIResponsesLanguageModel = class {
4242
4295
  modelId: this.modelId
4243
4296
  });
4244
4297
  const providerKey = this.config.provider.replace(".responses", "");
4298
+ const approvalRequestIdToDummyToolCallIdFromPrompt = extractApprovalRequestIdToToolCallIdMapping(options.prompt);
4245
4299
  const {
4246
4300
  responseHeaders,
4247
4301
  value: response,
@@ -4458,17 +4512,20 @@ var OpenAIResponsesLanguageModel = class {
4458
4512
  break;
4459
4513
  }
4460
4514
  case "mcp_call": {
4515
+ const toolCallId = part.approval_request_id != null ? (_v = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _v : part.id : part.id;
4516
+ const toolName = `mcp.${part.name}`;
4461
4517
  content.push({
4462
4518
  type: "tool-call",
4463
- toolCallId: part.id,
4464
- toolName: toolNameMapping.toCustomToolName("mcp"),
4465
- input: JSON.stringify({}),
4466
- providerExecuted: true
4519
+ toolCallId,
4520
+ toolName,
4521
+ input: part.arguments,
4522
+ providerExecuted: true,
4523
+ dynamic: true
4467
4524
  });
4468
4525
  content.push({
4469
4526
  type: "tool-result",
4470
- toolCallId: part.id,
4471
- toolName: toolNameMapping.toCustomToolName("mcp"),
4527
+ toolCallId,
4528
+ toolName,
4472
4529
  result: {
4473
4530
  type: "call",
4474
4531
  serverLabel: part.server_label,
@@ -4476,6 +4533,11 @@ var OpenAIResponsesLanguageModel = class {
4476
4533
  arguments: part.arguments,
4477
4534
  ...part.output != null ? { output: part.output } : {},
4478
4535
  ...part.error != null ? { error: part.error } : {}
4536
+ },
4537
+ providerMetadata: {
4538
+ [providerKey]: {
4539
+ itemId: part.id
4540
+ }
4479
4541
  }
4480
4542
  });
4481
4543
  break;
@@ -4484,6 +4546,22 @@ var OpenAIResponsesLanguageModel = class {
4484
4546
  break;
4485
4547
  }
4486
4548
  case "mcp_approval_request": {
4549
+ const approvalRequestId = (_w = part.approval_request_id) != null ? _w : part.id;
4550
+ const dummyToolCallId = (_z = (_y = (_x = this.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : generateId2();
4551
+ const toolName = `mcp.${part.name}`;
4552
+ content.push({
4553
+ type: "tool-call",
4554
+ toolCallId: dummyToolCallId,
4555
+ toolName,
4556
+ input: part.arguments,
4557
+ providerExecuted: true,
4558
+ dynamic: true
4559
+ });
4560
+ content.push({
4561
+ type: "tool-approval-request",
4562
+ approvalId: approvalRequestId,
4563
+ toolCallId: dummyToolCallId
4564
+ });
4487
4565
  break;
4488
4566
  }
4489
4567
  case "computer_call": {
@@ -4519,13 +4597,13 @@ var OpenAIResponsesLanguageModel = class {
4519
4597
  toolName: toolNameMapping.toCustomToolName("file_search"),
4520
4598
  result: {
4521
4599
  queries: part.queries,
4522
- results: (_w = (_v = part.results) == null ? void 0 : _v.map((result) => ({
4600
+ results: (_B = (_A = part.results) == null ? void 0 : _A.map((result) => ({
4523
4601
  attributes: result.attributes,
4524
4602
  fileId: result.file_id,
4525
4603
  filename: result.filename,
4526
4604
  score: result.score,
4527
4605
  text: result.text
4528
- }))) != null ? _w : null
4606
+ }))) != null ? _B : null
4529
4607
  }
4530
4608
  });
4531
4609
  break;
@@ -4584,10 +4662,10 @@ var OpenAIResponsesLanguageModel = class {
4584
4662
  content,
4585
4663
  finishReason: {
4586
4664
  unified: mapOpenAIResponseFinishReason({
4587
- finishReason: (_x = response.incomplete_details) == null ? void 0 : _x.reason,
4665
+ finishReason: (_C = response.incomplete_details) == null ? void 0 : _C.reason,
4588
4666
  hasFunctionCall
4589
4667
  }),
4590
- raw: (_z = (_y = response.incomplete_details) == null ? void 0 : _y.reason) != null ? _z : void 0
4668
+ raw: (_E = (_D = response.incomplete_details) == null ? void 0 : _D.reason) != null ? _E : void 0
4591
4669
  },
4592
4670
  usage: convertOpenAIResponsesUsage(usage),
4593
4671
  request: { body },
@@ -4629,6 +4707,8 @@ var OpenAIResponsesLanguageModel = class {
4629
4707
  });
4630
4708
  const self = this;
4631
4709
  const providerKey = this.config.provider.replace(".responses", "");
4710
+ const approvalRequestIdToDummyToolCallIdFromPrompt = extractApprovalRequestIdToToolCallIdMapping(options.prompt);
4711
+ const approvalRequestIdToDummyToolCallIdFromStream = /* @__PURE__ */ new Map();
4632
4712
  let finishReason = {
4633
4713
  unified: "other",
4634
4714
  raw: void 0
@@ -4648,7 +4728,7 @@ var OpenAIResponsesLanguageModel = class {
4648
4728
  controller.enqueue({ type: "stream-start", warnings });
4649
4729
  },
4650
4730
  transform(chunk, controller) {
4651
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C;
4731
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J;
4652
4732
  if (options.includeRawChunks) {
4653
4733
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
4654
4734
  }
@@ -4744,13 +4824,6 @@ var OpenAIResponsesLanguageModel = class {
4744
4824
  providerExecuted: true
4745
4825
  });
4746
4826
  } else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
4747
- controller.enqueue({
4748
- type: "tool-call",
4749
- toolCallId: value.item.id,
4750
- toolName: toolNameMapping.toCustomToolName("mcp"),
4751
- input: "{}",
4752
- providerExecuted: true
4753
- });
4754
4827
  } else if (value.item.type === "apply_patch_call") {
4755
4828
  const { call_id: callId, operation } = value.item;
4756
4829
  ongoingToolCalls[value.output_index] = {
@@ -4922,10 +4995,23 @@ var OpenAIResponsesLanguageModel = class {
4922
4995
  });
4923
4996
  } else if (value.item.type === "mcp_call") {
4924
4997
  ongoingToolCalls[value.output_index] = void 0;
4998
+ const approvalRequestId = (_d = value.item.approval_request_id) != null ? _d : void 0;
4999
+ const aliasedToolCallId = approvalRequestId != null ? (_f = (_e = approvalRequestIdToDummyToolCallIdFromStream.get(
5000
+ approvalRequestId
5001
+ )) != null ? _e : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _f : value.item.id : value.item.id;
5002
+ const toolName = `mcp.${value.item.name}`;
5003
+ controller.enqueue({
5004
+ type: "tool-call",
5005
+ toolCallId: aliasedToolCallId,
5006
+ toolName,
5007
+ input: value.item.arguments,
5008
+ providerExecuted: true,
5009
+ dynamic: true
5010
+ });
4925
5011
  controller.enqueue({
4926
5012
  type: "tool-result",
4927
- toolCallId: value.item.id,
4928
- toolName: toolNameMapping.toCustomToolName("mcp"),
5013
+ toolCallId: aliasedToolCallId,
5014
+ toolName,
4929
5015
  result: {
4930
5016
  type: "call",
4931
5017
  serverLabel: value.item.server_label,
@@ -4933,6 +5019,11 @@ var OpenAIResponsesLanguageModel = class {
4933
5019
  arguments: value.item.arguments,
4934
5020
  ...value.item.output != null ? { output: value.item.output } : {},
4935
5021
  ...value.item.error != null ? { error: value.item.error } : {}
5022
+ },
5023
+ providerMetadata: {
5024
+ [providerKey]: {
5025
+ itemId: value.item.id
5026
+ }
4936
5027
  }
4937
5028
  });
4938
5029
  } else if (value.item.type === "mcp_list_tools") {
@@ -4977,6 +5068,26 @@ var OpenAIResponsesLanguageModel = class {
4977
5068
  ongoingToolCalls[value.output_index] = void 0;
4978
5069
  } else if (value.item.type === "mcp_approval_request") {
4979
5070
  ongoingToolCalls[value.output_index] = void 0;
5071
+ const dummyToolCallId = (_i = (_h = (_g = self.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2();
5072
+ const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : value.item.id;
5073
+ approvalRequestIdToDummyToolCallIdFromStream.set(
5074
+ approvalRequestId,
5075
+ dummyToolCallId
5076
+ );
5077
+ const toolName = `mcp.${value.item.name}`;
5078
+ controller.enqueue({
5079
+ type: "tool-call",
5080
+ toolCallId: dummyToolCallId,
5081
+ toolName,
5082
+ input: value.item.arguments,
5083
+ providerExecuted: true,
5084
+ dynamic: true
5085
+ });
5086
+ controller.enqueue({
5087
+ type: "tool-approval-request",
5088
+ approvalId: approvalRequestId,
5089
+ toolCallId: dummyToolCallId
5090
+ });
4980
5091
  } else if (value.item.type === "local_shell_call") {
4981
5092
  ongoingToolCalls[value.output_index] = void 0;
4982
5093
  controller.enqueue({
@@ -5026,7 +5137,7 @@ var OpenAIResponsesLanguageModel = class {
5026
5137
  providerMetadata: {
5027
5138
  [providerKey]: {
5028
5139
  itemId: value.item.id,
5029
- reasoningEncryptedContent: (_d = value.item.encrypted_content) != null ? _d : null
5140
+ reasoningEncryptedContent: (_k = value.item.encrypted_content) != null ? _k : null
5030
5141
  }
5031
5142
  }
5032
5143
  });
@@ -5130,7 +5241,7 @@ var OpenAIResponsesLanguageModel = class {
5130
5241
  id: value.item_id,
5131
5242
  delta: value.delta
5132
5243
  });
5133
- if (((_f = (_e = options.providerOptions) == null ? void 0 : _e.openai) == null ? void 0 : _f.logprobs) && value.logprobs) {
5244
+ if (((_m = (_l = options.providerOptions) == null ? void 0 : _l.openai) == null ? void 0 : _m.logprobs) && value.logprobs) {
5134
5245
  logprobs.push(value.logprobs);
5135
5246
  }
5136
5247
  } else if (value.type === "response.reasoning_summary_part.added") {
@@ -5157,7 +5268,7 @@ var OpenAIResponsesLanguageModel = class {
5157
5268
  providerMetadata: {
5158
5269
  [providerKey]: {
5159
5270
  itemId: value.item_id,
5160
- reasoningEncryptedContent: (_h = (_g = activeReasoning[value.item_id]) == null ? void 0 : _g.encryptedContent) != null ? _h : null
5271
+ reasoningEncryptedContent: (_o = (_n = activeReasoning[value.item_id]) == null ? void 0 : _n.encryptedContent) != null ? _o : null
5161
5272
  }
5162
5273
  }
5163
5274
  });
@@ -5189,10 +5300,10 @@ var OpenAIResponsesLanguageModel = class {
5189
5300
  } else if (isResponseFinishedChunk(value)) {
5190
5301
  finishReason = {
5191
5302
  unified: mapOpenAIResponseFinishReason({
5192
- finishReason: (_i = value.response.incomplete_details) == null ? void 0 : _i.reason,
5303
+ finishReason: (_p = value.response.incomplete_details) == null ? void 0 : _p.reason,
5193
5304
  hasFunctionCall
5194
5305
  }),
5195
- raw: (_k = (_j = value.response.incomplete_details) == null ? void 0 : _j.reason) != null ? _k : void 0
5306
+ raw: (_r = (_q = value.response.incomplete_details) == null ? void 0 : _q.reason) != null ? _r : void 0
5196
5307
  };
5197
5308
  usage = value.response.usage;
5198
5309
  if (typeof value.response.service_tier === "string") {
@@ -5204,7 +5315,7 @@ var OpenAIResponsesLanguageModel = class {
5204
5315
  controller.enqueue({
5205
5316
  type: "source",
5206
5317
  sourceType: "url",
5207
- id: (_n = (_m = (_l = self.config).generateId) == null ? void 0 : _m.call(_l)) != null ? _n : generateId2(),
5318
+ id: (_u = (_t = (_s = self.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : generateId2(),
5208
5319
  url: value.annotation.url,
5209
5320
  title: value.annotation.title
5210
5321
  });
@@ -5212,10 +5323,10 @@ var OpenAIResponsesLanguageModel = class {
5212
5323
  controller.enqueue({
5213
5324
  type: "source",
5214
5325
  sourceType: "document",
5215
- id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : generateId2(),
5326
+ id: (_x = (_w = (_v = self.config).generateId) == null ? void 0 : _w.call(_v)) != null ? _x : generateId2(),
5216
5327
  mediaType: "text/plain",
5217
- title: (_s = (_r = value.annotation.quote) != null ? _r : value.annotation.filename) != null ? _s : "Document",
5218
- filename: (_t = value.annotation.filename) != null ? _t : value.annotation.file_id,
5328
+ title: (_z = (_y = value.annotation.quote) != null ? _y : value.annotation.filename) != null ? _z : "Document",
5329
+ filename: (_A = value.annotation.filename) != null ? _A : value.annotation.file_id,
5219
5330
  ...value.annotation.file_id ? {
5220
5331
  providerMetadata: {
5221
5332
  [providerKey]: {
@@ -5228,10 +5339,10 @@ var OpenAIResponsesLanguageModel = class {
5228
5339
  controller.enqueue({
5229
5340
  type: "source",
5230
5341
  sourceType: "document",
5231
- id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2(),
5342
+ id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : generateId2(),
5232
5343
  mediaType: "text/plain",
5233
- title: (_y = (_x = value.annotation.filename) != null ? _x : value.annotation.file_id) != null ? _y : "Document",
5234
- filename: (_z = value.annotation.filename) != null ? _z : value.annotation.file_id,
5344
+ title: (_F = (_E = value.annotation.filename) != null ? _E : value.annotation.file_id) != null ? _F : "Document",
5345
+ filename: (_G = value.annotation.filename) != null ? _G : value.annotation.file_id,
5235
5346
  providerMetadata: {
5236
5347
  [providerKey]: {
5237
5348
  fileId: value.annotation.file_id,
@@ -5244,7 +5355,7 @@ var OpenAIResponsesLanguageModel = class {
5244
5355
  controller.enqueue({
5245
5356
  type: "source",
5246
5357
  sourceType: "document",
5247
- id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : generateId2(),
5358
+ id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : generateId2(),
5248
5359
  mediaType: "application/octet-stream",
5249
5360
  title: value.annotation.file_id,
5250
5361
  filename: value.annotation.file_id,
@@ -5715,7 +5826,7 @@ var OpenAITranscriptionModel = class {
5715
5826
  };
5716
5827
 
5717
5828
  // src/version.ts
5718
- var VERSION = true ? "3.0.0" : "0.0.0-test";
5829
+ var VERSION = true ? "3.0.1" : "0.0.0-test";
5719
5830
 
5720
5831
  // src/openai-provider.ts
5721
5832
  function createOpenAI(options = {}) {