@ai-sdk/openai-compatible 2.0.74 → 2.0.75

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,15 @@
1
1
  # @ai-sdk/openai-compatible
2
2
 
3
+ ## 2.0.75
4
+
5
+ ### Patch Changes
6
+
7
+ - f3c1980: fix(openai-compatible): keep reasoning streams contiguous when deltas include empty tool call arrays
8
+ - 1336501: fix(openai): return an AI SDK error for empty chat completion choices
9
+ - Updated dependencies [1a4dbb1]
10
+ - @ai-sdk/provider@3.0.16
11
+ - @ai-sdk/provider-utils@4.0.51
12
+
3
13
  ## 2.0.74
4
14
 
5
15
  ### Patch Changes
package/dist/index.js CHANGED
@@ -587,6 +587,12 @@ var OpenAICompatibleChatLanguageModel = class {
587
587
  fetch: this.config.fetch
588
588
  });
589
589
  const choice = responseBody.choices[0];
590
+ if (choice == null) {
591
+ throw new import_provider3.InvalidResponseDataError({
592
+ data: rawResponse,
593
+ message: "Response did not contain any choices."
594
+ });
595
+ }
590
596
  const content = [];
591
597
  content.push(...convertOpenAICompatibleContent(choice.message.content));
592
598
  const reasoning = (_a = choice.message.reasoning_content) != null ? _a : choice.message.reasoning;
@@ -771,7 +777,7 @@ var OpenAICompatibleChatLanguageModel = class {
771
777
  enqueueTextDelta(contentPart.text);
772
778
  }
773
779
  }
774
- if (delta.tool_calls != null) {
780
+ if (delta.tool_calls != null && delta.tool_calls.length > 0) {
775
781
  if (isActiveReasoning) {
776
782
  controller.enqueue({
777
783
  type: "reasoning-end",
@@ -1770,7 +1776,7 @@ async function fileToBlob(file) {
1770
1776
  var import_provider_utils6 = require("@ai-sdk/provider-utils");
1771
1777
 
1772
1778
  // src/version.ts
1773
- var VERSION = true ? "2.0.74" : "0.0.0-test";
1779
+ var VERSION = true ? "2.0.75" : "0.0.0-test";
1774
1780
 
1775
1781
  // src/openai-compatible-provider.ts
1776
1782
  function createOpenAICompatible(options) {