@ai-sdk/openai-compatible 2.0.69 → 2.0.71
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 +13 -0
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/chat/openai-compatible-chat-language-model.ts +12 -4
|
@@ -430,10 +430,7 @@ export class OpenAICompatibleChatLanguageModel implements LanguageModelV3 {
|
|
|
430
430
|
}
|
|
431
431
|
>();
|
|
432
432
|
|
|
433
|
-
let finishReason: LanguageModelV3FinishReason
|
|
434
|
-
unified: 'other',
|
|
435
|
-
raw: undefined,
|
|
436
|
-
};
|
|
433
|
+
let finishReason: LanguageModelV3FinishReason | undefined;
|
|
437
434
|
let usage: z.infer<typeof openaiCompatibleTokenUsageSchema> | undefined =
|
|
438
435
|
undefined;
|
|
439
436
|
let isFirstChunk = true;
|
|
@@ -752,6 +749,17 @@ export class OpenAICompatibleChatLanguageModel implements LanguageModelV3 {
|
|
|
752
749
|
});
|
|
753
750
|
}
|
|
754
751
|
|
|
752
|
+
if (finishReason == null) {
|
|
753
|
+
finishReason = { unified: 'error', raw: undefined };
|
|
754
|
+
controller.enqueue({
|
|
755
|
+
type: 'error',
|
|
756
|
+
error: new InvalidResponseDataError({
|
|
757
|
+
data: undefined,
|
|
758
|
+
message: 'Response stream ended without a finish reason.',
|
|
759
|
+
}),
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
|
|
755
763
|
const providerMetadata: SharedV3ProviderMetadata = {
|
|
756
764
|
[providerOptionsName]: {},
|
|
757
765
|
...metadataExtractor?.buildMetadata(),
|