@ai-sdk/openai 3.0.111 → 3.0.112

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,14 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.112
4
+
5
+ ### Patch Changes
6
+
7
+ - 1336501: fix(openai): return an AI SDK error for empty chat completion choices
8
+ - Updated dependencies [1a4dbb1]
9
+ - @ai-sdk/provider@3.0.16
10
+ - @ai-sdk/provider-utils@4.0.51
11
+
3
12
  ## 3.0.111
4
13
 
5
14
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1140,6 +1140,12 @@ var OpenAIChatLanguageModel = class {
1140
1140
  fetch: this.config.fetch
1141
1141
  });
1142
1142
  const choice = response.choices[0];
1143
+ if (choice == null) {
1144
+ throw new import_provider4.InvalidResponseDataError({
1145
+ data: rawResponse,
1146
+ message: "Response did not contain any choices."
1147
+ });
1148
+ }
1143
1149
  const content = [];
1144
1150
  const text = choice.message.content;
1145
1151
  if (text != null && text.length > 0) {
@@ -8102,7 +8108,7 @@ var OpenAITranscriptionModel = class {
8102
8108
  };
8103
8109
 
8104
8110
  // src/version.ts
8105
- var VERSION = true ? "3.0.111" : "0.0.0-test";
8111
+ var VERSION = true ? "3.0.112" : "0.0.0-test";
8106
8112
 
8107
8113
  // src/openai-provider.ts
8108
8114
  function createOpenAI(options = {}) {