@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @ai-sdk/openai-compatible
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 008271d: feat(openai-compatible): emit warning when using kebab-case instead of camelCase
|
|
8
|
+
- Updated dependencies [34bd95d]
|
|
9
|
+
- Updated dependencies [008271d]
|
|
10
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
11
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
12
|
+
|
|
13
|
+
## 3.0.0-beta.18
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [b0c2869]
|
|
18
|
+
- Updated dependencies [7e26e81]
|
|
19
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
20
|
+
|
|
3
21
|
## 3.0.0-beta.17
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,20 @@ function resolveProviderOptionsKey(rawName, providerOptions) {
|
|
|
45
45
|
}
|
|
46
46
|
return rawName;
|
|
47
47
|
}
|
|
48
|
+
function warnIfDeprecatedProviderOptionsKey({
|
|
49
|
+
rawName,
|
|
50
|
+
providerOptions,
|
|
51
|
+
warnings
|
|
52
|
+
}) {
|
|
53
|
+
const camelName = toCamelCase(rawName);
|
|
54
|
+
if (camelName !== rawName && (providerOptions == null ? void 0 : providerOptions[rawName]) != null) {
|
|
55
|
+
warnings.push({
|
|
56
|
+
type: "deprecated",
|
|
57
|
+
setting: `providerOptions key '${rawName}'`,
|
|
58
|
+
message: `Use '${camelName}' instead.`
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
48
62
|
|
|
49
63
|
// src/openai-compatible-error.ts
|
|
50
64
|
var import_v4 = require("zod/v4");
|
|
@@ -475,10 +489,16 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
|
475
489
|
});
|
|
476
490
|
if (deprecatedOptions != null) {
|
|
477
491
|
warnings.push({
|
|
478
|
-
type: "
|
|
479
|
-
|
|
492
|
+
type: "deprecated",
|
|
493
|
+
setting: "providerOptions key 'openai-compatible'",
|
|
494
|
+
message: "Use 'openaiCompatible' instead."
|
|
480
495
|
});
|
|
481
496
|
}
|
|
497
|
+
warnIfDeprecatedProviderOptionsKey({
|
|
498
|
+
rawName: this.providerOptionsName,
|
|
499
|
+
providerOptions,
|
|
500
|
+
warnings
|
|
501
|
+
});
|
|
482
502
|
const compatibleOptions = Object.assign(
|
|
483
503
|
deprecatedOptions != null ? deprecatedOptions : {},
|
|
484
504
|
(_a = await (0, import_provider_utils2.parseProviderOptions)({
|
|
@@ -1216,6 +1236,11 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
|
1216
1236
|
}) {
|
|
1217
1237
|
var _a, _b;
|
|
1218
1238
|
const warnings = [];
|
|
1239
|
+
warnIfDeprecatedProviderOptionsKey({
|
|
1240
|
+
rawName: this.providerOptionsName,
|
|
1241
|
+
providerOptions,
|
|
1242
|
+
warnings
|
|
1243
|
+
});
|
|
1219
1244
|
const completionOptions = Object.assign(
|
|
1220
1245
|
(_a = await (0, import_provider_utils3.parseProviderOptions)({
|
|
1221
1246
|
provider: this.providerOptionsName,
|
|
@@ -1499,10 +1524,16 @@ var OpenAICompatibleEmbeddingModel = class {
|
|
|
1499
1524
|
});
|
|
1500
1525
|
if (deprecatedOptions != null) {
|
|
1501
1526
|
warnings.push({
|
|
1502
|
-
type: "
|
|
1503
|
-
|
|
1527
|
+
type: "deprecated",
|
|
1528
|
+
setting: "providerOptions key 'openai-compatible'",
|
|
1529
|
+
message: "Use 'openaiCompatible' instead."
|
|
1504
1530
|
});
|
|
1505
1531
|
}
|
|
1532
|
+
warnIfDeprecatedProviderOptionsKey({
|
|
1533
|
+
rawName: this.providerOptionsName,
|
|
1534
|
+
providerOptions,
|
|
1535
|
+
warnings
|
|
1536
|
+
});
|
|
1506
1537
|
const compatibleOptions = Object.assign(
|
|
1507
1538
|
deprecatedOptions != null ? deprecatedOptions : {},
|
|
1508
1539
|
(_a = await (0, import_provider_utils4.parseProviderOptions)({
|
|
@@ -1584,8 +1615,12 @@ var OpenAICompatibleImageModel = class {
|
|
|
1584
1615
|
get providerOptionsKey() {
|
|
1585
1616
|
return this.config.provider.split(".")[0].trim();
|
|
1586
1617
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1618
|
+
getArgs(providerOptions, warnings) {
|
|
1619
|
+
warnIfDeprecatedProviderOptionsKey({
|
|
1620
|
+
rawName: this.providerOptionsKey,
|
|
1621
|
+
providerOptions,
|
|
1622
|
+
warnings
|
|
1623
|
+
});
|
|
1589
1624
|
return {
|
|
1590
1625
|
...providerOptions[this.providerOptionsKey],
|
|
1591
1626
|
...providerOptions[toCamelCase(this.providerOptionsKey)]
|
|
@@ -1616,7 +1651,7 @@ var OpenAICompatibleImageModel = class {
|
|
|
1616
1651
|
warnings.push({ type: "unsupported", feature: "seed" });
|
|
1617
1652
|
}
|
|
1618
1653
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1619
|
-
const args = this.getArgs(providerOptions);
|
|
1654
|
+
const args = this.getArgs(providerOptions, warnings);
|
|
1620
1655
|
if (files != null && files.length > 0) {
|
|
1621
1656
|
const { value: response2, responseHeaders: responseHeaders2 } = await (0, import_provider_utils5.postFormDataToApi)({
|
|
1622
1657
|
url: this.config.url({
|
|
@@ -1701,7 +1736,7 @@ async function fileToBlob(file) {
|
|
|
1701
1736
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1702
1737
|
|
|
1703
1738
|
// src/version.ts
|
|
1704
|
-
var VERSION = true ? "3.0.0-beta.
|
|
1739
|
+
var VERSION = true ? "3.0.0-beta.19" : "0.0.0-test";
|
|
1705
1740
|
|
|
1706
1741
|
// src/openai-compatible-provider.ts
|
|
1707
1742
|
function createOpenAICompatible(options) {
|