@ai-sdk/openai 3.0.87 → 3.0.89

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/dist/index.mjs CHANGED
@@ -40,10 +40,15 @@ var openaiFailedResponseHandler = createJsonErrorResponseHandler({
40
40
 
41
41
  // src/openai-language-model-capabilities.ts
42
42
  function getOpenAILanguageModelCapabilities(modelId) {
43
- const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
44
- const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") && !modelId.startsWith("gpt-5.4-nano") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
45
- const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
46
- const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4") || modelId.startsWith("gpt-5.5") || modelId.startsWith("gpt-5.6");
43
+ var _a, _b, _c, _d, _e;
44
+ const oSeriesVersion = getOSeriesVersion(modelId);
45
+ const gptVersion = getGptVersion(modelId);
46
+ const isGptChatModel = (gptVersion == null ? void 0 : gptVersion.minor) == null && ((_b = (_a = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _a.startsWith("chat")) != null ? _b : false);
47
+ const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
48
+ const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
49
+ const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
50
+ const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
51
+ const supportsNonReasoningParameters = gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
47
52
  const systemMessageMode = isReasoningModel ? "developer" : "system";
48
53
  return {
49
54
  supportsFlexProcessing,
@@ -53,6 +58,21 @@ function getOpenAILanguageModelCapabilities(modelId) {
53
58
  supportsNonReasoningParameters
54
59
  };
55
60
  }
61
+ function getOSeriesVersion(modelId) {
62
+ const match = /^o(\d+)(?:-|$)/.exec(modelId);
63
+ return match == null ? void 0 : Number(match[1]);
64
+ }
65
+ function getGptVersion(modelId) {
66
+ const match = /^gpt-(\d+)(?:\.(\d+))?(?:-(.+))?$/.exec(modelId);
67
+ if (match == null) {
68
+ return void 0;
69
+ }
70
+ return {
71
+ major: Number(match[1]),
72
+ minor: match[2] == null ? void 0 : Number(match[2]),
73
+ variant: match[3]
74
+ };
75
+ }
56
76
 
57
77
  // src/openai-stream-error.ts
58
78
  import { APICallError } from "@ai-sdk/provider";
@@ -2019,18 +2039,16 @@ var modelMaxImagesPerCall = {
2019
2039
  "gpt-image-2": 10,
2020
2040
  "chatgpt-image-latest": 10
2021
2041
  };
2022
- var defaultResponseFormatPrefixes = [
2023
- "chatgpt-image-",
2024
- "gpt-image-1-mini",
2025
- "gpt-image-1.5",
2026
- "gpt-image-1",
2027
- "gpt-image-2"
2028
- ];
2042
+ var defaultResponseFormatPrefixes = ["chatgpt-image-", "gpt-image-"];
2029
2043
  function hasDefaultResponseFormat(modelId) {
2030
2044
  return defaultResponseFormatPrefixes.some(
2031
2045
  (prefix) => modelId.startsWith(prefix)
2032
2046
  );
2033
2047
  }
2048
+ function getMaxImagesPerCall(modelId) {
2049
+ var _a;
2050
+ return (_a = modelMaxImagesPerCall[modelId]) != null ? _a : modelId.startsWith("gpt-image-") ? 10 : 1;
2051
+ }
2034
2052
  var baseImageModelOptionsObject = z9.object({
2035
2053
  /**
2036
2054
  * Quality of the generated image(s).
@@ -2099,8 +2117,7 @@ var OpenAIImageModel = class {
2099
2117
  this.specificationVersion = "v3";
2100
2118
  }
2101
2119
  get maxImagesPerCall() {
2102
- var _a;
2103
- return (_a = modelMaxImagesPerCall[this.modelId]) != null ? _a : 1;
2120
+ return getMaxImagesPerCall(this.modelId);
2104
2121
  }
2105
2122
  get provider() {
2106
2123
  return this.config.provider;
@@ -2703,7 +2720,10 @@ var webSearchArgsSchema = lazySchema17(
2703
2720
  () => zodSchema17(
2704
2721
  z18.object({
2705
2722
  externalWebAccess: z18.boolean().optional(),
2706
- filters: z18.object({ allowedDomains: z18.array(z18.string()).optional() }).optional(),
2723
+ filters: z18.object({
2724
+ allowedDomains: z18.array(z18.string()).optional(),
2725
+ blockedDomains: z18.array(z18.string()).optional()
2726
+ }).optional(),
2707
2727
  searchContextSize: z18.enum(["low", "medium", "high"]).optional(),
2708
2728
  userLocation: z18.object({
2709
2729
  type: z18.literal("approximate"),
@@ -5070,7 +5090,10 @@ async function prepareResponsesTools({
5070
5090
  });
5071
5091
  openaiTools2.push({
5072
5092
  type: "web_search",
5073
- filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
5093
+ filters: args.filters != null ? {
5094
+ allowed_domains: args.filters.allowedDomains,
5095
+ blocked_domains: args.filters.blockedDomains
5096
+ } : void 0,
5074
5097
  external_web_access: args.externalWebAccess,
5075
5098
  search_context_size: args.searchContextSize,
5076
5099
  user_location: args.userLocation
@@ -7451,7 +7474,7 @@ var OpenAITranscriptionModel = class {
7451
7474
  };
7452
7475
 
7453
7476
  // src/version.ts
7454
- var VERSION = true ? "3.0.87" : "0.0.0-test";
7477
+ var VERSION = true ? "3.0.89" : "0.0.0-test";
7455
7478
 
7456
7479
  // src/openai-provider.ts
7457
7480
  function createOpenAI(options = {}) {