@ai-sdk/openai-compatible 2.0.68 → 2.0.70

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
@@ -657,10 +657,7 @@ var OpenAICompatibleChatLanguageModel = class {
657
657
  });
658
658
  const toolCalls = [];
659
659
  const pendingToolCalls = /* @__PURE__ */ new Map();
660
- let finishReason = {
661
- unified: "other",
662
- raw: void 0
663
- };
660
+ let finishReason;
664
661
  let usage = void 0;
665
662
  let isFirstChunk = true;
666
663
  const providerOptionsName = metadataKey;
@@ -900,6 +897,16 @@ var OpenAICompatibleChatLanguageModel = class {
900
897
  } : {}
901
898
  });
902
899
  }
900
+ if (finishReason == null) {
901
+ finishReason = { unified: "error", raw: void 0 };
902
+ controller.enqueue({
903
+ type: "error",
904
+ error: new InvalidResponseDataError({
905
+ data: void 0,
906
+ message: "Response stream ended without a finish reason."
907
+ })
908
+ });
909
+ }
903
910
  const providerMetadata = {
904
911
  [providerOptionsName]: {},
905
912
  ...metadataExtractor == null ? void 0 : metadataExtractor.buildMetadata()
@@ -928,10 +935,10 @@ var openaiCompatibleTokenUsageSchema = z3.looseObject({
928
935
  prompt_tokens: z3.number().nullish(),
929
936
  completion_tokens: z3.number().nullish(),
930
937
  total_tokens: z3.number().nullish(),
931
- prompt_tokens_details: z3.object({
938
+ prompt_tokens_details: z3.looseObject({
932
939
  cached_tokens: z3.number().nullish()
933
940
  }).nullish(),
934
- completion_tokens_details: z3.object({
941
+ completion_tokens_details: z3.looseObject({
935
942
  reasoning_tokens: z3.number().nullish(),
936
943
  accepted_prediction_tokens: z3.number().nullish(),
937
944
  rejected_prediction_tokens: z3.number().nullish()
@@ -1422,7 +1429,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
1422
1429
  };
1423
1430
  }
1424
1431
  };
1425
- var usageSchema = z5.object({
1432
+ var usageSchema = z5.looseObject({
1426
1433
  prompt_tokens: z5.number(),
1427
1434
  completion_tokens: z5.number(),
1428
1435
  total_tokens: z5.number()
@@ -1734,7 +1741,7 @@ import {
1734
1741
  } from "@ai-sdk/provider-utils";
1735
1742
 
1736
1743
  // src/version.ts
1737
- var VERSION = true ? "2.0.68" : "0.0.0-test";
1744
+ var VERSION = true ? "2.0.70" : "0.0.0-test";
1738
1745
 
1739
1746
  // src/openai-compatible-provider.ts
1740
1747
  function createOpenAICompatible(options) {