@ai-sdk/openai 1.2.7 → 1.2.8
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 +6 -0
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -2
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.js +11 -2
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +11 -2
- package/internal/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -66,8 +66,8 @@ function convertToOpenAIChatMessages({
|
|
|
66
66
|
}
|
|
67
67
|
messages.push({
|
|
68
68
|
role: "user",
|
|
69
|
-
content: content.map((part) => {
|
|
70
|
-
var _a, _b, _c;
|
|
69
|
+
content: content.map((part, index) => {
|
|
70
|
+
var _a, _b, _c, _d;
|
|
71
71
|
switch (part.type) {
|
|
72
72
|
case "text": {
|
|
73
73
|
return { type: "text", text: part.text };
|
|
@@ -102,6 +102,15 @@ function convertToOpenAIChatMessages({
|
|
|
102
102
|
input_audio: { data: part.data, format: "mp3" }
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
+
case "application/pdf": {
|
|
106
|
+
return {
|
|
107
|
+
type: "file",
|
|
108
|
+
file: {
|
|
109
|
+
filename: (_d = part.filename) != null ? _d : `part-${index}.pdf`,
|
|
110
|
+
file_data: `data:application/pdf;base64,${part.data}`
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
105
114
|
default: {
|
|
106
115
|
throw new UnsupportedFunctionalityError({
|
|
107
116
|
functionality: `File content part type ${part.mimeType} in user messages`
|