@ai-sdk/anthropic 3.0.0-beta.62 → 3.0.0-beta.63

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.
@@ -1,4 +1,4 @@
1
- import { LanguageModelV3, JSONSchema7, SharedV3ProviderMetadata, LanguageModelV3CallWarning, LanguageModelV3CallOptions } from '@ai-sdk/provider';
1
+ import { LanguageModelV3, JSONSchema7, SharedV3ProviderMetadata, SharedV3Warning, LanguageModelV3CallOptions } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
@@ -551,7 +551,7 @@ declare class CacheControlValidator {
551
551
  type: string;
552
552
  canCache: boolean;
553
553
  }): AnthropicCacheControl | undefined;
554
- getWarnings(): LanguageModelV3CallWarning[];
554
+ getWarnings(): SharedV3Warning[];
555
555
  }
556
556
 
557
557
  declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, }: {
@@ -562,7 +562,7 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
562
562
  }): Promise<{
563
563
  tools: Array<AnthropicTool> | undefined;
564
564
  toolChoice: AnthropicToolChoice | undefined;
565
- toolWarnings: LanguageModelV3CallWarning[];
565
+ toolWarnings: SharedV3Warning[];
566
566
  betas: Set<string>;
567
567
  }>;
568
568
 
@@ -1,4 +1,4 @@
1
- import { LanguageModelV3, JSONSchema7, SharedV3ProviderMetadata, LanguageModelV3CallWarning, LanguageModelV3CallOptions } from '@ai-sdk/provider';
1
+ import { LanguageModelV3, JSONSchema7, SharedV3ProviderMetadata, SharedV3Warning, LanguageModelV3CallOptions } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
@@ -551,7 +551,7 @@ declare class CacheControlValidator {
551
551
  type: string;
552
552
  canCache: boolean;
553
553
  }): AnthropicCacheControl | undefined;
554
- getWarnings(): LanguageModelV3CallWarning[];
554
+ getWarnings(): SharedV3Warning[];
555
555
  }
556
556
 
557
557
  declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, }: {
@@ -562,7 +562,7 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
562
562
  }): Promise<{
563
563
  tools: Array<AnthropicTool> | undefined;
564
564
  toolChoice: AnthropicToolChoice | undefined;
565
- toolWarnings: LanguageModelV3CallWarning[];
565
+ toolWarnings: SharedV3Warning[];
566
566
  betas: Set<string>;
567
567
  }>;
568
568
 
@@ -685,8 +685,8 @@ var CacheControlValidator = class {
685
685
  }
686
686
  if (!context.canCache) {
687
687
  this.warnings.push({
688
- type: "unsupported-setting",
689
- setting: "cacheControl",
688
+ type: "unsupported",
689
+ feature: "cache_control on non-cacheable context",
690
690
  details: `cache_control cannot be set on ${context.type}. It will be ignored.`
691
691
  });
692
692
  return void 0;
@@ -694,8 +694,8 @@ var CacheControlValidator = class {
694
694
  this.breakpointCount++;
695
695
  if (this.breakpointCount > MAX_CACHE_BREAKPOINTS) {
696
696
  this.warnings.push({
697
- type: "unsupported-setting",
698
- setting: "cacheControl",
697
+ type: "unsupported",
698
+ feature: "cacheControl breakpoint limit",
699
699
  details: `Maximum ${MAX_CACHE_BREAKPOINTS} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`
700
700
  });
701
701
  return void 0;
@@ -1021,14 +1021,20 @@ async function prepareTools({
1021
1021
  break;
1022
1022
  }
1023
1023
  default: {
1024
- toolWarnings.push({ type: "unsupported-tool", tool });
1024
+ toolWarnings.push({
1025
+ type: "unsupported",
1026
+ feature: `provider-defined tool ${tool.id}`
1027
+ });
1025
1028
  break;
1026
1029
  }
1027
1030
  }
1028
1031
  break;
1029
1032
  }
1030
1033
  default: {
1031
- toolWarnings.push({ type: "unsupported-tool", tool });
1034
+ toolWarnings.push({
1035
+ type: "unsupported",
1036
+ feature: `tool ${tool}`
1037
+ });
1032
1038
  break;
1033
1039
  }
1034
1040
  }
@@ -1915,34 +1921,25 @@ var AnthropicMessagesLanguageModel = class {
1915
1921
  var _a, _b, _c, _d, _e, _f;
1916
1922
  const warnings = [];
1917
1923
  if (frequencyPenalty != null) {
1918
- warnings.push({
1919
- type: "unsupported-setting",
1920
- setting: "frequencyPenalty"
1921
- });
1924
+ warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
1922
1925
  }
1923
1926
  if (presencePenalty != null) {
1924
- warnings.push({
1925
- type: "unsupported-setting",
1926
- setting: "presencePenalty"
1927
- });
1927
+ warnings.push({ type: "unsupported", feature: "presencePenalty" });
1928
1928
  }
1929
1929
  if (seed != null) {
1930
- warnings.push({
1931
- type: "unsupported-setting",
1932
- setting: "seed"
1933
- });
1930
+ warnings.push({ type: "unsupported", feature: "seed" });
1934
1931
  }
1935
1932
  if (temperature != null && temperature > 1) {
1936
1933
  warnings.push({
1937
- type: "unsupported-setting",
1938
- setting: "temperature",
1934
+ type: "unsupported",
1935
+ feature: "temperature",
1939
1936
  details: `${temperature} exceeds anthropic maximum of 1.0. clamped to 1.0`
1940
1937
  });
1941
1938
  temperature = 1;
1942
1939
  } else if (temperature != null && temperature < 0) {
1943
1940
  warnings.push({
1944
- type: "unsupported-setting",
1945
- setting: "temperature",
1941
+ type: "unsupported",
1942
+ feature: "temperature",
1946
1943
  details: `${temperature} is below anthropic minimum of 0. clamped to 0`
1947
1944
  });
1948
1945
  temperature = 0;
@@ -1950,8 +1947,8 @@ var AnthropicMessagesLanguageModel = class {
1950
1947
  if ((responseFormat == null ? void 0 : responseFormat.type) === "json") {
1951
1948
  if (responseFormat.schema == null) {
1952
1949
  warnings.push({
1953
- type: "unsupported-setting",
1954
- setting: "responseFormat",
1950
+ type: "unsupported",
1951
+ feature: "responseFormat",
1955
1952
  details: "JSON response format requires a schema. The response format is ignored."
1956
1953
  });
1957
1954
  }
@@ -2044,24 +2041,24 @@ var AnthropicMessagesLanguageModel = class {
2044
2041
  if (baseArgs.temperature != null) {
2045
2042
  baseArgs.temperature = void 0;
2046
2043
  warnings.push({
2047
- type: "unsupported-setting",
2048
- setting: "temperature",
2044
+ type: "unsupported",
2045
+ feature: "temperature",
2049
2046
  details: "temperature is not supported when thinking is enabled"
2050
2047
  });
2051
2048
  }
2052
2049
  if (topK != null) {
2053
2050
  baseArgs.top_k = void 0;
2054
2051
  warnings.push({
2055
- type: "unsupported-setting",
2056
- setting: "topK",
2052
+ type: "unsupported",
2053
+ feature: "topK",
2057
2054
  details: "topK is not supported when thinking is enabled"
2058
2055
  });
2059
2056
  }
2060
2057
  if (topP != null) {
2061
2058
  baseArgs.top_p = void 0;
2062
2059
  warnings.push({
2063
- type: "unsupported-setting",
2064
- setting: "topP",
2060
+ type: "unsupported",
2061
+ feature: "topP",
2065
2062
  details: "topP is not supported when thinking is enabled"
2066
2063
  });
2067
2064
  }
@@ -2070,8 +2067,8 @@ var AnthropicMessagesLanguageModel = class {
2070
2067
  if (isKnownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
2071
2068
  if (maxOutputTokens != null) {
2072
2069
  warnings.push({
2073
- type: "unsupported-setting",
2074
- setting: "maxOutputTokens",
2070
+ type: "unsupported",
2071
+ feature: "maxOutputTokens",
2075
2072
  details: `${baseArgs.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${maxOutputTokensForModel} max output tokens. The max output tokens have been limited to ${maxOutputTokensForModel}.`
2076
2073
  });
2077
2074
  }