@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.
@@ -60,8 +60,8 @@ function convertToOpenAIChatMessages({
60
60
  }
61
61
  messages.push({
62
62
  role: "user",
63
- content: content.map((part) => {
64
- var _a, _b, _c;
63
+ content: content.map((part, index) => {
64
+ var _a, _b, _c, _d;
65
65
  switch (part.type) {
66
66
  case "text": {
67
67
  return { type: "text", text: part.text };
@@ -96,6 +96,15 @@ function convertToOpenAIChatMessages({
96
96
  input_audio: { data: part.data, format: "mp3" }
97
97
  };
98
98
  }
99
+ case "application/pdf": {
100
+ return {
101
+ type: "file",
102
+ file: {
103
+ filename: (_d = part.filename) != null ? _d : `part-${index}.pdf`,
104
+ file_data: `data:application/pdf;base64,${part.data}`
105
+ }
106
+ };
107
+ }
99
108
  default: {
100
109
  throw new UnsupportedFunctionalityError({
101
110
  functionality: `File content part type ${part.mimeType} in user messages`