@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/internal/dist/index.mjs
CHANGED
|
@@ -1660,8 +1660,8 @@ function convertToOpenAIResponsesMessages({
|
|
|
1660
1660
|
case "user": {
|
|
1661
1661
|
messages.push({
|
|
1662
1662
|
role: "user",
|
|
1663
|
-
content: content.map((part) => {
|
|
1664
|
-
var _a, _b, _c;
|
|
1663
|
+
content: content.map((part, index) => {
|
|
1664
|
+
var _a, _b, _c, _d;
|
|
1665
1665
|
switch (part.type) {
|
|
1666
1666
|
case "text": {
|
|
1667
1667
|
return { type: "input_text", text: part.text };
|
|
@@ -1675,9 +1675,25 @@ function convertToOpenAIResponsesMessages({
|
|
|
1675
1675
|
};
|
|
1676
1676
|
}
|
|
1677
1677
|
case "file": {
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1678
|
+
if (part.data instanceof URL) {
|
|
1679
|
+
throw new UnsupportedFunctionalityError6({
|
|
1680
|
+
functionality: "File URLs in user messages"
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
switch (part.mimeType) {
|
|
1684
|
+
case "application/pdf": {
|
|
1685
|
+
return {
|
|
1686
|
+
type: "input_file",
|
|
1687
|
+
filename: (_d = part.filename) != null ? _d : `part-${index}.pdf`,
|
|
1688
|
+
file_data: `data:application/pdf;base64,${part.data}`
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
default: {
|
|
1692
|
+
throw new UnsupportedFunctionalityError6({
|
|
1693
|
+
functionality: "Only PDF files are supported in user messages"
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1681
1697
|
}
|
|
1682
1698
|
}
|
|
1683
1699
|
})
|