@ai-sdk/openai 2.0.89 → 2.0.91
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 +15 -2
- package/dist/index.js +34 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -9
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +33 -8
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +33 -8
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1771,19 +1771,44 @@ var OpenAIImageModel = class {
|
|
|
1771
1771
|
},
|
|
1772
1772
|
providerMetadata: {
|
|
1773
1773
|
openai: {
|
|
1774
|
-
images: response.data.map((item) =>
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1774
|
+
images: response.data.map((item, index) => {
|
|
1775
|
+
var _a2;
|
|
1776
|
+
return {
|
|
1777
|
+
...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
|
|
1778
|
+
...response.created != null ? { created: response.created } : {},
|
|
1779
|
+
...response.size != null ? { size: response.size } : {},
|
|
1780
|
+
...response.quality != null ? { quality: response.quality } : {},
|
|
1781
|
+
...response.background != null ? { background: response.background } : {},
|
|
1782
|
+
...response.output_format != null ? { outputFormat: response.output_format } : {},
|
|
1783
|
+
...distributeTokenDetails(
|
|
1784
|
+
(_a2 = response.usage) == null ? void 0 : _a2.input_tokens_details,
|
|
1785
|
+
index,
|
|
1786
|
+
response.data.length
|
|
1787
|
+
)
|
|
1788
|
+
};
|
|
1789
|
+
})
|
|
1782
1790
|
}
|
|
1783
1791
|
}
|
|
1784
1792
|
};
|
|
1785
1793
|
}
|
|
1786
1794
|
};
|
|
1795
|
+
function distributeTokenDetails(details, index, total) {
|
|
1796
|
+
if (details == null) {
|
|
1797
|
+
return {};
|
|
1798
|
+
}
|
|
1799
|
+
const result = {};
|
|
1800
|
+
if (details.image_tokens != null) {
|
|
1801
|
+
const base = Math.floor(details.image_tokens / total);
|
|
1802
|
+
const remainder = details.image_tokens - base * (total - 1);
|
|
1803
|
+
result.imageTokens = index === total - 1 ? remainder : base;
|
|
1804
|
+
}
|
|
1805
|
+
if (details.text_tokens != null) {
|
|
1806
|
+
const base = Math.floor(details.text_tokens / total);
|
|
1807
|
+
const remainder = details.text_tokens - base * (total - 1);
|
|
1808
|
+
result.textTokens = index === total - 1 ? remainder : base;
|
|
1809
|
+
}
|
|
1810
|
+
return result;
|
|
1811
|
+
}
|
|
1787
1812
|
|
|
1788
1813
|
// src/tool/code-interpreter.ts
|
|
1789
1814
|
import {
|
|
@@ -4656,7 +4681,7 @@ var OpenAITranscriptionModel = class {
|
|
|
4656
4681
|
};
|
|
4657
4682
|
|
|
4658
4683
|
// src/version.ts
|
|
4659
|
-
var VERSION = true ? "2.0.
|
|
4684
|
+
var VERSION = true ? "2.0.91" : "0.0.0-test";
|
|
4660
4685
|
|
|
4661
4686
|
// src/openai-provider.ts
|
|
4662
4687
|
function createOpenAI(options = {}) {
|