@ai-sdk/openai 3.0.131 → 3.0.133

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.
@@ -1,8 +1,8 @@
1
- import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3CallOptions, TranscriptionModelV3, SpeechModelV3, JSONValue } from '@ai-sdk/provider';
1
+ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3CallOptions, TranscriptionModelV3, SpeechModelV3, JSONValue, JSONObject } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
- import { InferSchema, FetchFunction, EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL } from '@ai-sdk/provider-utils';
3
+ import { InferSchema, FetchFunction, EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, FlexibleSchema } from '@ai-sdk/provider-utils';
4
4
 
5
- type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | 'gpt-6.1-sol' | 'gpt-6-luna' | 'gpt-6-sol' | (string & {});
5
+ type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | 'gpt-6.1-sol' | 'gpt-6.1-terra' | 'gpt-6-luna' | 'gpt-6-sol' | (string & {});
6
6
  declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
7
7
  logitBias?: Record<number, number> | undefined;
8
8
  logprobs?: number | boolean | undefined;
@@ -226,7 +226,7 @@ declare class OpenAISpeechModel implements SpeechModelV3 {
226
226
  doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
227
227
  }
228
228
 
229
- type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | 'gpt-6.1-sol' | 'gpt-6-luna' | 'gpt-6-sol' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
229
+ type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | 'gpt-6.1-sol' | 'gpt-6.1-terra' | 'gpt-6-luna' | 'gpt-6-sol' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
230
230
 
231
231
  declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
232
232
  readonly specificationVersion = "v3";
@@ -1206,6 +1206,91 @@ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_
1206
1206
  result: string;
1207
1207
  }>;
1208
1208
 
1209
+ declare const toolSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
1210
+ execution?: "server" | "client" | undefined;
1211
+ description?: string | undefined;
1212
+ parameters?: Record<string, unknown> | undefined;
1213
+ }>;
1214
+ declare const toolSearchInputSchema: _ai_sdk_provider_utils.LazySchema<{
1215
+ arguments?: unknown;
1216
+ call_id?: string | null | undefined;
1217
+ }>;
1218
+ declare const toolSearchOutputSchema: FlexibleSchema<{
1219
+ tools: Array<JSONObject>;
1220
+ }>;
1221
+ declare const toolSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
1222
+ /**
1223
+ * The arguments from the tool_search_call.
1224
+ * This is preserved for multi-turn conversation reconstruction.
1225
+ */
1226
+ arguments?: unknown;
1227
+ /**
1228
+ * The call ID from the tool_search_call.
1229
+ * Present for client-executed tool search; null for hosted.
1230
+ */
1231
+ call_id?: string | null;
1232
+ }, {
1233
+ /**
1234
+ * The tools that were loaded by the tool search.
1235
+ * These are the deferred tools that the model requested to load.
1236
+ * Each tool is represented as a JSON object with properties depending on its type.
1237
+ *
1238
+ * Common properties include:
1239
+ * - `type`: The type of the tool (e.g., 'function', 'web_search', etc.)
1240
+ * - `name`: The name of the tool (for function tools)
1241
+ * - `description`: A description of the tool
1242
+ * - `deferLoading`: Whether this tool was deferred (had defer_loading: true)
1243
+ * - `parameters`: The JSON Schema for the function parameters (for function tools)
1244
+ * - `strict`: Whether to enable strict schema adherence (for function tools)
1245
+ */
1246
+ tools: Array<JSONObject>;
1247
+ }, {
1248
+ /**
1249
+ * Whether the tool search is executed by the server (hosted) or client.
1250
+ * - `'server'` (default): OpenAI performs the search across deferred tools.
1251
+ * - `'client'`: The model emits a `tool_search_call` and your `execute`
1252
+ * function performs the lookup, returning the tools to load.
1253
+ */
1254
+ execution?: "server" | "client";
1255
+ /**
1256
+ * A description of the tool search capability.
1257
+ * Only used for client-executed tool search.
1258
+ */
1259
+ description?: string;
1260
+ /**
1261
+ * JSON Schema for the search arguments your application expects.
1262
+ * Only used for client-executed tool search.
1263
+ */
1264
+ parameters?: Record<string, unknown>;
1265
+ }>;
1266
+ declare const toolSearch: (args?: Parameters<typeof toolSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{
1267
+ /**
1268
+ * The arguments from the tool_search_call.
1269
+ * This is preserved for multi-turn conversation reconstruction.
1270
+ */
1271
+ arguments?: unknown;
1272
+ /**
1273
+ * The call ID from the tool_search_call.
1274
+ * Present for client-executed tool search; null for hosted.
1275
+ */
1276
+ call_id?: string | null;
1277
+ }, {
1278
+ /**
1279
+ * The tools that were loaded by the tool search.
1280
+ * These are the deferred tools that the model requested to load.
1281
+ * Each tool is represented as a JSON object with properties depending on its type.
1282
+ *
1283
+ * Common properties include:
1284
+ * - `type`: The type of the tool (e.g., 'function', 'web_search', etc.)
1285
+ * - `name`: The name of the tool (for function tools)
1286
+ * - `description`: A description of the tool
1287
+ * - `deferLoading`: Whether this tool was deferred (had defer_loading: true)
1288
+ * - `parameters`: The JSON Schema for the function parameters (for function tools)
1289
+ * - `strict`: Whether to enable strict schema adherence (for function tools)
1290
+ */
1291
+ tools: Array<JSONObject>;
1292
+ }>;
1293
+
1209
1294
  declare const webSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
1210
1295
  externalWebAccess?: boolean | undefined;
1211
1296
  filters?: {
@@ -1491,4 +1576,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOu
1491
1576
  };
1492
1577
  }>;
1493
1578
 
1494
- export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, type ResponsesToolCallProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
1579
+ export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, type ResponsesToolCallProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, toolSearch, toolSearchArgsSchema, toolSearchInputSchema, toolSearchOutputSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
@@ -1,8 +1,8 @@
1
- import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3CallOptions, TranscriptionModelV3, SpeechModelV3, JSONValue } from '@ai-sdk/provider';
1
+ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3CallOptions, TranscriptionModelV3, SpeechModelV3, JSONValue, JSONObject } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
- import { InferSchema, FetchFunction, EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL } from '@ai-sdk/provider-utils';
3
+ import { InferSchema, FetchFunction, EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, FlexibleSchema } from '@ai-sdk/provider-utils';
4
4
 
5
- type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | 'gpt-6.1-sol' | 'gpt-6-luna' | 'gpt-6-sol' | (string & {});
5
+ type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | 'gpt-6.1-sol' | 'gpt-6.1-terra' | 'gpt-6-luna' | 'gpt-6-sol' | (string & {});
6
6
  declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
7
7
  logitBias?: Record<number, number> | undefined;
8
8
  logprobs?: number | boolean | undefined;
@@ -226,7 +226,7 @@ declare class OpenAISpeechModel implements SpeechModelV3 {
226
226
  doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
227
227
  }
228
228
 
229
- type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | 'gpt-6.1-sol' | 'gpt-6-luna' | 'gpt-6-sol' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
229
+ type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | 'gpt-6.1-sol' | 'gpt-6.1-terra' | 'gpt-6-luna' | 'gpt-6-sol' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
230
230
 
231
231
  declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
232
232
  readonly specificationVersion = "v3";
@@ -1206,6 +1206,91 @@ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_
1206
1206
  result: string;
1207
1207
  }>;
1208
1208
 
1209
+ declare const toolSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
1210
+ execution?: "server" | "client" | undefined;
1211
+ description?: string | undefined;
1212
+ parameters?: Record<string, unknown> | undefined;
1213
+ }>;
1214
+ declare const toolSearchInputSchema: _ai_sdk_provider_utils.LazySchema<{
1215
+ arguments?: unknown;
1216
+ call_id?: string | null | undefined;
1217
+ }>;
1218
+ declare const toolSearchOutputSchema: FlexibleSchema<{
1219
+ tools: Array<JSONObject>;
1220
+ }>;
1221
+ declare const toolSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
1222
+ /**
1223
+ * The arguments from the tool_search_call.
1224
+ * This is preserved for multi-turn conversation reconstruction.
1225
+ */
1226
+ arguments?: unknown;
1227
+ /**
1228
+ * The call ID from the tool_search_call.
1229
+ * Present for client-executed tool search; null for hosted.
1230
+ */
1231
+ call_id?: string | null;
1232
+ }, {
1233
+ /**
1234
+ * The tools that were loaded by the tool search.
1235
+ * These are the deferred tools that the model requested to load.
1236
+ * Each tool is represented as a JSON object with properties depending on its type.
1237
+ *
1238
+ * Common properties include:
1239
+ * - `type`: The type of the tool (e.g., 'function', 'web_search', etc.)
1240
+ * - `name`: The name of the tool (for function tools)
1241
+ * - `description`: A description of the tool
1242
+ * - `deferLoading`: Whether this tool was deferred (had defer_loading: true)
1243
+ * - `parameters`: The JSON Schema for the function parameters (for function tools)
1244
+ * - `strict`: Whether to enable strict schema adherence (for function tools)
1245
+ */
1246
+ tools: Array<JSONObject>;
1247
+ }, {
1248
+ /**
1249
+ * Whether the tool search is executed by the server (hosted) or client.
1250
+ * - `'server'` (default): OpenAI performs the search across deferred tools.
1251
+ * - `'client'`: The model emits a `tool_search_call` and your `execute`
1252
+ * function performs the lookup, returning the tools to load.
1253
+ */
1254
+ execution?: "server" | "client";
1255
+ /**
1256
+ * A description of the tool search capability.
1257
+ * Only used for client-executed tool search.
1258
+ */
1259
+ description?: string;
1260
+ /**
1261
+ * JSON Schema for the search arguments your application expects.
1262
+ * Only used for client-executed tool search.
1263
+ */
1264
+ parameters?: Record<string, unknown>;
1265
+ }>;
1266
+ declare const toolSearch: (args?: Parameters<typeof toolSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{
1267
+ /**
1268
+ * The arguments from the tool_search_call.
1269
+ * This is preserved for multi-turn conversation reconstruction.
1270
+ */
1271
+ arguments?: unknown;
1272
+ /**
1273
+ * The call ID from the tool_search_call.
1274
+ * Present for client-executed tool search; null for hosted.
1275
+ */
1276
+ call_id?: string | null;
1277
+ }, {
1278
+ /**
1279
+ * The tools that were loaded by the tool search.
1280
+ * These are the deferred tools that the model requested to load.
1281
+ * Each tool is represented as a JSON object with properties depending on its type.
1282
+ *
1283
+ * Common properties include:
1284
+ * - `type`: The type of the tool (e.g., 'function', 'web_search', etc.)
1285
+ * - `name`: The name of the tool (for function tools)
1286
+ * - `description`: A description of the tool
1287
+ * - `deferLoading`: Whether this tool was deferred (had defer_loading: true)
1288
+ * - `parameters`: The JSON Schema for the function parameters (for function tools)
1289
+ * - `strict`: Whether to enable strict schema adherence (for function tools)
1290
+ */
1291
+ tools: Array<JSONObject>;
1292
+ }>;
1293
+
1209
1294
  declare const webSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
1210
1295
  externalWebAccess?: boolean | undefined;
1211
1296
  filters?: {
@@ -1491,4 +1576,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOu
1491
1576
  };
1492
1577
  }>;
1493
1578
 
1494
- export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, type ResponsesToolCallProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
1579
+ export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, type ResponsesToolCallProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, toolSearch, toolSearchArgsSchema, toolSearchInputSchema, toolSearchOutputSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
@@ -54,6 +54,10 @@ __export(index_exports, {
54
54
  openaiLanguageModelChatOptions: () => openaiLanguageModelChatOptions,
55
55
  openaiLanguageModelCompletionOptions: () => openaiLanguageModelCompletionOptions,
56
56
  openaiSpeechModelOptionsSchema: () => openaiSpeechModelOptionsSchema,
57
+ toolSearch: () => toolSearch,
58
+ toolSearchArgsSchema: () => toolSearchArgsSchema,
59
+ toolSearchInputSchema: () => toolSearchInputSchema,
60
+ toolSearchOutputSchema: () => toolSearchOutputSchema,
57
61
  webSearch: () => webSearch,
58
62
  webSearchArgsSchema: () => webSearchArgsSchema,
59
63
  webSearchOutputSchema: () => webSearchOutputSchema,
@@ -98,7 +102,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
98
102
  const isGptChatModel = (gptVersion == null ? void 0 : gptVersion.minor) == null && ((_b = (_a2 = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _a2.startsWith("chat")) != null ? _b : false);
99
103
  const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
100
104
  const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
101
- const isGpt6SolOrLuna = modelId === "gpt-6-sol" || modelId === "gpt-6-luna";
105
+ const isGpt6OrLaterModelWithNoneEffort = modelId === "gpt-6-sol" || modelId === "gpt-6-luna" || modelId === "gpt-6.1-terra";
102
106
  const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
103
107
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
104
108
  const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
@@ -109,7 +113,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
109
113
  supportsPriorityProcessing,
110
114
  supportsConfigurationUpdate: isGpt6OrLaterModel,
111
115
  supportsAsyncToolCalling: isGpt6OrLaterModel,
112
- supportedReasoningEfforts: isGpt6SolOrLuna ? ["none", "low", "medium", "high", "xhigh", "max"] : isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
116
+ supportedReasoningEfforts: isGpt6OrLaterModelWithNoneEffort ? ["none", "low", "medium", "high", "xhigh", "max"] : isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
113
117
  isReasoningModel,
114
118
  systemMessageMode,
115
119
  supportsNonReasoningParameters
@@ -2453,7 +2457,12 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils15.lazySchema)(
2453
2457
  compression_ratio: import_v410.z.number(),
2454
2458
  no_speech_prob: import_v410.z.number()
2455
2459
  })
2456
- ).nullish()
2460
+ ).nullish(),
2461
+ // Lenient: an unexpected usage shape must not fail the transcription.
2462
+ usage: import_v410.z.object({
2463
+ type: import_v410.z.string().nullish(),
2464
+ seconds: import_v410.z.number().nullish()
2465
+ }).nullish().catch(void 0)
2457
2466
  })
2458
2467
  )
2459
2468
  );
@@ -2586,10 +2595,10 @@ var OpenAITranscriptionModel = class {
2586
2595
  prompt: openAIOptions.prompt,
2587
2596
  // https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
2588
2597
  // prefer verbose_json to get segments for models that support it
2589
- response_format: [
2590
- "gpt-4o-transcribe",
2591
- "gpt-4o-mini-transcribe"
2592
- ].includes(this.modelId) ? "json" : "verbose_json",
2598
+ // gpt-4o(-mini)-transcribe (incl. snapshots) and gpt-transcribe reject verbose_json:
2599
+ response_format: ["gpt-4o-transcribe", "gpt-4o-mini-transcribe"].includes(
2600
+ this.modelId
2601
+ ) || this.modelId.startsWith("gpt-4o-mini-transcribe-") || this.modelId === "gpt-transcribe" || this.modelId.startsWith("gpt-transcribe-") ? "json" : "verbose_json",
2593
2602
  temperature: openAIOptions.temperature,
2594
2603
  timestamp_granularities: openAIOptions.timestampGranularities
2595
2604
  };
@@ -2611,7 +2620,7 @@ var OpenAITranscriptionModel = class {
2611
2620
  };
2612
2621
  }
2613
2622
  async doGenerate(options) {
2614
- var _a2, _b, _c, _d, _e, _f, _g, _h;
2623
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2615
2624
  const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
2616
2625
  const { formData, warnings } = await this.getArgs(options);
2617
2626
  const {
@@ -2645,7 +2654,8 @@ var OpenAITranscriptionModel = class {
2645
2654
  endSecond: word.end
2646
2655
  }))) != null ? _g : [],
2647
2656
  language,
2648
- durationInSeconds: (_h = response.duration) != null ? _h : void 0,
2657
+ // Duration-billed json responses report the duration only in `usage`:
2658
+ durationInSeconds: (_j = response.duration) != null ? _j : ((_h = response.usage) == null ? void 0 : _h.type) === "duration" ? (_i = response.usage.seconds) != null ? _i : void 0 : void 0,
2649
2659
  warnings,
2650
2660
  response: {
2651
2661
  timestamp: currentDate,
@@ -2871,6 +2881,7 @@ var openaiResponsesReasoningModelIds = [
2871
2881
  "gpt-5.6-terra",
2872
2882
  "gpt-6-astra",
2873
2883
  "gpt-6.1-sol",
2884
+ "gpt-6.1-terra",
2874
2885
  "gpt-6-luna",
2875
2886
  "gpt-6-sol"
2876
2887
  ];
@@ -3321,6 +3332,7 @@ var toolSearchToolFactory = (0, import_provider_utils24.createProviderToolFactor
3321
3332
  inputSchema: toolSearchInputSchema,
3322
3333
  outputSchema: toolSearchOutputSchema
3323
3334
  });
3335
+ var toolSearch = (args = {}) => toolSearchToolFactory(args);
3324
3336
 
3325
3337
  // src/tool/web-search.ts
3326
3338
  var import_provider_utils25 = require("@ai-sdk/provider-utils");
@@ -5749,9 +5761,10 @@ async function prepareResponsesTools({
5749
5761
  allowedTools,
5750
5762
  toolNameMapping,
5751
5763
  customProviderToolNames,
5752
- supportsAsyncToolCalling = true
5764
+ supportsAsyncToolCalling = true,
5765
+ providerOptionsName = "openai"
5753
5766
  }) {
5754
- var _a2, _b, _c, _d;
5767
+ var _a2, _b, _c, _d, _e, _f;
5755
5768
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
5756
5769
  const toolWarnings = [];
5757
5770
  if (tools == null) {
@@ -5777,7 +5790,7 @@ async function prepareResponsesTools({
5777
5790
  for (const tool of tools) {
5778
5791
  switch (tool.type) {
5779
5792
  case "function": {
5780
- const openaiOptions = (_a2 = tool.providerOptions) == null ? void 0 : _a2.openai;
5793
+ const openaiOptions = (_c = (_a2 = tool.providerOptions) == null ? void 0 : _a2[providerOptionsName]) != null ? _c : (_b = tool.providerOptions) == null ? void 0 : _b.openai;
5781
5794
  const openaiFunctionTool = prepareFunctionTool({
5782
5795
  tool,
5783
5796
  options: openaiOptions,
@@ -6041,7 +6054,7 @@ async function prepareResponsesTools({
6041
6054
  });
6042
6055
  allowedToolEntries.push({
6043
6056
  type: "function",
6044
- name: (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(name)) != null ? _b : name
6057
+ name: (_d = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(name)) != null ? _d : name
6045
6058
  });
6046
6059
  continue;
6047
6060
  }
@@ -6067,7 +6080,7 @@ async function prepareResponsesTools({
6067
6080
  tools: openaiTools,
6068
6081
  toolChoice: {
6069
6082
  type: "allowed_tools",
6070
- mode: (_c = allowedTools.mode) != null ? _c : "auto",
6083
+ mode: (_e = allowedTools.mode) != null ? _e : "auto",
6071
6084
  tools: allowedToolEntries
6072
6085
  },
6073
6086
  toolWarnings
@@ -6083,7 +6096,7 @@ async function prepareResponsesTools({
6083
6096
  case "required":
6084
6097
  return { tools: openaiTools, toolChoice: type, toolWarnings };
6085
6098
  case "tool": {
6086
- const resolvedToolName = (_d = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _d : toolChoice.toolName;
6099
+ const resolvedToolName = (_f = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _f : toolChoice.toolName;
6087
6100
  return {
6088
6101
  tools: openaiTools,
6089
6102
  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 },
@@ -6355,7 +6368,8 @@ var OpenAIResponsesLanguageModel = class {
6355
6368
  allowedTools: (_b = openaiOptions == null ? void 0 : openaiOptions.allowedTools) != null ? _b : void 0,
6356
6369
  toolNameMapping,
6357
6370
  customProviderToolNames,
6358
- supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
6371
+ supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling,
6372
+ providerOptionsName
6359
6373
  });
6360
6374
  const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
6361
6375
  modelCapabilities,
@@ -8274,6 +8288,10 @@ function escapeJSONDelta(delta) {
8274
8288
  openaiLanguageModelChatOptions,
8275
8289
  openaiLanguageModelCompletionOptions,
8276
8290
  openaiSpeechModelOptionsSchema,
8291
+ toolSearch,
8292
+ toolSearchArgsSchema,
8293
+ toolSearchInputSchema,
8294
+ toolSearchOutputSchema,
8277
8295
  webSearch,
8278
8296
  webSearchArgsSchema,
8279
8297
  webSearchOutputSchema,