@ai-sdk/anthropic 3.0.0-beta.35 → 3.0.0-beta.37

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/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  } from "@ai-sdk/provider-utils";
12
12
 
13
13
  // src/version.ts
14
- var VERSION = true ? "3.0.0-beta.35" : "0.0.0-test";
14
+ var VERSION = true ? "3.0.0-beta.37" : "0.0.0-test";
15
15
 
16
16
  // src/anthropic-messages-language-model.ts
17
17
  import {
@@ -1400,6 +1400,24 @@ async function convertToAnthropicMessagesPrompt({
1400
1400
  }
1401
1401
  };
1402
1402
  }
1403
+ case "image-url": {
1404
+ return {
1405
+ type: "image",
1406
+ source: {
1407
+ type: "url",
1408
+ url: contentPart.url
1409
+ }
1410
+ };
1411
+ }
1412
+ case "file-url": {
1413
+ return {
1414
+ type: "document",
1415
+ source: {
1416
+ type: "url",
1417
+ url: contentPart.url
1418
+ }
1419
+ };
1420
+ }
1403
1421
  case "file-data": {
1404
1422
  if (contentPart.mediaType === "application/pdf") {
1405
1423
  betas.add("pdfs-2024-09-25");
@@ -1938,7 +1956,7 @@ var AnthropicMessagesLanguageModel = class {
1938
1956
  });
1939
1957
  const isThinking = ((_b = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _b.type) === "enabled";
1940
1958
  const thinkingBudget = (_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.budgetTokens;
1941
- const maxOutputTokensForModel = getMaxOutputTokensForModel(this.modelId);
1959
+ const { maxOutputTokens: maxOutputTokensForModel, knownModel } = getMaxOutputTokensForModel(this.modelId);
1942
1960
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
1943
1961
  const baseArgs = {
1944
1962
  // model id:
@@ -2013,7 +2031,7 @@ var AnthropicMessagesLanguageModel = class {
2013
2031
  }
2014
2032
  baseArgs.max_tokens = maxTokens + thinkingBudget;
2015
2033
  }
2016
- if (baseArgs.max_tokens > maxOutputTokensForModel) {
2034
+ if (knownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
2017
2035
  if (maxOutputTokens != null) {
2018
2036
  warnings.push({
2019
2037
  type: "unsupported-setting",
@@ -2903,13 +2921,15 @@ var AnthropicMessagesLanguageModel = class {
2903
2921
  };
2904
2922
  function getMaxOutputTokensForModel(modelId) {
2905
2923
  if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2906
- return 64e3;
2924
+ return { maxOutputTokens: 64e3, knownModel: true };
2907
2925
  } else if (modelId.includes("claude-opus-4-")) {
2908
- return 32e3;
2926
+ return { maxOutputTokens: 32e3, knownModel: true };
2909
2927
  } else if (modelId.includes("claude-3-5-haiku")) {
2910
- return 8192;
2928
+ return { maxOutputTokens: 8192, knownModel: true };
2929
+ } else if (modelId.includes("claude-3-haiku")) {
2930
+ return { maxOutputTokens: 4096, knownModel: true };
2911
2931
  } else {
2912
- return 4096;
2932
+ return { maxOutputTokens: 4096, knownModel: false };
2913
2933
  }
2914
2934
  }
2915
2935