@ai-sdk/openai 1.2.4 → 1.2.5
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 +9 -0
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -5
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.js +21 -5
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +21 -5
- package/internal/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1645,8 +1645,8 @@ function convertToOpenAIResponsesMessages({
|
|
|
1645
1645
|
case "user": {
|
|
1646
1646
|
messages.push({
|
|
1647
1647
|
role: "user",
|
|
1648
|
-
content: content.map((part) => {
|
|
1649
|
-
var _a, _b, _c;
|
|
1648
|
+
content: content.map((part, index) => {
|
|
1649
|
+
var _a, _b, _c, _d;
|
|
1650
1650
|
switch (part.type) {
|
|
1651
1651
|
case "text": {
|
|
1652
1652
|
return { type: "input_text", text: part.text };
|
|
@@ -1660,9 +1660,25 @@ function convertToOpenAIResponsesMessages({
|
|
|
1660
1660
|
};
|
|
1661
1661
|
}
|
|
1662
1662
|
case "file": {
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1663
|
+
if (part.data instanceof URL) {
|
|
1664
|
+
throw new import_provider7.UnsupportedFunctionalityError({
|
|
1665
|
+
functionality: "File URLs in user messages"
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1668
|
+
switch (part.mimeType) {
|
|
1669
|
+
case "application/pdf": {
|
|
1670
|
+
return {
|
|
1671
|
+
type: "input_file",
|
|
1672
|
+
filename: (_d = part.filename) != null ? _d : `part-${index}.pdf`,
|
|
1673
|
+
file_data: `data:application/pdf;base64,${part.data}`
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
default: {
|
|
1677
|
+
throw new import_provider7.UnsupportedFunctionalityError({
|
|
1678
|
+
functionality: "Only PDF files are supported in user messages"
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1666
1682
|
}
|
|
1667
1683
|
}
|
|
1668
1684
|
})
|