@ai-sdk/openai 2.0.0-beta.6 → 2.0.0-beta.8

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.
@@ -1988,7 +1988,7 @@ async function convertToOpenAIResponsesMessages({
1988
1988
  prompt,
1989
1989
  systemMessageMode
1990
1990
  }) {
1991
- var _a, _b;
1991
+ var _a, _b, _c, _d, _e;
1992
1992
  const messages = [];
1993
1993
  const warnings = [];
1994
1994
  for (const { role, content } of prompt) {
@@ -2023,7 +2023,7 @@ async function convertToOpenAIResponsesMessages({
2023
2023
  messages.push({
2024
2024
  role: "user",
2025
2025
  content: content.map((part, index) => {
2026
- var _a2, _b2, _c;
2026
+ var _a2, _b2, _c2;
2027
2027
  switch (part.type) {
2028
2028
  case "text": {
2029
2029
  return { type: "input_text", text: part.text };
@@ -2045,7 +2045,7 @@ async function convertToOpenAIResponsesMessages({
2045
2045
  }
2046
2046
  return {
2047
2047
  type: "input_file",
2048
- filename: (_c = part.filename) != null ? _c : `part-${index}.pdf`,
2048
+ filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2049
2049
  file_data: `data:application/pdf;base64,${part.data}`
2050
2050
  };
2051
2051
  } else {
@@ -2078,7 +2078,8 @@ async function convertToOpenAIResponsesMessages({
2078
2078
  type: "function_call",
2079
2079
  call_id: part.toolCallId,
2080
2080
  name: part.toolName,
2081
- arguments: JSON.stringify(part.input)
2081
+ arguments: JSON.stringify(part.input),
2082
+ id: (_c = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId) != null ? _c : void 0
2082
2083
  });
2083
2084
  break;
2084
2085
  }
@@ -2095,7 +2096,7 @@ async function convertToOpenAIResponsesMessages({
2095
2096
  providerOptions: part.providerOptions,
2096
2097
  schema: openaiResponsesReasoningProviderOptionsSchema
2097
2098
  });
2098
- const reasoningId = (_a = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _a.id;
2099
+ const reasoningId = (_d = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _d.id;
2099
2100
  if (reasoningId != null) {
2100
2101
  const existingReasoningMessage = reasoningMessages[reasoningId];
2101
2102
  const summaryParts = [];
@@ -2111,7 +2112,7 @@ async function convertToOpenAIResponsesMessages({
2111
2112
  reasoningMessages[reasoningId] = {
2112
2113
  type: "reasoning",
2113
2114
  id: reasoningId,
2114
- encrypted_content: (_b = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _b.encryptedContent,
2115
+ encrypted_content: (_e = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _e.encryptedContent,
2115
2116
  summary: summaryParts
2116
2117
  };
2117
2118
  messages.push(reasoningMessages[reasoningId]);
@@ -2212,6 +2213,16 @@ function prepareResponsesTools({
2212
2213
  break;
2213
2214
  case "provider-defined":
2214
2215
  switch (tool.id) {
2216
+ case "openai.file_search": {
2217
+ const args = fileSearchArgsSchema.parse(tool.args);
2218
+ openaiTools.push({
2219
+ type: "file_search",
2220
+ vector_store_ids: args.vectorStoreIds,
2221
+ max_results: args.maxResults,
2222
+ search_type: args.searchType
2223
+ });
2224
+ break;
2225
+ }
2215
2226
  case "openai.web_search_preview":
2216
2227
  openaiTools.push({
2217
2228
  type: "web_search_preview",
@@ -2241,7 +2252,7 @@ function prepareResponsesTools({
2241
2252
  case "tool":
2242
2253
  return {
2243
2254
  tools: openaiTools,
2244
- toolChoice: toolChoice.toolName === "web_search_preview" ? { type: "web_search_preview" } : { type: "function", name: toolChoice.toolName },
2255
+ toolChoice: toolChoice.toolName === "file_search" ? { type: "file_search" } : toolChoice.toolName === "web_search_preview" ? { type: "web_search_preview" } : { type: "function", name: toolChoice.toolName },
2245
2256
  toolWarnings
2246
2257
  };
2247
2258
  default: {
@@ -2466,7 +2477,8 @@ var OpenAIResponsesLanguageModel = class {
2466
2477
  type: import_v415.z.literal("function_call"),
2467
2478
  call_id: import_v415.z.string(),
2468
2479
  name: import_v415.z.string(),
2469
- arguments: import_v415.z.string()
2480
+ arguments: import_v415.z.string(),
2481
+ id: import_v415.z.string()
2470
2482
  }),
2471
2483
  import_v415.z.object({
2472
2484
  type: import_v415.z.literal("web_search_call"),
@@ -2555,7 +2567,12 @@ var OpenAIResponsesLanguageModel = class {
2555
2567
  type: "tool-call",
2556
2568
  toolCallId: part.call_id,
2557
2569
  toolName: part.name,
2558
- input: part.arguments
2570
+ input: part.arguments,
2571
+ providerMetadata: {
2572
+ openai: {
2573
+ itemId: part.id
2574
+ }
2575
+ }
2559
2576
  });
2560
2577
  break;
2561
2578
  }
@@ -2740,7 +2757,12 @@ var OpenAIResponsesLanguageModel = class {
2740
2757
  type: "tool-call",
2741
2758
  toolCallId: value.item.call_id,
2742
2759
  toolName: value.item.name,
2743
- input: value.item.arguments
2760
+ input: value.item.arguments,
2761
+ providerMetadata: {
2762
+ openai: {
2763
+ itemId: value.item.id
2764
+ }
2765
+ }
2744
2766
  });
2745
2767
  } else if (value.item.type === "web_search_call") {
2746
2768
  ongoingToolCalls[value.output_index] = void 0;