@ai-sdk/openai-compatible 2.0.74 → 2.0.76

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/dist/index.mjs CHANGED
@@ -573,6 +573,12 @@ var OpenAICompatibleChatLanguageModel = class {
573
573
  fetch: this.config.fetch
574
574
  });
575
575
  const choice = responseBody.choices[0];
576
+ if (choice == null) {
577
+ throw new InvalidResponseDataError({
578
+ data: rawResponse,
579
+ message: "Response did not contain any choices."
580
+ });
581
+ }
576
582
  const content = [];
577
583
  content.push(...convertOpenAICompatibleContent(choice.message.content));
578
584
  const reasoning = (_a = choice.message.reasoning_content) != null ? _a : choice.message.reasoning;
@@ -757,7 +763,7 @@ var OpenAICompatibleChatLanguageModel = class {
757
763
  enqueueTextDelta(contentPart.text);
758
764
  }
759
765
  }
760
- if (delta.tool_calls != null) {
766
+ if (delta.tool_calls != null && delta.tool_calls.length > 0) {
761
767
  if (isActiveReasoning) {
762
768
  controller.enqueue({
763
769
  type: "reasoning-end",
@@ -1786,7 +1792,7 @@ import {
1786
1792
  } from "@ai-sdk/provider-utils";
1787
1793
 
1788
1794
  // src/version.ts
1789
- var VERSION = true ? "2.0.74" : "0.0.0-test";
1795
+ var VERSION = true ? "2.0.76" : "0.0.0-test";
1790
1796
 
1791
1797
  // src/openai-compatible-provider.ts
1792
1798
  function createOpenAICompatible(options) {