@ai-sdk/openai 2.0.126 → 2.0.127

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.
@@ -934,6 +934,12 @@ var OpenAIChatLanguageModel = class {
934
934
  fetch: this.config.fetch
935
935
  });
936
936
  const choice = response.choices[0];
937
+ if (choice == null) {
938
+ throw new InvalidResponseDataError({
939
+ data: rawResponse,
940
+ message: "Response did not contain any choices."
941
+ });
942
+ }
937
943
  const content = [];
938
944
  const text = choice.message.content;
939
945
  if (text != null && text.length > 0) {