@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 1.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [0bd5bc6]
|
|
8
|
+
- @ai-sdk/provider@1.0.12
|
|
9
|
+
- @ai-sdk/provider-utils@2.1.14
|
|
10
|
+
|
|
11
|
+
## 1.2.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 2e1101a: feat (provider/openai): pdf input support
|
|
16
|
+
- Updated dependencies [2e1101a]
|
|
17
|
+
- @ai-sdk/provider@1.0.11
|
|
18
|
+
- @ai-sdk/provider-utils@2.1.13
|
|
19
|
+
|
|
3
20
|
## 1.2.4
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -135,10 +135,6 @@ function convertToOpenAIChatMessages({
|
|
|
135
135
|
text += part.text;
|
|
136
136
|
break;
|
|
137
137
|
}
|
|
138
|
-
case "redacted-reasoning":
|
|
139
|
-
case "reasoning": {
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
138
|
case "tool-call": {
|
|
143
139
|
toolCalls.push({
|
|
144
140
|
id: part.toolCallId,
|
|
@@ -150,10 +146,6 @@ function convertToOpenAIChatMessages({
|
|
|
150
146
|
});
|
|
151
147
|
break;
|
|
152
148
|
}
|
|
153
|
-
default: {
|
|
154
|
-
const _exhaustiveCheck = part;
|
|
155
|
-
throw new Error(`Unsupported part: ${_exhaustiveCheck}`);
|
|
156
|
-
}
|
|
157
149
|
}
|
|
158
150
|
}
|
|
159
151
|
if (useLegacyFunctionCalling) {
|
|
@@ -1645,8 +1637,8 @@ function convertToOpenAIResponsesMessages({
|
|
|
1645
1637
|
case "user": {
|
|
1646
1638
|
messages.push({
|
|
1647
1639
|
role: "user",
|
|
1648
|
-
content: content.map((part) => {
|
|
1649
|
-
var _a, _b, _c;
|
|
1640
|
+
content: content.map((part, index) => {
|
|
1641
|
+
var _a, _b, _c, _d;
|
|
1650
1642
|
switch (part.type) {
|
|
1651
1643
|
case "text": {
|
|
1652
1644
|
return { type: "input_text", text: part.text };
|
|
@@ -1660,9 +1652,25 @@ function convertToOpenAIResponsesMessages({
|
|
|
1660
1652
|
};
|
|
1661
1653
|
}
|
|
1662
1654
|
case "file": {
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1655
|
+
if (part.data instanceof URL) {
|
|
1656
|
+
throw new import_provider7.UnsupportedFunctionalityError({
|
|
1657
|
+
functionality: "File URLs in user messages"
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
switch (part.mimeType) {
|
|
1661
|
+
case "application/pdf": {
|
|
1662
|
+
return {
|
|
1663
|
+
type: "input_file",
|
|
1664
|
+
filename: (_d = part.filename) != null ? _d : `part-${index}.pdf`,
|
|
1665
|
+
file_data: `data:application/pdf;base64,${part.data}`
|
|
1666
|
+
};
|
|
1667
|
+
}
|
|
1668
|
+
default: {
|
|
1669
|
+
throw new import_provider7.UnsupportedFunctionalityError({
|
|
1670
|
+
functionality: "Only PDF files are supported in user messages"
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1666
1674
|
}
|
|
1667
1675
|
}
|
|
1668
1676
|
})
|