@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.
@@ -136,10 +136,6 @@ function convertToOpenAIChatMessages({
136
136
  text += part.text;
137
137
  break;
138
138
  }
139
- case "redacted-reasoning":
140
- case "reasoning": {
141
- break;
142
- }
143
139
  case "tool-call": {
144
140
  toolCalls.push({
145
141
  id: part.toolCallId,
@@ -151,10 +147,6 @@ function convertToOpenAIChatMessages({
151
147
  });
152
148
  break;
153
149
  }
154
- default: {
155
- const _exhaustiveCheck = part;
156
- throw new Error(`Unsupported part: ${_exhaustiveCheck}`);
157
- }
158
150
  }
159
151
  }
160
152
  if (useLegacyFunctionCalling) {
@@ -1646,8 +1638,8 @@ function convertToOpenAIResponsesMessages({
1646
1638
  case "user": {
1647
1639
  messages.push({
1648
1640
  role: "user",
1649
- content: content.map((part) => {
1650
- var _a, _b, _c;
1641
+ content: content.map((part, index) => {
1642
+ var _a, _b, _c, _d;
1651
1643
  switch (part.type) {
1652
1644
  case "text": {
1653
1645
  return { type: "input_text", text: part.text };
@@ -1661,9 +1653,25 @@ function convertToOpenAIResponsesMessages({
1661
1653
  };
1662
1654
  }
1663
1655
  case "file": {
1664
- throw new import_provider7.UnsupportedFunctionalityError({
1665
- functionality: "Image content parts in user messages"
1666
- });
1656
+ if (part.data instanceof URL) {
1657
+ throw new import_provider7.UnsupportedFunctionalityError({
1658
+ functionality: "File URLs in user messages"
1659
+ });
1660
+ }
1661
+ switch (part.mimeType) {
1662
+ case "application/pdf": {
1663
+ return {
1664
+ type: "input_file",
1665
+ filename: (_d = part.filename) != null ? _d : `part-${index}.pdf`,
1666
+ file_data: `data:application/pdf;base64,${part.data}`
1667
+ };
1668
+ }
1669
+ default: {
1670
+ throw new import_provider7.UnsupportedFunctionalityError({
1671
+ functionality: "Only PDF files are supported in user messages"
1672
+ });
1673
+ }
1674
+ }
1667
1675
  }
1668
1676
  }
1669
1677
  })