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