@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.
- package/CHANGELOG.md +6 -0
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -8
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +88 -3
- package/dist/internal/index.d.ts +88 -3
- package/dist/internal/index.js +18 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -7
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/internal/index.ts +1 -0
- package/src/responses/openai-responses-language-model.ts +1 -0
- package/src/responses/openai-responses-prepare-tools.ts +4 -3
|
@@ -1,6 +1,6 @@
|
|
|
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
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 & {});
|
|
6
6
|
declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
@@ -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 };
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
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 & {});
|
|
6
6
|
declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
@@ -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 };
|
package/dist/internal/index.js
CHANGED
|
@@ -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,
|
|
@@ -3321,6 +3325,7 @@ var toolSearchToolFactory = (0, import_provider_utils24.createProviderToolFactor
|
|
|
3321
3325
|
inputSchema: toolSearchInputSchema,
|
|
3322
3326
|
outputSchema: toolSearchOutputSchema
|
|
3323
3327
|
});
|
|
3328
|
+
var toolSearch = (args = {}) => toolSearchToolFactory(args);
|
|
3324
3329
|
|
|
3325
3330
|
// src/tool/web-search.ts
|
|
3326
3331
|
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
@@ -5749,9 +5754,10 @@ async function prepareResponsesTools({
|
|
|
5749
5754
|
allowedTools,
|
|
5750
5755
|
toolNameMapping,
|
|
5751
5756
|
customProviderToolNames,
|
|
5752
|
-
supportsAsyncToolCalling = true
|
|
5757
|
+
supportsAsyncToolCalling = true,
|
|
5758
|
+
providerOptionsName = "openai"
|
|
5753
5759
|
}) {
|
|
5754
|
-
var _a2, _b, _c, _d;
|
|
5760
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
5755
5761
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
5756
5762
|
const toolWarnings = [];
|
|
5757
5763
|
if (tools == null) {
|
|
@@ -5777,7 +5783,7 @@ async function prepareResponsesTools({
|
|
|
5777
5783
|
for (const tool of tools) {
|
|
5778
5784
|
switch (tool.type) {
|
|
5779
5785
|
case "function": {
|
|
5780
|
-
const openaiOptions = (_a2 = tool.providerOptions) == null ? void 0 : _a2.openai;
|
|
5786
|
+
const openaiOptions = (_c = (_a2 = tool.providerOptions) == null ? void 0 : _a2[providerOptionsName]) != null ? _c : (_b = tool.providerOptions) == null ? void 0 : _b.openai;
|
|
5781
5787
|
const openaiFunctionTool = prepareFunctionTool({
|
|
5782
5788
|
tool,
|
|
5783
5789
|
options: openaiOptions,
|
|
@@ -6041,7 +6047,7 @@ async function prepareResponsesTools({
|
|
|
6041
6047
|
});
|
|
6042
6048
|
allowedToolEntries.push({
|
|
6043
6049
|
type: "function",
|
|
6044
|
-
name: (
|
|
6050
|
+
name: (_d = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(name)) != null ? _d : name
|
|
6045
6051
|
});
|
|
6046
6052
|
continue;
|
|
6047
6053
|
}
|
|
@@ -6067,7 +6073,7 @@ async function prepareResponsesTools({
|
|
|
6067
6073
|
tools: openaiTools,
|
|
6068
6074
|
toolChoice: {
|
|
6069
6075
|
type: "allowed_tools",
|
|
6070
|
-
mode: (
|
|
6076
|
+
mode: (_e = allowedTools.mode) != null ? _e : "auto",
|
|
6071
6077
|
tools: allowedToolEntries
|
|
6072
6078
|
},
|
|
6073
6079
|
toolWarnings
|
|
@@ -6083,7 +6089,7 @@ async function prepareResponsesTools({
|
|
|
6083
6089
|
case "required":
|
|
6084
6090
|
return { tools: openaiTools, toolChoice: type, toolWarnings };
|
|
6085
6091
|
case "tool": {
|
|
6086
|
-
const resolvedToolName = (
|
|
6092
|
+
const resolvedToolName = (_f = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _f : toolChoice.toolName;
|
|
6087
6093
|
return {
|
|
6088
6094
|
tools: openaiTools,
|
|
6089
6095
|
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 +6361,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6355
6361
|
allowedTools: (_b = openaiOptions == null ? void 0 : openaiOptions.allowedTools) != null ? _b : void 0,
|
|
6356
6362
|
toolNameMapping,
|
|
6357
6363
|
customProviderToolNames,
|
|
6358
|
-
supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
|
|
6364
|
+
supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling,
|
|
6365
|
+
providerOptionsName
|
|
6359
6366
|
});
|
|
6360
6367
|
const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
|
|
6361
6368
|
modelCapabilities,
|
|
@@ -8274,6 +8281,10 @@ function escapeJSONDelta(delta) {
|
|
|
8274
8281
|
openaiLanguageModelChatOptions,
|
|
8275
8282
|
openaiLanguageModelCompletionOptions,
|
|
8276
8283
|
openaiSpeechModelOptionsSchema,
|
|
8284
|
+
toolSearch,
|
|
8285
|
+
toolSearchArgsSchema,
|
|
8286
|
+
toolSearchInputSchema,
|
|
8287
|
+
toolSearchOutputSchema,
|
|
8277
8288
|
webSearch,
|
|
8278
8289
|
webSearchArgsSchema,
|
|
8279
8290
|
webSearchOutputSchema,
|