@ai-sdk/openai 1.1.10 → 1.1.12

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 1.1.12
4
+
5
+ ### Patch Changes
6
+
7
+ - ea159cb: chore (provider/openai): remove default streaming simulation for o1
8
+
9
+ ## 1.1.11
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [2e898b4]
14
+ - @ai-sdk/provider-utils@2.1.8
15
+
3
16
  ## 1.1.10
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -672,8 +672,7 @@ var OpenAIChatLanguageModel = class {
672
672
  };
673
673
  }
674
674
  async doStream(options) {
675
- var _a;
676
- if ((_a = this.settings.simulateStreaming) != null ? _a : isStreamingSimulatedByDefault(this.modelId)) {
675
+ if (this.settings.simulateStreaming) {
677
676
  const result = await this.doGenerate(options);
678
677
  const simulatedStream = new ReadableStream({
679
678
  start(controller) {
@@ -752,7 +751,7 @@ var OpenAIChatLanguageModel = class {
752
751
  stream: response.pipeThrough(
753
752
  new TransformStream({
754
753
  transform(chunk, controller) {
755
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
754
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
756
755
  if (!chunk.success) {
757
756
  finishReason = "error";
758
757
  controller.enqueue({ type: "error", error: chunk.error });
@@ -840,7 +839,7 @@ var OpenAIChatLanguageModel = class {
840
839
  message: `Expected 'id' to be a string.`
841
840
  });
842
841
  }
843
- if (((_a2 = toolCallDelta.function) == null ? void 0 : _a2.name) == null) {
842
+ if (((_a = toolCallDelta.function) == null ? void 0 : _a.name) == null) {
844
843
  throw new import_provider3.InvalidResponseDataError({
845
844
  data: toolCallDelta,
846
845
  message: `Expected 'function.name' to be a string.`
@@ -907,13 +906,13 @@ var OpenAIChatLanguageModel = class {
907
906
  }
908
907
  },
909
908
  flush(controller) {
910
- var _a2, _b;
909
+ var _a, _b;
911
910
  controller.enqueue({
912
911
  type: "finish",
913
912
  finishReason,
914
913
  logprobs,
915
914
  usage: {
916
- promptTokens: (_a2 = usage.promptTokens) != null ? _a2 : NaN,
915
+ promptTokens: (_a = usage.promptTokens) != null ? _a : NaN,
917
916
  completionTokens: (_b = usage.completionTokens) != null ? _b : NaN
918
917
  },
919
918
  ...providerMetadata != null ? { providerMetadata } : {}
@@ -1045,37 +1044,24 @@ function getSystemMessageMode(modelId) {
1045
1044
  }
1046
1045
  return (_b = (_a = reasoningModels[modelId]) == null ? void 0 : _a.systemMessageMode) != null ? _b : "developer";
1047
1046
  }
1048
- function isStreamingSimulatedByDefault(modelId) {
1049
- var _a, _b;
1050
- if (!isReasoningModel(modelId)) {
1051
- return false;
1052
- }
1053
- return (_b = (_a = reasoningModels[modelId]) == null ? void 0 : _a.simulateStreamingByDefault) != null ? _b : true;
1054
- }
1055
1047
  var reasoningModels = {
1056
1048
  "o1-mini": {
1057
- systemMessageMode: "remove",
1058
- simulateStreamingByDefault: false
1049
+ systemMessageMode: "remove"
1059
1050
  },
1060
1051
  "o1-mini-2024-09-12": {
1061
- systemMessageMode: "remove",
1062
- simulateStreamingByDefault: false
1052
+ systemMessageMode: "remove"
1063
1053
  },
1064
1054
  "o1-preview": {
1065
- systemMessageMode: "remove",
1066
- simulateStreamingByDefault: false
1055
+ systemMessageMode: "remove"
1067
1056
  },
1068
1057
  "o1-preview-2024-09-12": {
1069
- systemMessageMode: "remove",
1070
- simulateStreamingByDefault: false
1058
+ systemMessageMode: "remove"
1071
1059
  },
1072
1060
  "o3-mini": {
1073
- systemMessageMode: "developer",
1074
- simulateStreamingByDefault: false
1061
+ systemMessageMode: "developer"
1075
1062
  },
1076
1063
  "o3-mini-2025-01-31": {
1077
- systemMessageMode: "developer",
1078
- simulateStreamingByDefault: false
1064
+ systemMessageMode: "developer"
1079
1065
  }
1080
1066
  };
1081
1067