@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.
@@ -2006,7 +2006,7 @@ async function convertToOpenAIResponsesMessages({
2006
2006
  prompt,
2007
2007
  systemMessageMode
2008
2008
  }) {
2009
- var _a, _b;
2009
+ var _a, _b, _c, _d, _e;
2010
2010
  const messages = [];
2011
2011
  const warnings = [];
2012
2012
  for (const { role, content } of prompt) {
@@ -2041,7 +2041,7 @@ async function convertToOpenAIResponsesMessages({
2041
2041
  messages.push({
2042
2042
  role: "user",
2043
2043
  content: content.map((part, index) => {
2044
- var _a2, _b2, _c;
2044
+ var _a2, _b2, _c2;
2045
2045
  switch (part.type) {
2046
2046
  case "text": {
2047
2047
  return { type: "input_text", text: part.text };
@@ -2063,7 +2063,7 @@ async function convertToOpenAIResponsesMessages({
2063
2063
  }
2064
2064
  return {
2065
2065
  type: "input_file",
2066
- filename: (_c = part.filename) != null ? _c : `part-${index}.pdf`,
2066
+ filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2067
2067
  file_data: `data:application/pdf;base64,${part.data}`
2068
2068
  };
2069
2069
  } else {
@@ -2096,7 +2096,8 @@ async function convertToOpenAIResponsesMessages({
2096
2096
  type: "function_call",
2097
2097
  call_id: part.toolCallId,
2098
2098
  name: part.toolName,
2099
- arguments: JSON.stringify(part.input)
2099
+ arguments: JSON.stringify(part.input),
2100
+ id: (_c = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId) != null ? _c : void 0
2100
2101
  });
2101
2102
  break;
2102
2103
  }
@@ -2113,7 +2114,7 @@ async function convertToOpenAIResponsesMessages({
2113
2114
  providerOptions: part.providerOptions,
2114
2115
  schema: openaiResponsesReasoningProviderOptionsSchema
2115
2116
  });
2116
- const reasoningId = (_a = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _a.id;
2117
+ const reasoningId = (_d = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _d.id;
2117
2118
  if (reasoningId != null) {
2118
2119
  const existingReasoningMessage = reasoningMessages[reasoningId];
2119
2120
  const summaryParts = [];
@@ -2129,7 +2130,7 @@ async function convertToOpenAIResponsesMessages({
2129
2130
  reasoningMessages[reasoningId] = {
2130
2131
  type: "reasoning",
2131
2132
  id: reasoningId,
2132
- encrypted_content: (_b = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _b.encryptedContent,
2133
+ encrypted_content: (_e = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _e.encryptedContent,
2133
2134
  summary: summaryParts
2134
2135
  };
2135
2136
  messages.push(reasoningMessages[reasoningId]);
@@ -2232,6 +2233,16 @@ function prepareResponsesTools({
2232
2233
  break;
2233
2234
  case "provider-defined":
2234
2235
  switch (tool.id) {
2236
+ case "openai.file_search": {
2237
+ const args = fileSearchArgsSchema.parse(tool.args);
2238
+ openaiTools.push({
2239
+ type: "file_search",
2240
+ vector_store_ids: args.vectorStoreIds,
2241
+ max_results: args.maxResults,
2242
+ search_type: args.searchType
2243
+ });
2244
+ break;
2245
+ }
2235
2246
  case "openai.web_search_preview":
2236
2247
  openaiTools.push({
2237
2248
  type: "web_search_preview",
@@ -2261,7 +2272,7 @@ function prepareResponsesTools({
2261
2272
  case "tool":
2262
2273
  return {
2263
2274
  tools: openaiTools,
2264
- toolChoice: toolChoice.toolName === "web_search_preview" ? { type: "web_search_preview" } : { type: "function", name: toolChoice.toolName },
2275
+ toolChoice: toolChoice.toolName === "file_search" ? { type: "file_search" } : toolChoice.toolName === "web_search_preview" ? { type: "web_search_preview" } : { type: "function", name: toolChoice.toolName },
2265
2276
  toolWarnings
2266
2277
  };
2267
2278
  default: {
@@ -2486,7 +2497,8 @@ var OpenAIResponsesLanguageModel = class {
2486
2497
  type: z15.literal("function_call"),
2487
2498
  call_id: z15.string(),
2488
2499
  name: z15.string(),
2489
- arguments: z15.string()
2500
+ arguments: z15.string(),
2501
+ id: z15.string()
2490
2502
  }),
2491
2503
  z15.object({
2492
2504
  type: z15.literal("web_search_call"),
@@ -2575,7 +2587,12 @@ var OpenAIResponsesLanguageModel = class {
2575
2587
  type: "tool-call",
2576
2588
  toolCallId: part.call_id,
2577
2589
  toolName: part.name,
2578
- input: part.arguments
2590
+ input: part.arguments,
2591
+ providerMetadata: {
2592
+ openai: {
2593
+ itemId: part.id
2594
+ }
2595
+ }
2579
2596
  });
2580
2597
  break;
2581
2598
  }
@@ -2760,7 +2777,12 @@ var OpenAIResponsesLanguageModel = class {
2760
2777
  type: "tool-call",
2761
2778
  toolCallId: value.item.call_id,
2762
2779
  toolName: value.item.name,
2763
- input: value.item.arguments
2780
+ input: value.item.arguments,
2781
+ providerMetadata: {
2782
+ openai: {
2783
+ itemId: value.item.id
2784
+ }
2785
+ }
2764
2786
  });
2765
2787
  } else if (value.item.type === "web_search_call") {
2766
2788
  ongoingToolCalls[value.output_index] = void 0;