@ai-sdk/openai 3.0.0-beta.27 → 3.0.0-beta.28
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.d.mts +64 -3
- package/dist/index.d.ts +64 -3
- package/dist/index.js +50 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -65
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +48 -59
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +52 -63
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.js
CHANGED
|
@@ -2529,11 +2529,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2529
2529
|
import_v414.z.object({
|
|
2530
2530
|
type: import_v414.z.literal("web_search_call"),
|
|
2531
2531
|
id: import_v414.z.string(),
|
|
2532
|
-
status: import_v414.z.string()
|
|
2533
|
-
action: import_v414.z.object({
|
|
2534
|
-
type: import_v414.z.literal("search"),
|
|
2535
|
-
query: import_v414.z.string().optional()
|
|
2536
|
-
}).nullish()
|
|
2532
|
+
status: import_v414.z.string()
|
|
2537
2533
|
}),
|
|
2538
2534
|
import_v414.z.object({
|
|
2539
2535
|
type: import_v414.z.literal("computer_call"),
|
|
@@ -2619,7 +2615,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2619
2615
|
url: import_v414.z.string(),
|
|
2620
2616
|
pattern: import_v414.z.string()
|
|
2621
2617
|
})
|
|
2622
|
-
])
|
|
2618
|
+
])
|
|
2623
2619
|
}),
|
|
2624
2620
|
import_v414.z.object({
|
|
2625
2621
|
type: import_v414.z.literal("file_search_call"),
|
|
@@ -2800,7 +2796,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2800
2796
|
url: import_v414.z.string(),
|
|
2801
2797
|
pattern: import_v414.z.string()
|
|
2802
2798
|
})
|
|
2803
|
-
])
|
|
2799
|
+
])
|
|
2804
2800
|
}),
|
|
2805
2801
|
import_v414.z.object({
|
|
2806
2802
|
type: import_v414.z.literal("file_search_call"),
|
|
@@ -3095,9 +3091,7 @@ var import_v418 = require("zod/v4");
|
|
|
3095
3091
|
var webSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
3096
3092
|
() => (0, import_provider_utils25.zodSchema)(
|
|
3097
3093
|
import_v418.z.object({
|
|
3098
|
-
filters: import_v418.z.object({
|
|
3099
|
-
allowedDomains: import_v418.z.array(import_v418.z.string()).optional()
|
|
3100
|
-
}).optional(),
|
|
3094
|
+
filters: import_v418.z.object({ allowedDomains: import_v418.z.array(import_v418.z.string()).optional() }).optional(),
|
|
3101
3095
|
searchContextSize: import_v418.z.enum(["low", "medium", "high"]).optional(),
|
|
3102
3096
|
userLocation: import_v418.z.object({
|
|
3103
3097
|
type: import_v418.z.literal("approximate"),
|
|
@@ -3109,16 +3103,17 @@ var webSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
3109
3103
|
})
|
|
3110
3104
|
)
|
|
3111
3105
|
);
|
|
3112
|
-
var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(
|
|
3106
|
+
var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(() => (0, import_provider_utils25.zodSchema)(import_v418.z.object({})));
|
|
3107
|
+
var webSearchOutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
3113
3108
|
() => (0, import_provider_utils25.zodSchema)(
|
|
3114
3109
|
import_v418.z.object({
|
|
3115
3110
|
action: import_v418.z.discriminatedUnion("type", [
|
|
3116
3111
|
import_v418.z.object({
|
|
3117
3112
|
type: import_v418.z.literal("search"),
|
|
3118
|
-
query: import_v418.z.string().
|
|
3113
|
+
query: import_v418.z.string().optional()
|
|
3119
3114
|
}),
|
|
3120
3115
|
import_v418.z.object({
|
|
3121
|
-
type: import_v418.z.literal("
|
|
3116
|
+
type: import_v418.z.literal("openPage"),
|
|
3122
3117
|
url: import_v418.z.string()
|
|
3123
3118
|
}),
|
|
3124
3119
|
import_v418.z.object({
|
|
@@ -3126,14 +3121,15 @@ var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
3126
3121
|
url: import_v418.z.string(),
|
|
3127
3122
|
pattern: import_v418.z.string()
|
|
3128
3123
|
})
|
|
3129
|
-
])
|
|
3124
|
+
])
|
|
3130
3125
|
})
|
|
3131
3126
|
)
|
|
3132
3127
|
);
|
|
3133
|
-
var webSearchToolFactory = (0, import_provider_utils25.
|
|
3128
|
+
var webSearchToolFactory = (0, import_provider_utils25.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3134
3129
|
id: "openai.web_search",
|
|
3135
3130
|
name: "web_search",
|
|
3136
|
-
inputSchema: webSearchInputSchema
|
|
3131
|
+
inputSchema: webSearchInputSchema,
|
|
3132
|
+
outputSchema: webSearchOutputSchema
|
|
3137
3133
|
});
|
|
3138
3134
|
|
|
3139
3135
|
// src/tool/web-search-preview.ts
|
|
@@ -3142,51 +3138,30 @@ var import_v419 = require("zod/v4");
|
|
|
3142
3138
|
var webSearchPreviewArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
3143
3139
|
() => (0, import_provider_utils26.zodSchema)(
|
|
3144
3140
|
import_v419.z.object({
|
|
3145
|
-
/**
|
|
3146
|
-
* Search context size to use for the web search.
|
|
3147
|
-
* - high: Most comprehensive context, highest cost, slower response
|
|
3148
|
-
* - medium: Balanced context, cost, and latency (default)
|
|
3149
|
-
* - low: Least context, lowest cost, fastest response
|
|
3150
|
-
*/
|
|
3151
3141
|
searchContextSize: import_v419.z.enum(["low", "medium", "high"]).optional(),
|
|
3152
|
-
/**
|
|
3153
|
-
* User location information to provide geographically relevant search results.
|
|
3154
|
-
*/
|
|
3155
3142
|
userLocation: import_v419.z.object({
|
|
3156
|
-
/**
|
|
3157
|
-
* Type of location (always 'approximate')
|
|
3158
|
-
*/
|
|
3159
3143
|
type: import_v419.z.literal("approximate"),
|
|
3160
|
-
/**
|
|
3161
|
-
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
3162
|
-
*/
|
|
3163
3144
|
country: import_v419.z.string().optional(),
|
|
3164
|
-
/**
|
|
3165
|
-
* City name (free text, e.g., 'Minneapolis')
|
|
3166
|
-
*/
|
|
3167
3145
|
city: import_v419.z.string().optional(),
|
|
3168
|
-
/**
|
|
3169
|
-
* Region name (free text, e.g., 'Minnesota')
|
|
3170
|
-
*/
|
|
3171
3146
|
region: import_v419.z.string().optional(),
|
|
3172
|
-
/**
|
|
3173
|
-
* IANA timezone (e.g., 'America/Chicago')
|
|
3174
|
-
*/
|
|
3175
3147
|
timezone: import_v419.z.string().optional()
|
|
3176
3148
|
}).optional()
|
|
3177
3149
|
})
|
|
3178
3150
|
)
|
|
3179
3151
|
);
|
|
3180
3152
|
var webSearchPreviewInputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3153
|
+
() => (0, import_provider_utils26.zodSchema)(import_v419.z.object({}))
|
|
3154
|
+
);
|
|
3155
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3181
3156
|
() => (0, import_provider_utils26.zodSchema)(
|
|
3182
3157
|
import_v419.z.object({
|
|
3183
3158
|
action: import_v419.z.discriminatedUnion("type", [
|
|
3184
3159
|
import_v419.z.object({
|
|
3185
3160
|
type: import_v419.z.literal("search"),
|
|
3186
|
-
query: import_v419.z.string().
|
|
3161
|
+
query: import_v419.z.string().optional()
|
|
3187
3162
|
}),
|
|
3188
3163
|
import_v419.z.object({
|
|
3189
|
-
type: import_v419.z.literal("
|
|
3164
|
+
type: import_v419.z.literal("openPage"),
|
|
3190
3165
|
url: import_v419.z.string()
|
|
3191
3166
|
}),
|
|
3192
3167
|
import_v419.z.object({
|
|
@@ -3194,14 +3169,15 @@ var webSearchPreviewInputSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
3194
3169
|
url: import_v419.z.string(),
|
|
3195
3170
|
pattern: import_v419.z.string()
|
|
3196
3171
|
})
|
|
3197
|
-
])
|
|
3172
|
+
])
|
|
3198
3173
|
})
|
|
3199
3174
|
)
|
|
3200
3175
|
);
|
|
3201
|
-
var webSearchPreview = (0, import_provider_utils26.
|
|
3176
|
+
var webSearchPreview = (0, import_provider_utils26.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3202
3177
|
id: "openai.web_search_preview",
|
|
3203
3178
|
name: "web_search_preview",
|
|
3204
|
-
inputSchema: webSearchPreviewInputSchema
|
|
3179
|
+
inputSchema: webSearchPreviewInputSchema,
|
|
3180
|
+
outputSchema: webSearchPreviewOutputSchema
|
|
3205
3181
|
});
|
|
3206
3182
|
|
|
3207
3183
|
// src/tool/image-generation.ts
|
|
@@ -3747,14 +3723,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3747
3723
|
type: "tool-call",
|
|
3748
3724
|
toolCallId: part.id,
|
|
3749
3725
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3750
|
-
input: JSON.stringify({
|
|
3726
|
+
input: JSON.stringify({}),
|
|
3751
3727
|
providerExecuted: true
|
|
3752
3728
|
});
|
|
3753
3729
|
content.push({
|
|
3754
3730
|
type: "tool-result",
|
|
3755
3731
|
toolCallId: part.id,
|
|
3756
3732
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3757
|
-
result:
|
|
3733
|
+
result: mapWebSearchOutput(part.action),
|
|
3758
3734
|
providerExecuted: true
|
|
3759
3735
|
});
|
|
3760
3736
|
break;
|
|
@@ -3938,6 +3914,17 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3938
3914
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3939
3915
|
providerExecuted: true
|
|
3940
3916
|
});
|
|
3917
|
+
controller.enqueue({
|
|
3918
|
+
type: "tool-input-end",
|
|
3919
|
+
id: value.item.id
|
|
3920
|
+
});
|
|
3921
|
+
controller.enqueue({
|
|
3922
|
+
type: "tool-call",
|
|
3923
|
+
toolCallId: value.item.id,
|
|
3924
|
+
toolName: "web_search",
|
|
3925
|
+
input: JSON.stringify({}),
|
|
3926
|
+
providerExecuted: true
|
|
3927
|
+
});
|
|
3941
3928
|
} else if (value.item.type === "computer_call") {
|
|
3942
3929
|
ongoingToolCalls[value.output_index] = {
|
|
3943
3930
|
toolName: "computer_use",
|
|
@@ -4031,22 +4018,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4031
4018
|
});
|
|
4032
4019
|
} else if (value.item.type === "web_search_call") {
|
|
4033
4020
|
ongoingToolCalls[value.output_index] = void 0;
|
|
4034
|
-
controller.enqueue({
|
|
4035
|
-
type: "tool-input-end",
|
|
4036
|
-
id: value.item.id
|
|
4037
|
-
});
|
|
4038
|
-
controller.enqueue({
|
|
4039
|
-
type: "tool-call",
|
|
4040
|
-
toolCallId: value.item.id,
|
|
4041
|
-
toolName: "web_search",
|
|
4042
|
-
input: JSON.stringify({ action: value.item.action }),
|
|
4043
|
-
providerExecuted: true
|
|
4044
|
-
});
|
|
4045
4021
|
controller.enqueue({
|
|
4046
4022
|
type: "tool-result",
|
|
4047
4023
|
toolCallId: value.item.id,
|
|
4048
4024
|
toolName: "web_search",
|
|
4049
|
-
result:
|
|
4025
|
+
result: mapWebSearchOutput(value.item.action),
|
|
4050
4026
|
providerExecuted: true
|
|
4051
4027
|
});
|
|
4052
4028
|
} else if (value.item.type === "computer_call") {
|
|
@@ -4391,6 +4367,19 @@ function getResponsesModelConfig(modelId) {
|
|
|
4391
4367
|
isReasoningModel: false
|
|
4392
4368
|
};
|
|
4393
4369
|
}
|
|
4370
|
+
function mapWebSearchOutput(action) {
|
|
4371
|
+
var _a;
|
|
4372
|
+
switch (action.type) {
|
|
4373
|
+
case "search":
|
|
4374
|
+
return { action: { type: "search", query: (_a = action.query) != null ? _a : void 0 } };
|
|
4375
|
+
case "open_page":
|
|
4376
|
+
return { action: { type: "openPage", url: action.url } };
|
|
4377
|
+
case "find":
|
|
4378
|
+
return {
|
|
4379
|
+
action: { type: "find", url: action.url, pattern: action.pattern }
|
|
4380
|
+
};
|
|
4381
|
+
}
|
|
4382
|
+
}
|
|
4394
4383
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4395
4384
|
0 && (module.exports = {
|
|
4396
4385
|
OpenAIChatLanguageModel,
|