@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.
@@ -1175,6 +1175,12 @@ var OpenAIChatLanguageModel = class {
1175
1175
  fetch: this.config.fetch
1176
1176
  });
1177
1177
  const choice = response.choices[0];
1178
+ if (choice == null) {
1179
+ throw new import_provider4.InvalidResponseDataError({
1180
+ data: rawResponse,
1181
+ message: "Response did not contain any choices."
1182
+ });
1183
+ }
1178
1184
  const content = [];
1179
1185
  const text = choice.message.content;
1180
1186
  if (text != null && text.length > 0) {