@ai-sdk/openai 1.2.4 → 1.2.6
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 +17 -0
- package/dist/index.js +21 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -13
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.js +21 -13
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +21 -13
- package/internal/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/internal/dist/index.mjs
CHANGED
|
@@ -117,10 +117,6 @@ function convertToOpenAIChatMessages({
|
|
|
117
117
|
text += part.text;
|
|
118
118
|
break;
|
|
119
119
|
}
|
|
120
|
-
case "redacted-reasoning":
|
|
121
|
-
case "reasoning": {
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
120
|
case "tool-call": {
|
|
125
121
|
toolCalls.push({
|
|
126
122
|
id: part.toolCallId,
|
|
@@ -132,10 +128,6 @@ function convertToOpenAIChatMessages({
|
|
|
132
128
|
});
|
|
133
129
|
break;
|
|
134
130
|
}
|
|
135
|
-
default: {
|
|
136
|
-
const _exhaustiveCheck = part;
|
|
137
|
-
throw new Error(`Unsupported part: ${_exhaustiveCheck}`);
|
|
138
|
-
}
|
|
139
131
|
}
|
|
140
132
|
}
|
|
141
133
|
if (useLegacyFunctionCalling) {
|
|
@@ -1660,8 +1652,8 @@ function convertToOpenAIResponsesMessages({
|
|
|
1660
1652
|
case "user": {
|
|
1661
1653
|
messages.push({
|
|
1662
1654
|
role: "user",
|
|
1663
|
-
content: content.map((part) => {
|
|
1664
|
-
var _a, _b, _c;
|
|
1655
|
+
content: content.map((part, index) => {
|
|
1656
|
+
var _a, _b, _c, _d;
|
|
1665
1657
|
switch (part.type) {
|
|
1666
1658
|
case "text": {
|
|
1667
1659
|
return { type: "input_text", text: part.text };
|
|
@@ -1675,9 +1667,25 @@ function convertToOpenAIResponsesMessages({
|
|
|
1675
1667
|
};
|
|
1676
1668
|
}
|
|
1677
1669
|
case "file": {
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1670
|
+
if (part.data instanceof URL) {
|
|
1671
|
+
throw new UnsupportedFunctionalityError6({
|
|
1672
|
+
functionality: "File URLs in user messages"
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
switch (part.mimeType) {
|
|
1676
|
+
case "application/pdf": {
|
|
1677
|
+
return {
|
|
1678
|
+
type: "input_file",
|
|
1679
|
+
filename: (_d = part.filename) != null ? _d : `part-${index}.pdf`,
|
|
1680
|
+
file_data: `data:application/pdf;base64,${part.data}`
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
default: {
|
|
1684
|
+
throw new UnsupportedFunctionalityError6({
|
|
1685
|
+
functionality: "Only PDF files are supported in user messages"
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1681
1689
|
}
|
|
1682
1690
|
}
|
|
1683
1691
|
})
|