@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.
@@ -31,6 +31,15 @@ var openaiFailedResponseHandler = createJsonErrorResponseHandler({
31
31
  errorToMessage: (data) => data.error.message
32
32
  });
33
33
 
34
+ // src/openai-is-reasoning-model.ts
35
+ function isReasoningModel(modelId) {
36
+ if (modelId.startsWith("gpt-3")) return false;
37
+ if (modelId.startsWith("gpt-4")) return false;
38
+ if (modelId.startsWith("chatgpt-4o")) return false;
39
+ if (modelId.startsWith("gpt-5-chat")) return false;
40
+ return true;
41
+ }
42
+
34
43
  // src/chat/convert-to-openai-chat-messages.ts
35
44
  import {
36
45
  UnsupportedFunctionalityError
@@ -1036,9 +1045,6 @@ var OpenAIChatLanguageModel = class {
1036
1045
  };
1037
1046
  }
1038
1047
  };
1039
- function isReasoningModel(modelId) {
1040
- return (modelId.startsWith("o") || modelId.startsWith("gpt-5")) && !modelId.startsWith("gpt-5-chat");
1041
- }
1042
1048
  function supportsFlexProcessing(modelId) {
1043
1049
  return modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
1044
1050
  }
@@ -1046,32 +1052,8 @@ function supportsPriorityProcessing(modelId) {
1046
1052
  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");
1047
1053
  }
1048
1054
  function getSystemMessageMode(modelId) {
1049
- var _a, _b;
1050
- if (!isReasoningModel(modelId)) {
1051
- return "system";
1052
- }
1053
- return (_b = (_a = reasoningModels[modelId]) == null ? void 0 : _a.systemMessageMode) != null ? _b : "developer";
1055
+ return isReasoningModel(modelId) ? "developer" : "system";
1054
1056
  }
1055
- var reasoningModels = {
1056
- o3: {
1057
- systemMessageMode: "developer"
1058
- },
1059
- "o3-2025-04-16": {
1060
- systemMessageMode: "developer"
1061
- },
1062
- "o3-mini": {
1063
- systemMessageMode: "developer"
1064
- },
1065
- "o3-mini-2025-01-31": {
1066
- systemMessageMode: "developer"
1067
- },
1068
- "o4-mini": {
1069
- systemMessageMode: "developer"
1070
- },
1071
- "o4-mini-2025-04-16": {
1072
- systemMessageMode: "developer"
1073
- }
1074
- };
1075
1057
 
1076
1058
  // src/completion/openai-completion-language-model.ts
1077
1059
  import {
@@ -4517,27 +4499,13 @@ function isErrorChunk(chunk) {
4517
4499
  function getResponsesModelConfig(modelId) {
4518
4500
  const supportsFlexProcessing2 = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
4519
4501
  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");
4520
- const defaults = {
4521
- systemMessageMode: "system",
4522
- supportsFlexProcessing: supportsFlexProcessing2,
4523
- supportsPriorityProcessing: supportsPriorityProcessing2
4524
- };
4525
- if (modelId.startsWith("gpt-5-chat")) {
4526
- return {
4527
- ...defaults,
4528
- isReasoningModel: false
4529
- };
4530
- }
4531
- if (modelId.startsWith("o") || modelId.startsWith("gpt-5") || modelId.startsWith("codex-") || modelId.startsWith("computer-use")) {
4532
- return {
4533
- ...defaults,
4534
- isReasoningModel: true,
4535
- systemMessageMode: "developer"
4536
- };
4537
- }
4502
+ const isReasoningModel2 = isReasoningModel(modelId);
4503
+ const systemMessageMode = isReasoningModel2 ? "developer" : "system";
4538
4504
  return {
4539
- ...defaults,
4540
- isReasoningModel: false
4505
+ systemMessageMode,
4506
+ supportsFlexProcessing: supportsFlexProcessing2,
4507
+ supportsPriorityProcessing: supportsPriorityProcessing2,
4508
+ isReasoningModel: isReasoningModel2
4541
4509
  };
4542
4510
  }
4543
4511
  function mapWebSearchOutput(action) {