@ai-sdk/openai-compatible 3.0.0-beta.17 → 3.0.0-beta.19
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 +18 -0
- package/dist/index.js +43 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/chat/openai-compatible-chat-language-model.ts +15 -3
- package/src/completion/openai-compatible-completion-language-model.ts +11 -1
- package/src/embedding/openai-compatible-embedding-model.ts +11 -2
- package/src/image/openai-compatible-image-model.ts +11 -3
- package/src/utils/to-camel-case.ts +24 -0
package/dist/index.mjs
CHANGED
|
@@ -26,6 +26,20 @@ function resolveProviderOptionsKey(rawName, providerOptions) {
|
|
|
26
26
|
}
|
|
27
27
|
return rawName;
|
|
28
28
|
}
|
|
29
|
+
function warnIfDeprecatedProviderOptionsKey({
|
|
30
|
+
rawName,
|
|
31
|
+
providerOptions,
|
|
32
|
+
warnings
|
|
33
|
+
}) {
|
|
34
|
+
const camelName = toCamelCase(rawName);
|
|
35
|
+
if (camelName !== rawName && (providerOptions == null ? void 0 : providerOptions[rawName]) != null) {
|
|
36
|
+
warnings.push({
|
|
37
|
+
type: "deprecated",
|
|
38
|
+
setting: `providerOptions key '${rawName}'`,
|
|
39
|
+
message: `Use '${camelName}' instead.`
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
29
43
|
|
|
30
44
|
// src/openai-compatible-error.ts
|
|
31
45
|
import { z } from "zod/v4";
|
|
@@ -464,10 +478,16 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
464
478
|
});
|
|
465
479
|
if (deprecatedOptions != null) {
|
|
466
480
|
warnings.push({
|
|
467
|
-
type: "
|
|
468
|
-
|
|
481
|
+
type: "deprecated",
|
|
482
|
+
setting: "providerOptions key 'openai-compatible'",
|
|
483
|
+
message: "Use 'openaiCompatible' instead."
|
|
469
484
|
});
|
|
470
485
|
}
|
|
486
|
+
warnIfDeprecatedProviderOptionsKey({
|
|
487
|
+
rawName: this.providerOptionsName,
|
|
488
|
+
providerOptions,
|
|
489
|
+
warnings
|
|
490
|
+
});
|
|
471
491
|
const compatibleOptions = Object.assign(
|
|
472
492
|
deprecatedOptions != null ? deprecatedOptions : {},
|
|
473
493
|
(_a = await parseProviderOptions({
|
|
@@ -1215,6 +1235,11 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
1215
1235
|
}) {
|
|
1216
1236
|
var _a, _b;
|
|
1217
1237
|
const warnings = [];
|
|
1238
|
+
warnIfDeprecatedProviderOptionsKey({
|
|
1239
|
+
rawName: this.providerOptionsName,
|
|
1240
|
+
providerOptions,
|
|
1241
|
+
warnings
|
|
1242
|
+
});
|
|
1218
1243
|
const completionOptions = Object.assign(
|
|
1219
1244
|
(_a = await parseProviderOptions2({
|
|
1220
1245
|
provider: this.providerOptionsName,
|
|
@@ -1506,10 +1531,16 @@ var OpenAICompatibleEmbeddingModel = class {
|
|
|
1506
1531
|
});
|
|
1507
1532
|
if (deprecatedOptions != null) {
|
|
1508
1533
|
warnings.push({
|
|
1509
|
-
type: "
|
|
1510
|
-
|
|
1534
|
+
type: "deprecated",
|
|
1535
|
+
setting: "providerOptions key 'openai-compatible'",
|
|
1536
|
+
message: "Use 'openaiCompatible' instead."
|
|
1511
1537
|
});
|
|
1512
1538
|
}
|
|
1539
|
+
warnIfDeprecatedProviderOptionsKey({
|
|
1540
|
+
rawName: this.providerOptionsName,
|
|
1541
|
+
providerOptions,
|
|
1542
|
+
warnings
|
|
1543
|
+
});
|
|
1513
1544
|
const compatibleOptions = Object.assign(
|
|
1514
1545
|
deprecatedOptions != null ? deprecatedOptions : {},
|
|
1515
1546
|
(_a = await parseProviderOptions3({
|
|
@@ -1600,8 +1631,12 @@ var OpenAICompatibleImageModel = class {
|
|
|
1600
1631
|
get providerOptionsKey() {
|
|
1601
1632
|
return this.config.provider.split(".")[0].trim();
|
|
1602
1633
|
}
|
|
1603
|
-
|
|
1604
|
-
|
|
1634
|
+
getArgs(providerOptions, warnings) {
|
|
1635
|
+
warnIfDeprecatedProviderOptionsKey({
|
|
1636
|
+
rawName: this.providerOptionsKey,
|
|
1637
|
+
providerOptions,
|
|
1638
|
+
warnings
|
|
1639
|
+
});
|
|
1605
1640
|
return {
|
|
1606
1641
|
...providerOptions[this.providerOptionsKey],
|
|
1607
1642
|
...providerOptions[toCamelCase(this.providerOptionsKey)]
|
|
@@ -1632,7 +1667,7 @@ var OpenAICompatibleImageModel = class {
|
|
|
1632
1667
|
warnings.push({ type: "unsupported", feature: "seed" });
|
|
1633
1668
|
}
|
|
1634
1669
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1635
|
-
const args = this.getArgs(providerOptions);
|
|
1670
|
+
const args = this.getArgs(providerOptions, warnings);
|
|
1636
1671
|
if (files != null && files.length > 0) {
|
|
1637
1672
|
const { value: response2, responseHeaders: responseHeaders2 } = await postFormDataToApi({
|
|
1638
1673
|
url: this.config.url({
|
|
@@ -1720,7 +1755,7 @@ import {
|
|
|
1720
1755
|
} from "@ai-sdk/provider-utils";
|
|
1721
1756
|
|
|
1722
1757
|
// src/version.ts
|
|
1723
|
-
var VERSION = true ? "3.0.0-beta.
|
|
1758
|
+
var VERSION = true ? "3.0.0-beta.19" : "0.0.0-test";
|
|
1724
1759
|
|
|
1725
1760
|
// src/openai-compatible-provider.ts
|
|
1726
1761
|
function createOpenAICompatible(options) {
|