@ai-sdk/openai 3.0.131 → 3.0.132

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.
@@ -3376,6 +3376,7 @@ var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema4({
3376
3376
  inputSchema: toolSearchInputSchema,
3377
3377
  outputSchema: toolSearchOutputSchema
3378
3378
  });
3379
+ var toolSearch = (args = {}) => toolSearchToolFactory(args);
3379
3380
 
3380
3381
  // src/tool/web-search.ts
3381
3382
  import {
@@ -5839,9 +5840,10 @@ async function prepareResponsesTools({
5839
5840
  allowedTools,
5840
5841
  toolNameMapping,
5841
5842
  customProviderToolNames,
5842
- supportsAsyncToolCalling = true
5843
+ supportsAsyncToolCalling = true,
5844
+ providerOptionsName = "openai"
5843
5845
  }) {
5844
- var _a2, _b, _c, _d;
5846
+ var _a2, _b, _c, _d, _e, _f;
5845
5847
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
5846
5848
  const toolWarnings = [];
5847
5849
  if (tools == null) {
@@ -5867,7 +5869,7 @@ async function prepareResponsesTools({
5867
5869
  for (const tool of tools) {
5868
5870
  switch (tool.type) {
5869
5871
  case "function": {
5870
- const openaiOptions = (_a2 = tool.providerOptions) == null ? void 0 : _a2.openai;
5872
+ const openaiOptions = (_c = (_a2 = tool.providerOptions) == null ? void 0 : _a2[providerOptionsName]) != null ? _c : (_b = tool.providerOptions) == null ? void 0 : _b.openai;
5871
5873
  const openaiFunctionTool = prepareFunctionTool({
5872
5874
  tool,
5873
5875
  options: openaiOptions,
@@ -6131,7 +6133,7 @@ async function prepareResponsesTools({
6131
6133
  });
6132
6134
  allowedToolEntries.push({
6133
6135
  type: "function",
6134
- name: (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(name)) != null ? _b : name
6136
+ name: (_d = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(name)) != null ? _d : name
6135
6137
  });
6136
6138
  continue;
6137
6139
  }
@@ -6157,7 +6159,7 @@ async function prepareResponsesTools({
6157
6159
  tools: openaiTools,
6158
6160
  toolChoice: {
6159
6161
  type: "allowed_tools",
6160
- mode: (_c = allowedTools.mode) != null ? _c : "auto",
6162
+ mode: (_e = allowedTools.mode) != null ? _e : "auto",
6161
6163
  tools: allowedToolEntries
6162
6164
  },
6163
6165
  toolWarnings
@@ -6173,7 +6175,7 @@ async function prepareResponsesTools({
6173
6175
  case "required":
6174
6176
  return { tools: openaiTools, toolChoice: type, toolWarnings };
6175
6177
  case "tool": {
6176
- const resolvedToolName = (_d = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _d : toolChoice.toolName;
6178
+ const resolvedToolName = (_f = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _f : toolChoice.toolName;
6177
6179
  return {
6178
6180
  tools: openaiTools,
6179
6181
  toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
@@ -6445,7 +6447,8 @@ var OpenAIResponsesLanguageModel = class {
6445
6447
  allowedTools: (_b = openaiOptions == null ? void 0 : openaiOptions.allowedTools) != null ? _b : void 0,
6446
6448
  toolNameMapping,
6447
6449
  customProviderToolNames,
6448
- supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
6450
+ supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling,
6451
+ providerOptionsName
6449
6452
  });
6450
6453
  const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
6451
6454
  modelCapabilities,
@@ -8363,6 +8366,10 @@ export {
8363
8366
  openaiLanguageModelChatOptions,
8364
8367
  openaiLanguageModelCompletionOptions,
8365
8368
  openaiSpeechModelOptionsSchema,
8369
+ toolSearch,
8370
+ toolSearchArgsSchema,
8371
+ toolSearchInputSchema,
8372
+ toolSearchOutputSchema,
8366
8373
  webSearch,
8367
8374
  webSearchArgsSchema,
8368
8375
  webSearchOutputSchema,