@ai-sdk/openai 3.0.87 → 3.0.88
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 +31 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -14
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +2 -1
- package/dist/internal/index.d.ts +2 -1
- package/dist/internal/index.js +32 -13
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +31 -13
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/image/openai-image-model-options.ts +8 -7
- package/src/image/openai-image-model.ts +2 -2
- package/src/openai-language-model-capabilities.ts +47 -22
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -54,10 +54,15 @@ var openaiFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
|
|
|
54
54
|
|
|
55
55
|
// src/openai-language-model-capabilities.ts
|
|
56
56
|
function getOpenAILanguageModelCapabilities(modelId) {
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
57
|
+
var _a, _b, _c, _d, _e;
|
|
58
|
+
const oSeriesVersion = getOSeriesVersion(modelId);
|
|
59
|
+
const gptVersion = getGptVersion(modelId);
|
|
60
|
+
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);
|
|
61
|
+
const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
|
|
62
|
+
const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
|
|
63
|
+
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
|
|
64
|
+
const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
|
|
65
|
+
const supportsNonReasoningParameters = gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
|
|
61
66
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
62
67
|
return {
|
|
63
68
|
supportsFlexProcessing,
|
|
@@ -67,6 +72,21 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
67
72
|
supportsNonReasoningParameters
|
|
68
73
|
};
|
|
69
74
|
}
|
|
75
|
+
function getOSeriesVersion(modelId) {
|
|
76
|
+
const match = /^o(\d+)(?:-|$)/.exec(modelId);
|
|
77
|
+
return match == null ? void 0 : Number(match[1]);
|
|
78
|
+
}
|
|
79
|
+
function getGptVersion(modelId) {
|
|
80
|
+
const match = /^gpt-(\d+)(?:\.(\d+))?(?:-(.+))?$/.exec(modelId);
|
|
81
|
+
if (match == null) {
|
|
82
|
+
return void 0;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
major: Number(match[1]),
|
|
86
|
+
minor: match[2] == null ? void 0 : Number(match[2]),
|
|
87
|
+
variant: match[3]
|
|
88
|
+
};
|
|
89
|
+
}
|
|
70
90
|
|
|
71
91
|
// src/openai-stream-error.ts
|
|
72
92
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -1986,18 +2006,16 @@ var modelMaxImagesPerCall = {
|
|
|
1986
2006
|
"gpt-image-2": 10,
|
|
1987
2007
|
"chatgpt-image-latest": 10
|
|
1988
2008
|
};
|
|
1989
|
-
var defaultResponseFormatPrefixes = [
|
|
1990
|
-
"chatgpt-image-",
|
|
1991
|
-
"gpt-image-1-mini",
|
|
1992
|
-
"gpt-image-1.5",
|
|
1993
|
-
"gpt-image-1",
|
|
1994
|
-
"gpt-image-2"
|
|
1995
|
-
];
|
|
2009
|
+
var defaultResponseFormatPrefixes = ["chatgpt-image-", "gpt-image-"];
|
|
1996
2010
|
function hasDefaultResponseFormat(modelId) {
|
|
1997
2011
|
return defaultResponseFormatPrefixes.some(
|
|
1998
2012
|
(prefix) => modelId.startsWith(prefix)
|
|
1999
2013
|
);
|
|
2000
2014
|
}
|
|
2015
|
+
function getMaxImagesPerCall(modelId) {
|
|
2016
|
+
var _a;
|
|
2017
|
+
return (_a = modelMaxImagesPerCall[modelId]) != null ? _a : modelId.startsWith("gpt-image-") ? 10 : 1;
|
|
2018
|
+
}
|
|
2001
2019
|
var baseImageModelOptionsObject = import_v49.z.object({
|
|
2002
2020
|
/**
|
|
2003
2021
|
* Quality of the generated image(s).
|
|
@@ -2066,8 +2084,7 @@ var OpenAIImageModel = class {
|
|
|
2066
2084
|
this.specificationVersion = "v3";
|
|
2067
2085
|
}
|
|
2068
2086
|
get maxImagesPerCall() {
|
|
2069
|
-
|
|
2070
|
-
return (_a = modelMaxImagesPerCall[this.modelId]) != null ? _a : 1;
|
|
2087
|
+
return getMaxImagesPerCall(this.modelId);
|
|
2071
2088
|
}
|
|
2072
2089
|
get provider() {
|
|
2073
2090
|
return this.config.provider;
|
|
@@ -7330,7 +7347,7 @@ var OpenAITranscriptionModel = class {
|
|
|
7330
7347
|
};
|
|
7331
7348
|
|
|
7332
7349
|
// src/version.ts
|
|
7333
|
-
var VERSION = true ? "3.0.
|
|
7350
|
+
var VERSION = true ? "3.0.88" : "0.0.0-test";
|
|
7334
7351
|
|
|
7335
7352
|
// src/openai-provider.ts
|
|
7336
7353
|
function createOpenAI(options = {}) {
|