@ai-sdk/openai
Advanced tools
| import { | ||
| createProviderExecutedToolFactory, | ||
| lazySchema, | ||
| zodSchema, | ||
| } from '@ai-sdk/provider-utils'; | ||
| import { z } from 'zod/v4'; | ||
| export const programmaticToolCallingInputSchema = lazySchema(() => | ||
| zodSchema( | ||
| z.object({ | ||
| code: z.string(), | ||
| fingerprint: z.string(), | ||
| }), | ||
| ), | ||
| ); | ||
| export const programmaticToolCallingOutputSchema = lazySchema(() => | ||
| zodSchema( | ||
| z.object({ | ||
| result: z.string(), | ||
| status: z.enum(['completed', 'incomplete']), | ||
| }), | ||
| ), | ||
| ); | ||
| const programmaticToolCallingFactory = createProviderExecutedToolFactory< | ||
| { | ||
| /** | ||
| * JavaScript source generated and executed by OpenAI. | ||
| */ | ||
| code: string; | ||
| /** | ||
| * Opaque replay fingerprint that must be preserved across requests. | ||
| */ | ||
| fingerprint: string; | ||
| }, | ||
| { | ||
| /** | ||
| * The result emitted by the hosted JavaScript program. | ||
| */ | ||
| result: string; | ||
| /** | ||
| * Whether the program completed or stopped before producing a final result. | ||
| */ | ||
| status: 'completed' | 'incomplete'; | ||
| }, | ||
| {} | ||
| >({ | ||
| id: 'openai.programmatic_tool_calling', | ||
| inputSchema: programmaticToolCallingInputSchema, | ||
| outputSchema: programmaticToolCallingOutputSchema, | ||
| supportsDeferredResults: true, | ||
| }); | ||
| export const programmaticToolCalling = () => programmaticToolCallingFactory({}); |
+60
-3
| import * as _ai_sdk_provider from '@ai-sdk/provider'; | ||
| import { JSONValue, ProviderV4, LanguageModelV4, EmbeddingModelV4, ImageModelV4, TranscriptionModelV4, SpeechModelV4, Experimental_RealtimeFactoryV4, FilesV4, SkillsV4, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4SessionConfig } from '@ai-sdk/provider'; | ||
| import { JSONValue, ProviderV4, LanguageModelV4, EmbeddingModelV4, ImageModelV4, TranscriptionModelV4, SpeechModelV4, Experimental_RealtimeFactoryV4, FilesV4, SkillsV4, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4SessionConfig, JSONObject } from '@ai-sdk/provider'; | ||
| import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils'; | ||
@@ -417,3 +417,21 @@ import { InferSchema, FetchFunction, WebSocketConstructor } from '@ai-sdk/provider-utils'; | ||
| namespace?: string | null | undefined; | ||
| caller?: { | ||
| type: "direct"; | ||
| } | { | ||
| type: "program"; | ||
| caller_id: string; | ||
| } | null | undefined; | ||
| } | { | ||
| type: "program"; | ||
| id: string; | ||
| call_id: string; | ||
| code: string; | ||
| fingerprint: string; | ||
| } | { | ||
| type: "program_output"; | ||
| id: string; | ||
| call_id: string; | ||
| result: string; | ||
| status: "completed" | "incomplete"; | ||
| } | { | ||
| type: "web_search_call"; | ||
@@ -613,2 +631,14 @@ id: string; | ||
| } | { | ||
| type: "program"; | ||
| id: string; | ||
| call_id: string; | ||
| code: string; | ||
| fingerprint: string; | ||
| } | { | ||
| type: "program_output"; | ||
| id: string; | ||
| call_id: string; | ||
| result: string; | ||
| status: "completed" | "incomplete"; | ||
| } | { | ||
| type: "message"; | ||
@@ -627,4 +657,10 @@ id: string; | ||
| arguments: string; | ||
| status: "completed"; | ||
| status: "completed" | "in_progress" | "incomplete"; | ||
| namespace?: string | null | undefined; | ||
| caller?: { | ||
| type: "direct"; | ||
| } | { | ||
| type: "program"; | ||
| caller_id: string; | ||
| } | null | undefined; | ||
| } | { | ||
@@ -1260,2 +1296,13 @@ type: "custom_tool_call"; | ||
| /** | ||
| * Programmatic Tool Calling lets OpenAI Responses models write and execute | ||
| * JavaScript that orchestrates eligible tools. | ||
| */ | ||
| programmaticToolCalling: () => _ai_sdk_provider_utils.ProviderExecutedTool<{ | ||
| code: string; | ||
| fingerprint: string; | ||
| }, { | ||
| result: string; | ||
| status: "completed" | "incomplete"; | ||
| }, {}>; | ||
| /** | ||
| * Tool search allows the model to dynamically search for and load deferred | ||
@@ -1486,2 +1533,12 @@ * tools into the model's context as needed. This helps reduce overall token | ||
| type OpenAIToolOptions = { | ||
| allowedCallers?: Array<'direct' | 'programmatic'>; | ||
| deferLoading?: boolean; | ||
| outputSchema?: JSONObject; | ||
| namespace?: { | ||
| name: string; | ||
| description: string; | ||
| }; | ||
| }; | ||
| declare const openaiFilesOptionsSchema: _ai_sdk_provider_utils.LazySchema<{ | ||
@@ -1603,2 +1660,2 @@ purpose?: string | undefined; | ||
| export { OpenAIRealtimeModel as Experimental_OpenAIRealtimeModel, type OpenAIRealtimeModelConfig as Experimental_OpenAIRealtimeModelConfig, type OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, type OpenAIComputerAction, type OpenAIComputerSafetyCheck, type OpenAIEmbeddingModelOptions, type OpenAIFilesOptions, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, type OpenAILanguageModelResponsesOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAILanguageModelResponsesOptions as OpenAIResponsesProviderOptions, type OpenAISpeechModelOptions, type OpenAITranscriptionModelOptions, type OpenaiResponsesCompactionProviderMetadata, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, VERSION, createOpenAI, openai }; | ||
| export { OpenAIRealtimeModel as Experimental_OpenAIRealtimeModel, type OpenAIRealtimeModelConfig as Experimental_OpenAIRealtimeModelConfig, type OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, type OpenAIComputerAction, type OpenAIComputerSafetyCheck, type OpenAIEmbeddingModelOptions, type OpenAIFilesOptions, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, type OpenAILanguageModelResponsesOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAILanguageModelResponsesOptions as OpenAIResponsesProviderOptions, type OpenAISpeechModelOptions, type OpenAIToolOptions, type OpenAITranscriptionModelOptions, type OpenaiResponsesCompactionProviderMetadata, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, VERSION, createOpenAI, openai }; |
@@ -538,3 +538,21 @@ import * as _ai_sdk_provider from '@ai-sdk/provider'; | ||
| namespace?: string | null | undefined; | ||
| caller?: { | ||
| type: "direct"; | ||
| } | { | ||
| type: "program"; | ||
| caller_id: string; | ||
| } | null | undefined; | ||
| } | { | ||
| type: "program"; | ||
| id: string; | ||
| call_id: string; | ||
| code: string; | ||
| fingerprint: string; | ||
| } | { | ||
| type: "program_output"; | ||
| id: string; | ||
| call_id: string; | ||
| result: string; | ||
| status: "completed" | "incomplete"; | ||
| } | { | ||
| type: "web_search_call"; | ||
@@ -734,2 +752,14 @@ id: string; | ||
| } | { | ||
| type: "program"; | ||
| id: string; | ||
| call_id: string; | ||
| code: string; | ||
| fingerprint: string; | ||
| } | { | ||
| type: "program_output"; | ||
| id: string; | ||
| call_id: string; | ||
| result: string; | ||
| status: "completed" | "incomplete"; | ||
| } | { | ||
| type: "message"; | ||
@@ -748,4 +778,10 @@ id: string; | ||
| arguments: string; | ||
| status: "completed"; | ||
| status: "completed" | "in_progress" | "incomplete"; | ||
| namespace?: string | null | undefined; | ||
| caller?: { | ||
| type: "direct"; | ||
| } | { | ||
| type: "program"; | ||
| caller_id: string; | ||
| } | null | undefined; | ||
| } | { | ||
@@ -1424,2 +1460,30 @@ type: "custom_tool_call"; | ||
| declare const programmaticToolCallingInputSchema: _ai_sdk_provider_utils.LazySchema<{ | ||
| code: string; | ||
| fingerprint: string; | ||
| }>; | ||
| declare const programmaticToolCallingOutputSchema: _ai_sdk_provider_utils.LazySchema<{ | ||
| result: string; | ||
| status: "completed" | "incomplete"; | ||
| }>; | ||
| declare const programmaticToolCalling: () => _ai_sdk_provider_utils.ProviderExecutedTool<{ | ||
| /** | ||
| * JavaScript source generated and executed by OpenAI. | ||
| */ | ||
| code: string; | ||
| /** | ||
| * Opaque replay fingerprint that must be preserved across requests. | ||
| */ | ||
| fingerprint: string; | ||
| }, { | ||
| /** | ||
| * The result emitted by the hosted JavaScript program. | ||
| */ | ||
| result: string; | ||
| /** | ||
| * Whether the program completed or stopped before producing a final result. | ||
| */ | ||
| status: "completed" | "incomplete"; | ||
| }, {}>; | ||
| declare const webSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{ | ||
@@ -1702,2 +1766,2 @@ externalWebAccess?: boolean | undefined; | ||
| 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 OpenAITranscriptionStreamOptions, type OpenaiResponsesCompactionProviderMetadata, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type ResponsesCompactionProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, 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 }; | ||
| 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 OpenAITranscriptionStreamOptions, type OpenaiResponsesCompactionProviderMetadata, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type ResponsesCompactionProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, 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, programmaticToolCalling, programmaticToolCallingInputSchema, programmaticToolCallingOutputSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory }; |
+1
-1
| { | ||
| "name": "@ai-sdk/openai", | ||
| "version": "4.0.19", | ||
| "version": "4.0.20", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
+1
-0
@@ -10,2 +10,3 @@ export { createOpenAI, openai } from './openai-provider'; | ||
| } from './responses/openai-responses-language-model-options'; | ||
| export type { OpenAIToolOptions } from './responses/openai-responses-prepare-tools'; | ||
| export type { | ||
@@ -12,0 +13,0 @@ OpenAILanguageModelChatOptions, |
@@ -19,3 +19,4 @@ export * from '../chat/openai-chat-language-model'; | ||
| export * from '../tool/image-generation'; | ||
| export * from '../tool/programmatic-tool-calling'; | ||
| export * from '../tool/web-search'; | ||
| export * from '../tool/web-search-preview'; |
@@ -13,2 +13,3 @@ import { applyPatch } from './tool/apply-patch'; | ||
| import { mcp } from './tool/mcp'; | ||
| import { programmaticToolCalling } from './tool/programmatic-tool-calling'; | ||
@@ -140,2 +141,8 @@ export const openaiTools = { | ||
| /** | ||
| * Programmatic Tool Calling lets OpenAI Responses models write and execute | ||
| * JavaScript that orchestrates eligible tools. | ||
| */ | ||
| programmaticToolCalling, | ||
| /** | ||
| * Tool search allows the model to dynamically search for and load deferred | ||
@@ -142,0 +149,0 @@ * tools into the model's context as needed. This helps reduce overall token |
@@ -36,2 +36,3 @@ import { | ||
| OpenAIResponsesReasoning, | ||
| OpenAIResponsesToolCaller, | ||
| } from './openai-responses-api'; | ||
@@ -42,2 +43,6 @@ import { | ||
| } from '../tool/tool-search'; | ||
| import { | ||
| programmaticToolCallingInputSchema, | ||
| programmaticToolCallingOutputSchema, | ||
| } from '../tool/programmatic-tool-calling'; | ||
@@ -48,2 +53,15 @@ function serializeToolCallArguments(input: unknown): string { | ||
| function mapToolCaller( | ||
| caller: | ||
| | { type: 'direct' } | ||
| | { type: 'program'; callerId: string } | ||
| | undefined, | ||
| ): OpenAIResponsesToolCaller | undefined { | ||
| return caller == null | ||
| ? undefined | ||
| : caller.type === 'program' | ||
| ? { type: 'program', caller_id: caller.callerId } | ||
| : caller; | ||
| } | ||
| type OpenAIPromptCacheBreakpoint = { mode: 'explicit' }; | ||
@@ -356,2 +374,7 @@ | ||
| | undefined; | ||
| const caller = part.providerOptions?.[providerOptionsName] | ||
| ?.caller as | ||
| | { type: 'direct' } | ||
| | { type: 'program'; callerId: string } | ||
| | undefined; | ||
@@ -397,2 +420,23 @@ if (hasConversation && id != null) { | ||
| if (resolvedToolName === 'programmatic_tool_calling') { | ||
| if (store && id != null) { | ||
| input.push({ type: 'item_reference', id }); | ||
| break; | ||
| } | ||
| const parsedInput = await validateTypes({ | ||
| value: part.input, | ||
| schema: programmaticToolCallingInputSchema, | ||
| }); | ||
| input.push({ | ||
| type: 'program', | ||
| id: id ?? part.toolCallId, | ||
| call_id: part.toolCallId, | ||
| code: parsedInput.code, | ||
| fingerprint: parsedInput.fingerprint, | ||
| }); | ||
| break; | ||
| } | ||
| if (part.providerExecuted) { | ||
@@ -560,2 +604,5 @@ if (store && id != null) { | ||
| ...(namespace != null && { namespace }), | ||
| ...(caller != null && { | ||
| caller: mapToolCaller(caller), | ||
| }), | ||
| }); | ||
@@ -622,2 +669,33 @@ break; | ||
| if (resolvedResultToolName === 'programmatic_tool_calling') { | ||
| const itemId = (part.providerOptions?.[providerOptionsName] | ||
| ?.itemId ?? | ||
| ( | ||
| part as { | ||
| providerMetadata?: { | ||
| [providerOptionsName]?: { itemId?: string }; | ||
| }; | ||
| } | ||
| ).providerMetadata?.[providerOptionsName]?.itemId ?? | ||
| part.toolCallId) as string; | ||
| if (store) { | ||
| input.push({ type: 'item_reference', id: itemId }); | ||
| } else if (part.output.type === 'json') { | ||
| const parsedOutput = await validateTypes({ | ||
| value: part.output.value, | ||
| schema: programmaticToolCallingOutputSchema, | ||
| }); | ||
| input.push({ | ||
| type: 'program_output', | ||
| id: itemId, | ||
| call_id: part.toolCallId, | ||
| result: parsedOutput.result, | ||
| status: parsedOutput.status, | ||
| }); | ||
| } | ||
| break; | ||
| } | ||
| /* | ||
@@ -1173,2 +1251,9 @@ * Shell tool results are separate output items (shell_call_output) | ||
| const caller = mapToolCaller( | ||
| part.providerOptions?.[providerOptionsName]?.caller as | ||
| | { type: 'direct' } | ||
| | { type: 'program'; callerId: string } | ||
| | undefined, | ||
| ); | ||
| input.push({ | ||
@@ -1178,2 +1263,3 @@ type: 'function_call_output', | ||
| output: contentValue, | ||
| ...(caller != null && { caller }), | ||
| }); | ||
@@ -1180,0 +1266,0 @@ } |
@@ -87,2 +87,26 @@ import type { JSONObject, JSONSchema7, JSONValue } from '@ai-sdk/provider'; | ||
| const openaiResponsesToolCallerSchema = z.discriminatedUnion('type', [ | ||
| z.object({ type: z.literal('direct') }), | ||
| z.object({ | ||
| type: z.literal('program'), | ||
| caller_id: z.string(), | ||
| }), | ||
| ]); | ||
| const openaiResponsesProgramSchema = z.object({ | ||
| type: z.literal('program'), | ||
| id: z.string(), | ||
| call_id: z.string(), | ||
| code: z.string(), | ||
| fingerprint: z.string(), | ||
| }); | ||
| const openaiResponsesProgramOutputSchema = z.object({ | ||
| type: z.literal('program_output'), | ||
| id: z.string(), | ||
| call_id: z.string(), | ||
| result: z.string(), | ||
| status: z.enum(['completed', 'incomplete']), | ||
| }); | ||
| export type OpenAIResponsesInput = Array<OpenAIResponsesInputItem>; | ||
@@ -96,2 +120,4 @@ | ||
| | OpenAIResponsesFunctionCallOutput | ||
| | OpenAIResponsesProgram | ||
| | OpenAIResponsesProgramOutput | ||
| | OpenAIResponsesCustomToolCall | ||
@@ -206,2 +232,3 @@ | OpenAIResponsesCustomToolCallOutput | ||
| namespace?: string; | ||
| caller?: OpenAIResponsesToolCaller; | ||
| }; | ||
@@ -237,4 +264,25 @@ | ||
| >; | ||
| caller?: OpenAIResponsesToolCaller; | ||
| }; | ||
| export type OpenAIResponsesToolCaller = | ||
| | { type: 'direct' } | ||
| | { type: 'program'; caller_id: string }; | ||
| export type OpenAIResponsesProgram = { | ||
| type: 'program'; | ||
| id: string; | ||
| call_id: string; | ||
| code: string; | ||
| fingerprint: string; | ||
| }; | ||
| export type OpenAIResponsesProgramOutput = { | ||
| type: 'program_output'; | ||
| id: string; | ||
| call_id: string; | ||
| result: string; | ||
| status: 'completed' | 'incomplete'; | ||
| }; | ||
| export type OpenAIResponsesCustomToolCall = { | ||
@@ -435,2 +483,4 @@ type: 'custom_tool_call'; | ||
| defer_loading?: boolean; | ||
| allowed_callers?: Array<'direct' | 'programmatic'>; | ||
| output_schema?: JSONSchema7; | ||
| }; | ||
@@ -612,2 +662,5 @@ | ||
| parameters?: Record<string, unknown>; | ||
| } | ||
| | { | ||
| type: 'programmatic_tool_calling'; | ||
| }; | ||
@@ -770,3 +823,6 @@ | ||
| namespace: z.string().nullish(), | ||
| caller: openaiResponsesToolCallerSchema.nullish(), | ||
| }), | ||
| openaiResponsesProgramSchema, | ||
| openaiResponsesProgramOutputSchema, | ||
| z.object({ | ||
@@ -915,5 +971,8 @@ type: z.literal('web_search_call'), | ||
| arguments: z.string(), | ||
| status: z.literal('completed'), | ||
| status: z.enum(['in_progress', 'completed', 'incomplete']), | ||
| namespace: z.string().nullish(), | ||
| caller: openaiResponsesToolCallerSchema.nullish(), | ||
| }), | ||
| openaiResponsesProgramSchema, | ||
| openaiResponsesProgramOutputSchema, | ||
| z.object({ | ||
@@ -1424,3 +1483,6 @@ type: z.literal('custom_tool_call'), | ||
| namespace: z.string().nullish(), | ||
| caller: openaiResponsesToolCallerSchema.nullish(), | ||
| }), | ||
| openaiResponsesProgramSchema, | ||
| openaiResponsesProgramOutputSchema, | ||
| z.object({ | ||
@@ -1427,0 +1489,0 @@ type: z.literal('custom_tool_call'), |
| import { | ||
| UnsupportedFunctionalityError, | ||
| type JSONSchema7, | ||
| type JSONObject, | ||
| type LanguageModelV4CallOptions, | ||
@@ -27,4 +29,6 @@ type LanguageModelV4FunctionTool, | ||
| type OpenAIToolOptions = { | ||
| export type OpenAIToolOptions = { | ||
| allowedCallers?: Array<'direct' | 'programmatic'>; | ||
| deferLoading?: boolean; | ||
| outputSchema?: JSONObject; | ||
| namespace?: { | ||
@@ -67,2 +71,3 @@ name: string; | ||
| | { type: 'computer' } | ||
| | { type: 'programmatic_tool_calling' } | ||
| | { | ||
@@ -317,2 +322,8 @@ type: 'allowed_tools'; | ||
| } | ||
| case 'openai.programmatic_tool_calling': { | ||
| openaiTools.push({ | ||
| type: 'programmatic_tool_calling', | ||
| }); | ||
| break; | ||
| } | ||
| case 'openai.tool_search': { | ||
@@ -388,3 +399,4 @@ const args = await validateTypes({ | ||
| resolvedToolName === 'apply_patch' || | ||
| resolvedToolName === 'computer' | ||
| resolvedToolName === 'computer' || | ||
| resolvedToolName === 'programmatic_tool_calling' | ||
| ? { type: resolvedToolName } | ||
@@ -422,2 +434,8 @@ : resolvedCustomProviderToolNames.has(resolvedToolName) | ||
| ...(deferLoading != null ? { defer_loading: deferLoading } : {}), | ||
| ...(options?.allowedCallers != null | ||
| ? { allowed_callers: options.allowedCallers } | ||
| : {}), | ||
| ...(options?.outputSchema != null | ||
| ? { output_schema: options.outputSchema as JSONSchema7 } | ||
| : {}), | ||
| }; | ||
@@ -424,0 +442,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
2657721
2.45%80
1.27%33813
2.56%1
-50%