@ai-sdk/openai 3.0.0-beta.51 → 3.0.0-beta.52
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 +17 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -49
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +16 -48
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +16 -48
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -39,6 +39,15 @@ var openaiFailedResponseHandler = createJsonErrorResponseHandler({
|
|
|
39
39
|
errorToMessage: (data) => data.error.message
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
+
// src/openai-is-reasoning-model.ts
|
|
43
|
+
function isReasoningModel(modelId) {
|
|
44
|
+
if (modelId.startsWith("gpt-3")) return false;
|
|
45
|
+
if (modelId.startsWith("gpt-4")) return false;
|
|
46
|
+
if (modelId.startsWith("chatgpt-4o")) return false;
|
|
47
|
+
if (modelId.startsWith("gpt-5-chat")) return false;
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
// src/chat/convert-to-openai-chat-messages.ts
|
|
43
52
|
import {
|
|
44
53
|
UnsupportedFunctionalityError
|
|
@@ -1044,9 +1053,6 @@ var OpenAIChatLanguageModel = class {
|
|
|
1044
1053
|
};
|
|
1045
1054
|
}
|
|
1046
1055
|
};
|
|
1047
|
-
function isReasoningModel(modelId) {
|
|
1048
|
-
return (modelId.startsWith("o") || modelId.startsWith("gpt-5")) && !modelId.startsWith("gpt-5-chat");
|
|
1049
|
-
}
|
|
1050
1056
|
function supportsFlexProcessing(modelId) {
|
|
1051
1057
|
return modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
1052
1058
|
}
|
|
@@ -1054,32 +1060,8 @@ function supportsPriorityProcessing(modelId) {
|
|
|
1054
1060
|
return modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
1055
1061
|
}
|
|
1056
1062
|
function getSystemMessageMode(modelId) {
|
|
1057
|
-
|
|
1058
|
-
if (!isReasoningModel(modelId)) {
|
|
1059
|
-
return "system";
|
|
1060
|
-
}
|
|
1061
|
-
return (_b = (_a = reasoningModels[modelId]) == null ? void 0 : _a.systemMessageMode) != null ? _b : "developer";
|
|
1063
|
+
return isReasoningModel(modelId) ? "developer" : "system";
|
|
1062
1064
|
}
|
|
1063
|
-
var reasoningModels = {
|
|
1064
|
-
o3: {
|
|
1065
|
-
systemMessageMode: "developer"
|
|
1066
|
-
},
|
|
1067
|
-
"o3-2025-04-16": {
|
|
1068
|
-
systemMessageMode: "developer"
|
|
1069
|
-
},
|
|
1070
|
-
"o3-mini": {
|
|
1071
|
-
systemMessageMode: "developer"
|
|
1072
|
-
},
|
|
1073
|
-
"o3-mini-2025-01-31": {
|
|
1074
|
-
systemMessageMode: "developer"
|
|
1075
|
-
},
|
|
1076
|
-
"o4-mini": {
|
|
1077
|
-
systemMessageMode: "developer"
|
|
1078
|
-
},
|
|
1079
|
-
"o4-mini-2025-04-16": {
|
|
1080
|
-
systemMessageMode: "developer"
|
|
1081
|
-
}
|
|
1082
|
-
};
|
|
1083
1065
|
|
|
1084
1066
|
// src/completion/openai-completion-language-model.ts
|
|
1085
1067
|
import {
|
|
@@ -4236,27 +4218,13 @@ function isErrorChunk(chunk) {
|
|
|
4236
4218
|
function getResponsesModelConfig(modelId) {
|
|
4237
4219
|
const supportsFlexProcessing2 = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
4238
4220
|
const supportsPriorityProcessing2 = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
4239
|
-
const
|
|
4240
|
-
|
|
4241
|
-
supportsFlexProcessing: supportsFlexProcessing2,
|
|
4242
|
-
supportsPriorityProcessing: supportsPriorityProcessing2
|
|
4243
|
-
};
|
|
4244
|
-
if (modelId.startsWith("gpt-5-chat")) {
|
|
4245
|
-
return {
|
|
4246
|
-
...defaults,
|
|
4247
|
-
isReasoningModel: false
|
|
4248
|
-
};
|
|
4249
|
-
}
|
|
4250
|
-
if (modelId.startsWith("o") || modelId.startsWith("gpt-5") || modelId.startsWith("codex-") || modelId.startsWith("computer-use")) {
|
|
4251
|
-
return {
|
|
4252
|
-
...defaults,
|
|
4253
|
-
isReasoningModel: true,
|
|
4254
|
-
systemMessageMode: "developer"
|
|
4255
|
-
};
|
|
4256
|
-
}
|
|
4221
|
+
const isReasoningModel2 = isReasoningModel(modelId);
|
|
4222
|
+
const systemMessageMode = isReasoningModel2 ? "developer" : "system";
|
|
4257
4223
|
return {
|
|
4258
|
-
|
|
4259
|
-
|
|
4224
|
+
systemMessageMode,
|
|
4225
|
+
supportsFlexProcessing: supportsFlexProcessing2,
|
|
4226
|
+
supportsPriorityProcessing: supportsPriorityProcessing2,
|
|
4227
|
+
isReasoningModel: isReasoningModel2
|
|
4260
4228
|
};
|
|
4261
4229
|
}
|
|
4262
4230
|
function mapWebSearchOutput(action) {
|
|
@@ -4642,7 +4610,7 @@ var OpenAITranscriptionModel = class {
|
|
|
4642
4610
|
};
|
|
4643
4611
|
|
|
4644
4612
|
// src/version.ts
|
|
4645
|
-
var VERSION = true ? "3.0.0-beta.
|
|
4613
|
+
var VERSION = true ? "3.0.0-beta.52" : "0.0.0-test";
|
|
4646
4614
|
|
|
4647
4615
|
// src/openai-provider.ts
|
|
4648
4616
|
function createOpenAI(options = {}) {
|