@ai-sdk/anthropic 3.0.0-beta.28 → 3.0.0-beta.29

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.
@@ -963,7 +963,8 @@ import {
963
963
  import {
964
964
  convertToBase64,
965
965
  parseProviderOptions,
966
- validateTypes as validateTypes2
966
+ validateTypes as validateTypes2,
967
+ isNonNullable
967
968
  } from "@ai-sdk/provider-utils";
968
969
 
969
970
  // src/tool/code-execution_20250522.ts
@@ -1266,20 +1267,20 @@ async function convertToAnthropicMessagesPrompt({
1266
1267
  return {
1267
1268
  type: "text",
1268
1269
  text: contentPart.text,
1269
- cache_control: void 0
1270
+ cache_control: cacheControl
1270
1271
  };
1271
- case "media": {
1272
- if (contentPart.mediaType.startsWith("image/")) {
1273
- return {
1274
- type: "image",
1275
- source: {
1276
- type: "base64",
1277
- media_type: contentPart.mediaType,
1278
- data: contentPart.data
1279
- },
1280
- cache_control: void 0
1281
- };
1282
- }
1272
+ case "image-data": {
1273
+ return {
1274
+ type: "image",
1275
+ source: {
1276
+ type: "base64",
1277
+ media_type: contentPart.mediaType,
1278
+ data: contentPart.data
1279
+ },
1280
+ cache_control: cacheControl
1281
+ };
1282
+ }
1283
+ case "file-data": {
1283
1284
  if (contentPart.mediaType === "application/pdf") {
1284
1285
  betas.add("pdfs-2024-09-25");
1285
1286
  return {
@@ -1289,15 +1290,24 @@ async function convertToAnthropicMessagesPrompt({
1289
1290
  media_type: contentPart.mediaType,
1290
1291
  data: contentPart.data
1291
1292
  },
1292
- cache_control: void 0
1293
+ cache_control: cacheControl
1293
1294
  };
1294
1295
  }
1295
- throw new UnsupportedFunctionalityError2({
1296
- functionality: `media type: ${contentPart.mediaType}`
1296
+ warnings.push({
1297
+ type: "other",
1298
+ message: `unsupported tool content part type: ${contentPart.type} with media type: ${contentPart.mediaType}`
1297
1299
  });
1300
+ return void 0;
1301
+ }
1302
+ default: {
1303
+ warnings.push({
1304
+ type: "other",
1305
+ message: `unsupported tool content part type: ${contentPart.type}`
1306
+ });
1307
+ return void 0;
1298
1308
  }
1299
1309
  }
1300
- });
1310
+ }).filter(isNonNullable);
1301
1311
  break;
1302
1312
  case "text":
1303
1313
  case "error-text":