@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.
@@ -79,8 +79,8 @@ function convertToOpenAIChatMessages({
79
79
  }
80
80
  messages.push({
81
81
  role: "user",
82
- content: content.map((part) => {
83
- var _a, _b, _c;
82
+ content: content.map((part, index) => {
83
+ var _a, _b, _c, _d;
84
84
  switch (part.type) {
85
85
  case "text": {
86
86
  return { type: "text", text: part.text };
@@ -115,6 +115,15 @@ function convertToOpenAIChatMessages({
115
115
  input_audio: { data: part.data, format: "mp3" }
116
116
  };
117
117
  }
118
+ case "application/pdf": {
119
+ return {
120
+ type: "file",
121
+ file: {
122
+ filename: (_d = part.filename) != null ? _d : `part-${index}.pdf`,
123
+ file_data: `data:application/pdf;base64,${part.data}`
124
+ }
125
+ };
126
+ }
118
127
  default: {
119
128
  throw new import_provider.UnsupportedFunctionalityError({
120
129
  functionality: `File content part type ${part.mimeType} in user messages`