@ai-sdk/openai 1.2.7 → 1.3.0

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5bc638d: AI SDK 4.2
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [5bc638d]
12
+ - @ai-sdk/provider@1.1.0
13
+ - @ai-sdk/provider-utils@2.2.0
14
+
15
+ ## 1.2.8
16
+
17
+ ### Patch Changes
18
+
19
+ - 9f4f1bc: feat (provider/openai): pdf support for chat language models
20
+
3
21
  ## 1.2.7
4
22
 
5
23
  ### Patch Changes
package/dist/index.js CHANGED
@@ -78,8 +78,8 @@ function convertToOpenAIChatMessages({
78
78
  }
79
79
  messages.push({
80
80
  role: "user",
81
- content: content.map((part) => {
82
- var _a, _b, _c;
81
+ content: content.map((part, index) => {
82
+ var _a, _b, _c, _d;
83
83
  switch (part.type) {
84
84
  case "text": {
85
85
  return { type: "text", text: part.text };
@@ -114,6 +114,15 @@ function convertToOpenAIChatMessages({
114
114
  input_audio: { data: part.data, format: "mp3" }
115
115
  };
116
116
  }
117
+ case "application/pdf": {
118
+ return {
119
+ type: "file",
120
+ file: {
121
+ filename: (_d = part.filename) != null ? _d : `part-${index}.pdf`,
122
+ file_data: `data:application/pdf;base64,${part.data}`
123
+ }
124
+ };
125
+ }
117
126
  default: {
118
127
  throw new import_provider.UnsupportedFunctionalityError({
119
128
  functionality: `File content part type ${part.mimeType} in user messages`