@ai-sdk/anthropic 2.0.0-alpha.1 → 2.0.0-alpha.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,83 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 2.0.0-alpha.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 25f3454: feat(provider/anthropic): add PDF citation support with document sources for streamText
8
+ - Updated dependencies [c1e6647]
9
+ - @ai-sdk/provider@2.0.0-alpha.11
10
+ - @ai-sdk/provider-utils@3.0.0-alpha.11
11
+
12
+ ## 2.0.0-alpha.10
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [c4df419]
17
+ - @ai-sdk/provider@2.0.0-alpha.10
18
+ - @ai-sdk/provider-utils@3.0.0-alpha.10
19
+
20
+ ## 2.0.0-alpha.9
21
+
22
+ ### Patch Changes
23
+
24
+ - 362b048: add web search tool support
25
+ - Updated dependencies [811dff3]
26
+ - @ai-sdk/provider@2.0.0-alpha.9
27
+ - @ai-sdk/provider-utils@3.0.0-alpha.9
28
+
29
+ ## 2.0.0-alpha.8
30
+
31
+ ### Patch Changes
32
+
33
+ - ad66c0e: feat (provider/anthropic): json response schema support via tool calls
34
+ - 075711d: fix (provider/anthropic): return stop finish reason for json output with tool
35
+ - Updated dependencies [4fef487]
36
+ - Updated dependencies [9222aeb]
37
+ - @ai-sdk/provider-utils@3.0.0-alpha.8
38
+ - @ai-sdk/provider@2.0.0-alpha.8
39
+
40
+ ## 2.0.0-alpha.7
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [5c56081]
45
+ - @ai-sdk/provider@2.0.0-alpha.7
46
+ - @ai-sdk/provider-utils@3.0.0-alpha.7
47
+
48
+ ## 2.0.0-alpha.6
49
+
50
+ ### Patch Changes
51
+
52
+ - Updated dependencies [0d2c085]
53
+ - @ai-sdk/provider@2.0.0-alpha.6
54
+ - @ai-sdk/provider-utils@3.0.0-alpha.6
55
+
56
+ ## 2.0.0-alpha.4
57
+
58
+ ### Patch Changes
59
+
60
+ - ca8aac6: feat (providers/anthropic): add claude v4 models
61
+ - Updated dependencies [dc714f3]
62
+ - @ai-sdk/provider@2.0.0-alpha.4
63
+ - @ai-sdk/provider-utils@3.0.0-alpha.4
64
+
65
+ ## 2.0.0-alpha.3
66
+
67
+ ### Patch Changes
68
+
69
+ - Updated dependencies [6b98118]
70
+ - @ai-sdk/provider@2.0.0-alpha.3
71
+ - @ai-sdk/provider-utils@3.0.0-alpha.3
72
+
73
+ ## 2.0.0-alpha.2
74
+
75
+ ### Patch Changes
76
+
77
+ - Updated dependencies [26535e0]
78
+ - @ai-sdk/provider@2.0.0-alpha.2
79
+ - @ai-sdk/provider-utils@3.0.0-alpha.2
80
+
3
81
  ## 2.0.0-alpha.1
4
82
 
5
83
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { ProviderV2, LanguageModelV2 } from '@ai-sdk/provider';
3
3
  import { ToolResultContent, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type AnthropicMessagesModelId = 'claude-3-7-sonnet-20250219' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-4-opus-20250514' | 'claude-4-sonnet-20250514' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
6
6
  declare const anthropicProviderOptions: z.ZodObject<{
7
7
  /**
8
8
  Include reasoning content in requests sent to the model. Defaults to `true`.
@@ -20,18 +20,107 @@ declare const anthropicProviderOptions: z.ZodObject<{
20
20
  type: "enabled" | "disabled";
21
21
  budgetTokens?: number | undefined;
22
22
  }>>;
23
+ /**
24
+ * Web search tool configuration for Claude models that support it.
25
+ * When provided, automatically adds the web search tool to the request.
26
+ */
27
+ webSearch: z.ZodOptional<z.ZodObject<{
28
+ /**
29
+ * Limit the number of searches per request (optional)
30
+ * Defaults to 5 if not specified
31
+ */
32
+ maxUses: z.ZodOptional<z.ZodNumber>;
33
+ /**
34
+ * Only include results from these domains (optional)
35
+ * Cannot be used with blockedDomains
36
+ */
37
+ allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
38
+ /**
39
+ * Never include results from these domains (optional)
40
+ * Cannot be used with allowedDomains
41
+ */
42
+ blockedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
43
+ /**
44
+ * Localize search results based on user location (optional)
45
+ */
46
+ userLocation: z.ZodOptional<z.ZodObject<{
47
+ type: z.ZodLiteral<"approximate">;
48
+ city: z.ZodOptional<z.ZodString>;
49
+ region: z.ZodOptional<z.ZodString>;
50
+ country: z.ZodString;
51
+ timezone: z.ZodOptional<z.ZodString>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ type: "approximate";
54
+ country: string;
55
+ city?: string | undefined;
56
+ region?: string | undefined;
57
+ timezone?: string | undefined;
58
+ }, {
59
+ type: "approximate";
60
+ country: string;
61
+ city?: string | undefined;
62
+ region?: string | undefined;
63
+ timezone?: string | undefined;
64
+ }>>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ maxUses?: number | undefined;
67
+ allowedDomains?: string[] | undefined;
68
+ blockedDomains?: string[] | undefined;
69
+ userLocation?: {
70
+ type: "approximate";
71
+ country: string;
72
+ city?: string | undefined;
73
+ region?: string | undefined;
74
+ timezone?: string | undefined;
75
+ } | undefined;
76
+ }, {
77
+ maxUses?: number | undefined;
78
+ allowedDomains?: string[] | undefined;
79
+ blockedDomains?: string[] | undefined;
80
+ userLocation?: {
81
+ type: "approximate";
82
+ country: string;
83
+ city?: string | undefined;
84
+ region?: string | undefined;
85
+ timezone?: string | undefined;
86
+ } | undefined;
87
+ }>>;
23
88
  }, "strip", z.ZodTypeAny, {
24
89
  sendReasoning?: boolean | undefined;
25
90
  thinking?: {
26
91
  type: "enabled" | "disabled";
27
92
  budgetTokens?: number | undefined;
28
93
  } | undefined;
94
+ webSearch?: {
95
+ maxUses?: number | undefined;
96
+ allowedDomains?: string[] | undefined;
97
+ blockedDomains?: string[] | undefined;
98
+ userLocation?: {
99
+ type: "approximate";
100
+ country: string;
101
+ city?: string | undefined;
102
+ region?: string | undefined;
103
+ timezone?: string | undefined;
104
+ } | undefined;
105
+ } | undefined;
29
106
  }, {
30
107
  sendReasoning?: boolean | undefined;
31
108
  thinking?: {
32
109
  type: "enabled" | "disabled";
33
110
  budgetTokens?: number | undefined;
34
111
  } | undefined;
112
+ webSearch?: {
113
+ maxUses?: number | undefined;
114
+ allowedDomains?: string[] | undefined;
115
+ blockedDomains?: string[] | undefined;
116
+ userLocation?: {
117
+ type: "approximate";
118
+ country: string;
119
+ city?: string | undefined;
120
+ region?: string | undefined;
121
+ timezone?: string | undefined;
122
+ } | undefined;
123
+ } | undefined;
35
124
  }>;
36
125
  type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
37
126
 
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { ProviderV2, LanguageModelV2 } from '@ai-sdk/provider';
3
3
  import { ToolResultContent, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type AnthropicMessagesModelId = 'claude-3-7-sonnet-20250219' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-4-opus-20250514' | 'claude-4-sonnet-20250514' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
6
6
  declare const anthropicProviderOptions: z.ZodObject<{
7
7
  /**
8
8
  Include reasoning content in requests sent to the model. Defaults to `true`.
@@ -20,18 +20,107 @@ declare const anthropicProviderOptions: z.ZodObject<{
20
20
  type: "enabled" | "disabled";
21
21
  budgetTokens?: number | undefined;
22
22
  }>>;
23
+ /**
24
+ * Web search tool configuration for Claude models that support it.
25
+ * When provided, automatically adds the web search tool to the request.
26
+ */
27
+ webSearch: z.ZodOptional<z.ZodObject<{
28
+ /**
29
+ * Limit the number of searches per request (optional)
30
+ * Defaults to 5 if not specified
31
+ */
32
+ maxUses: z.ZodOptional<z.ZodNumber>;
33
+ /**
34
+ * Only include results from these domains (optional)
35
+ * Cannot be used with blockedDomains
36
+ */
37
+ allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
38
+ /**
39
+ * Never include results from these domains (optional)
40
+ * Cannot be used with allowedDomains
41
+ */
42
+ blockedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
43
+ /**
44
+ * Localize search results based on user location (optional)
45
+ */
46
+ userLocation: z.ZodOptional<z.ZodObject<{
47
+ type: z.ZodLiteral<"approximate">;
48
+ city: z.ZodOptional<z.ZodString>;
49
+ region: z.ZodOptional<z.ZodString>;
50
+ country: z.ZodString;
51
+ timezone: z.ZodOptional<z.ZodString>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ type: "approximate";
54
+ country: string;
55
+ city?: string | undefined;
56
+ region?: string | undefined;
57
+ timezone?: string | undefined;
58
+ }, {
59
+ type: "approximate";
60
+ country: string;
61
+ city?: string | undefined;
62
+ region?: string | undefined;
63
+ timezone?: string | undefined;
64
+ }>>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ maxUses?: number | undefined;
67
+ allowedDomains?: string[] | undefined;
68
+ blockedDomains?: string[] | undefined;
69
+ userLocation?: {
70
+ type: "approximate";
71
+ country: string;
72
+ city?: string | undefined;
73
+ region?: string | undefined;
74
+ timezone?: string | undefined;
75
+ } | undefined;
76
+ }, {
77
+ maxUses?: number | undefined;
78
+ allowedDomains?: string[] | undefined;
79
+ blockedDomains?: string[] | undefined;
80
+ userLocation?: {
81
+ type: "approximate";
82
+ country: string;
83
+ city?: string | undefined;
84
+ region?: string | undefined;
85
+ timezone?: string | undefined;
86
+ } | undefined;
87
+ }>>;
23
88
  }, "strip", z.ZodTypeAny, {
24
89
  sendReasoning?: boolean | undefined;
25
90
  thinking?: {
26
91
  type: "enabled" | "disabled";
27
92
  budgetTokens?: number | undefined;
28
93
  } | undefined;
94
+ webSearch?: {
95
+ maxUses?: number | undefined;
96
+ allowedDomains?: string[] | undefined;
97
+ blockedDomains?: string[] | undefined;
98
+ userLocation?: {
99
+ type: "approximate";
100
+ country: string;
101
+ city?: string | undefined;
102
+ region?: string | undefined;
103
+ timezone?: string | undefined;
104
+ } | undefined;
105
+ } | undefined;
29
106
  }, {
30
107
  sendReasoning?: boolean | undefined;
31
108
  thinking?: {
32
109
  type: "enabled" | "disabled";
33
110
  budgetTokens?: number | undefined;
34
111
  } | undefined;
112
+ webSearch?: {
113
+ maxUses?: number | undefined;
114
+ allowedDomains?: string[] | undefined;
115
+ blockedDomains?: string[] | undefined;
116
+ userLocation?: {
117
+ type: "approximate";
118
+ country: string;
119
+ city?: string | undefined;
120
+ region?: string | undefined;
121
+ timezone?: string | undefined;
122
+ } | undefined;
123
+ } | undefined;
35
124
  }>;
36
125
  type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
37
126