@ai-sdk/anthropic 3.0.0-beta.57 → 3.0.0-beta.58

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.
@@ -2,7 +2,7 @@ import { LanguageModelV3, JSONSchema7, SharedV3ProviderMetadata, LanguageModelV3
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
 
5
- type AnthropicMessagesModelId = 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | (string & {});
6
6
 
7
7
  type AnthropicMessagesConfig = {
8
8
  provider: string;
@@ -2,7 +2,7 @@ import { LanguageModelV3, JSONSchema7, SharedV3ProviderMetadata, LanguageModelV3
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
 
5
- type AnthropicMessagesModelId = 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | (string & {});
6
6
 
7
7
  type AnthropicMessagesConfig = {
8
8
  provider: string;
@@ -655,7 +655,11 @@ var anthropicProviderOptions = import_v43.z.object({
655
655
  *
656
656
  * @default true
657
657
  */
658
- toolStreaming: import_v43.z.boolean().optional()
658
+ toolStreaming: import_v43.z.boolean().optional(),
659
+ /**
660
+ * @default 'high'
661
+ */
662
+ effort: import_v43.z.enum(["low", "medium", "high"]).optional()
659
663
  });
660
664
 
661
665
  // src/anthropic-prepare-tools.ts
@@ -1992,6 +1996,9 @@ var AnthropicMessagesLanguageModel = class {
1992
1996
  ...isThinking && {
1993
1997
  thinking: { type: "enabled", budget_tokens: thinkingBudget }
1994
1998
  },
1999
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && {
2000
+ output_config: { effort: anthropicOptions.effort }
2001
+ },
1995
2002
  // structured output:
1996
2003
  ...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
1997
2004
  output_format: {
@@ -2085,6 +2092,9 @@ var AnthropicMessagesLanguageModel = class {
2085
2092
  });
2086
2093
  }
2087
2094
  }
2095
+ if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
2096
+ betas.add("effort-2025-11-24");
2097
+ }
2088
2098
  if (stream && ((_f = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _f : true)) {
2089
2099
  betas.add("fine-grained-tool-streaming-2025-05-14");
2090
2100
  }
@@ -2974,7 +2984,7 @@ function getModelCapabilities(modelId) {
2974
2984
  supportsStructuredOutput: true,
2975
2985
  isKnownModel: true
2976
2986
  };
2977
- } else if (modelId.includes("claude-opus-4-1")) {
2987
+ } else if (modelId.includes("claude-opus-4-1") || modelId.includes("claude-opus-4-5")) {
2978
2988
  return {
2979
2989
  maxOutputTokens: 32e3,
2980
2990
  supportsStructuredOutput: true,