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

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,54 +1,211 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
- ## 1.2.11
3
+ ## 2.0.0-alpha.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [d87b9d1]
8
- - @ai-sdk/provider-utils@2.2.8
7
+ - Updated dependencies [3f2f00c]
8
+ - @ai-sdk/provider@2.0.0-alpha.1
9
+ - @ai-sdk/provider-utils@3.0.0-alpha.1
9
10
 
10
- ## 1.2.10
11
+ ## 2.0.0-canary.19
11
12
 
12
13
  ### Patch Changes
13
14
 
14
- - Updated dependencies [beef951]
15
- - @ai-sdk/provider@1.1.3
16
- - @ai-sdk/provider-utils@2.2.7
15
+ - Updated dependencies [faf8446]
16
+ - @ai-sdk/provider-utils@3.0.0-canary.19
17
17
 
18
- ## 1.2.9
18
+ ## 2.0.0-canary.18
19
19
 
20
20
  ### Patch Changes
21
21
 
22
- - aeba38e: Add support for URL-based PDF documents in the Anthropic provider
22
+ - Updated dependencies [40acf9b]
23
+ - @ai-sdk/provider-utils@3.0.0-canary.18
23
24
 
24
- ## 1.2.8
25
+ ## 2.0.0-canary.17
25
26
 
26
27
  ### Patch Changes
27
28
 
28
- - Updated dependencies [013faa8]
29
- - @ai-sdk/provider@1.1.2
30
- - @ai-sdk/provider-utils@2.2.6
29
+ - Updated dependencies [ea7a7c9]
30
+ - @ai-sdk/provider-utils@3.0.0-canary.17
31
31
 
32
- ## 1.2.7
32
+ ## 2.0.0-canary.16
33
33
 
34
34
  ### Patch Changes
35
35
 
36
- - Updated dependencies [c21fa6d]
37
- - @ai-sdk/provider-utils@2.2.5
38
- - @ai-sdk/provider@1.1.1
36
+ - Updated dependencies [87b828f]
37
+ - @ai-sdk/provider-utils@3.0.0-canary.16
39
38
 
40
- ## 1.2.6
39
+ ## 2.0.0-canary.15
41
40
 
42
41
  ### Patch Changes
43
42
 
44
- - Updated dependencies [2c19b9a]
45
- - @ai-sdk/provider-utils@2.2.4
43
+ - Updated dependencies [a571d6e]
44
+ - Updated dependencies [a8c8bd5]
45
+ - Updated dependencies [7979f7f]
46
+ - Updated dependencies [41fa418]
47
+ - @ai-sdk/provider-utils@3.0.0-canary.15
48
+ - @ai-sdk/provider@2.0.0-canary.14
46
49
 
47
- ## 1.2.5
50
+ ## 2.0.0-canary.14
48
51
 
49
52
  ### Patch Changes
50
53
 
51
- - 292f543: fix (provider/google-vertex): fix anthropic support for image urls in messages
54
+ - Updated dependencies [957b739]
55
+ - Updated dependencies [9bd5ab5]
56
+ - @ai-sdk/provider-utils@3.0.0-canary.14
57
+ - @ai-sdk/provider@2.0.0-canary.13
58
+
59
+ ## 2.0.0-canary.13
60
+
61
+ ### Patch Changes
62
+
63
+ - Updated dependencies [7b3ae3f]
64
+ - Updated dependencies [0ff02bb]
65
+ - @ai-sdk/provider@2.0.0-canary.12
66
+ - @ai-sdk/provider-utils@3.0.0-canary.13
67
+
68
+ ## 2.0.0-canary.12
69
+
70
+ ### Patch Changes
71
+
72
+ - 5c9eec4: chore(providers/anthropic): switch to providerOptions
73
+ - Updated dependencies [9bf7291]
74
+ - Updated dependencies [4617fab]
75
+ - Updated dependencies [e030615]
76
+ - @ai-sdk/provider@2.0.0-canary.11
77
+ - @ai-sdk/provider-utils@3.0.0-canary.12
78
+
79
+ ## 2.0.0-canary.11
80
+
81
+ ### Patch Changes
82
+
83
+ - 66962ed: fix(packages): export node10 compatible types
84
+ - Updated dependencies [66962ed]
85
+ - Updated dependencies [9301f86]
86
+ - Updated dependencies [a3f768e]
87
+ - @ai-sdk/provider-utils@3.0.0-canary.11
88
+ - @ai-sdk/provider@2.0.0-canary.10
89
+
90
+ ## 2.0.0-canary.10
91
+
92
+ ### Patch Changes
93
+
94
+ - Updated dependencies [e86be6f]
95
+ - @ai-sdk/provider@2.0.0-canary.9
96
+ - @ai-sdk/provider-utils@3.0.0-canary.10
97
+
98
+ ## 2.0.0-canary.9
99
+
100
+ ### Patch Changes
101
+
102
+ - Updated dependencies [95857aa]
103
+ - Updated dependencies [7ea4132]
104
+ - @ai-sdk/provider@2.0.0-canary.8
105
+ - @ai-sdk/provider-utils@3.0.0-canary.9
106
+
107
+ ## 2.0.0-canary.8
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [5d142ab]
112
+ - Updated dependencies [b6b43c7]
113
+ - Updated dependencies [8aa9e20]
114
+ - Updated dependencies [3795467]
115
+ - @ai-sdk/provider-utils@3.0.0-canary.8
116
+ - @ai-sdk/provider@2.0.0-canary.7
117
+
118
+ ## 2.0.0-canary.7
119
+
120
+ ### Patch Changes
121
+
122
+ - Updated dependencies [26735b5]
123
+ - Updated dependencies [443d8ec]
124
+ - Updated dependencies [14c9410]
125
+ - Updated dependencies [d9c98f4]
126
+ - Updated dependencies [c4a2fec]
127
+ - Updated dependencies [0054544]
128
+ - Updated dependencies [9e9c809]
129
+ - Updated dependencies [32831c6]
130
+ - Updated dependencies [d0f9495]
131
+ - Updated dependencies [fd65bc6]
132
+ - Updated dependencies [393138b]
133
+ - Updated dependencies [7182d14]
134
+ - @ai-sdk/provider@2.0.0-canary.6
135
+ - @ai-sdk/provider-utils@3.0.0-canary.7
136
+
137
+ ## 2.0.0-canary.6
138
+
139
+ ### Patch Changes
140
+
141
+ - f10304b: feat(tool-calling): don't require the user to have to pass parameters
142
+ - Updated dependencies [411e483]
143
+ - Updated dependencies [79457bd]
144
+ - Updated dependencies [ad80501]
145
+ - Updated dependencies [1766ede]
146
+ - Updated dependencies [f10304b]
147
+ - @ai-sdk/provider@2.0.0-canary.5
148
+ - @ai-sdk/provider-utils@3.0.0-canary.6
149
+
150
+ ## 2.0.0-canary.5
151
+
152
+ ### Patch Changes
153
+
154
+ - Updated dependencies [6f6bb89]
155
+ - @ai-sdk/provider@2.0.0-canary.4
156
+ - @ai-sdk/provider-utils@3.0.0-canary.5
157
+
158
+ ## 2.0.0-canary.4
159
+
160
+ ### Patch Changes
161
+
162
+ - Updated dependencies [d1a1aa1]
163
+ - @ai-sdk/provider@2.0.0-canary.3
164
+ - @ai-sdk/provider-utils@3.0.0-canary.4
165
+
166
+ ## 2.0.0-canary.3
167
+
168
+ ### Patch Changes
169
+
170
+ - 61ab528: Add support for URL-based PDF documents in the Anthropic provider
171
+ - Updated dependencies [a166433]
172
+ - Updated dependencies [abf9a79]
173
+ - Updated dependencies [9f95b35]
174
+ - Updated dependencies [0a87932]
175
+ - Updated dependencies [6dc848c]
176
+ - @ai-sdk/provider-utils@3.0.0-canary.3
177
+ - @ai-sdk/provider@2.0.0-canary.2
178
+
179
+ ## 2.0.0-canary.2
180
+
181
+ ### Patch Changes
182
+
183
+ - Updated dependencies [c57e248]
184
+ - Updated dependencies [33f4a6a]
185
+ - @ai-sdk/provider@2.0.0-canary.1
186
+ - @ai-sdk/provider-utils@3.0.0-canary.2
187
+
188
+ ## 2.0.0-canary.1
189
+
190
+ ### Patch Changes
191
+
192
+ - Updated dependencies [060370c]
193
+ - Updated dependencies [0c0c0b3]
194
+ - Updated dependencies [63d791d]
195
+ - @ai-sdk/provider-utils@3.0.0-canary.1
196
+
197
+ ## 2.0.0-canary.0
198
+
199
+ ### Major Changes
200
+
201
+ - d5f588f: AI SDK 5
202
+
203
+ ### Patch Changes
204
+
205
+ - 91715e5: fix (provider/google-vertex): fix anthropic support for image urls in messages
206
+ - Updated dependencies [d5f588f]
207
+ - @ai-sdk/provider-utils@3.0.0-canary.0
208
+ - @ai-sdk/provider@2.0.0-canary.0
52
209
 
53
210
  ## 1.2.4
54
211
 
package/dist/index.d.mts CHANGED
@@ -1,27 +1,15 @@
1
1
  import { z } from 'zod';
2
- import { ProviderV1, LanguageModelV1 } from '@ai-sdk/provider';
3
- import { FetchFunction } from '@ai-sdk/provider-utils';
2
+ import { ProviderV2, LanguageModelV2 } from '@ai-sdk/provider';
3
+ import { ToolResultContent, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
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 & {});
6
- interface AnthropicMessagesSettings {
7
- /**
8
- Enable Anthropic cache control. This will allow you to use provider-specific
9
- `cacheControl` metadata.
10
-
11
- @deprecated cache control is now enabled by default (meaning you are able to
12
- optionally mark content for caching) and this setting is no longer needed.
13
- */
14
- cacheControl?: boolean;
6
+ declare const anthropicProviderOptions: z.ZodObject<{
15
7
  /**
16
8
  Include reasoning content in requests sent to the model. Defaults to `true`.
17
9
 
18
10
  If you are experiencing issues with the model handling requests involving
19
- reasoning content, you can set this to `false` to omit them from the request.
20
11
  */
21
- sendReasoning?: boolean;
22
- }
23
-
24
- declare const anthropicProviderOptionsSchema: z.ZodObject<{
12
+ sendReasoning: z.ZodOptional<z.ZodBoolean>;
25
13
  thinking: z.ZodOptional<z.ZodObject<{
26
14
  type: z.ZodUnion<[z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>;
27
15
  budgetTokens: z.ZodOptional<z.ZodNumber>;
@@ -33,29 +21,23 @@ declare const anthropicProviderOptionsSchema: z.ZodObject<{
33
21
  budgetTokens?: number | undefined;
34
22
  }>>;
35
23
  }, "strip", z.ZodTypeAny, {
24
+ sendReasoning?: boolean | undefined;
36
25
  thinking?: {
37
26
  type: "enabled" | "disabled";
38
27
  budgetTokens?: number | undefined;
39
28
  } | undefined;
40
29
  }, {
30
+ sendReasoning?: boolean | undefined;
41
31
  thinking?: {
42
32
  type: "enabled" | "disabled";
43
33
  budgetTokens?: number | undefined;
44
34
  } | undefined;
45
35
  }>;
46
- type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptionsSchema>;
36
+ type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
47
37
 
48
38
  type ExecuteFunction<PARAMETERS, RESULT> = undefined | ((args: PARAMETERS, options: {
49
39
  abortSignal?: AbortSignal;
50
40
  }) => Promise<RESULT>);
51
- type ToolResultContent = Array<{
52
- type: 'text';
53
- text: string;
54
- } | {
55
- type: 'image';
56
- data: string;
57
- mimeType?: string;
58
- }>;
59
41
  declare const Bash20241022Parameters: z.ZodObject<{
60
42
  command: z.ZodString;
61
43
  restart: z.ZodOptional<z.ZodBoolean>;
@@ -440,23 +422,23 @@ declare const anthropicTools: {
440
422
  computer_20250124: typeof computerTool_20250124;
441
423
  };
442
424
 
443
- interface AnthropicProvider extends ProviderV1 {
425
+ interface AnthropicProvider extends ProviderV2 {
444
426
  /**
445
427
  Creates a model for text generation.
446
428
  */
447
- (modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): LanguageModelV1;
429
+ (modelId: AnthropicMessagesModelId): LanguageModelV2;
448
430
  /**
449
431
  Creates a model for text generation.
450
432
  */
451
- languageModel(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): LanguageModelV1;
433
+ languageModel(modelId: AnthropicMessagesModelId): LanguageModelV2;
452
434
  /**
453
435
  @deprecated Use `.languageModel()` instead.
454
436
  */
455
- chat(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): LanguageModelV1;
437
+ chat(modelId: AnthropicMessagesModelId): LanguageModelV2;
456
438
  /**
457
439
  @deprecated Use `.languageModel()` instead.
458
440
  */
459
- messages(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): LanguageModelV1;
441
+ messages(modelId: AnthropicMessagesModelId): LanguageModelV2;
460
442
  /**
461
443
  Anthropic-specific computer use tool.
462
444
  */
package/dist/index.d.ts CHANGED
@@ -1,27 +1,15 @@
1
1
  import { z } from 'zod';
2
- import { ProviderV1, LanguageModelV1 } from '@ai-sdk/provider';
3
- import { FetchFunction } from '@ai-sdk/provider-utils';
2
+ import { ProviderV2, LanguageModelV2 } from '@ai-sdk/provider';
3
+ import { ToolResultContent, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
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 & {});
6
- interface AnthropicMessagesSettings {
7
- /**
8
- Enable Anthropic cache control. This will allow you to use provider-specific
9
- `cacheControl` metadata.
10
-
11
- @deprecated cache control is now enabled by default (meaning you are able to
12
- optionally mark content for caching) and this setting is no longer needed.
13
- */
14
- cacheControl?: boolean;
6
+ declare const anthropicProviderOptions: z.ZodObject<{
15
7
  /**
16
8
  Include reasoning content in requests sent to the model. Defaults to `true`.
17
9
 
18
10
  If you are experiencing issues with the model handling requests involving
19
- reasoning content, you can set this to `false` to omit them from the request.
20
11
  */
21
- sendReasoning?: boolean;
22
- }
23
-
24
- declare const anthropicProviderOptionsSchema: z.ZodObject<{
12
+ sendReasoning: z.ZodOptional<z.ZodBoolean>;
25
13
  thinking: z.ZodOptional<z.ZodObject<{
26
14
  type: z.ZodUnion<[z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>;
27
15
  budgetTokens: z.ZodOptional<z.ZodNumber>;
@@ -33,29 +21,23 @@ declare const anthropicProviderOptionsSchema: z.ZodObject<{
33
21
  budgetTokens?: number | undefined;
34
22
  }>>;
35
23
  }, "strip", z.ZodTypeAny, {
24
+ sendReasoning?: boolean | undefined;
36
25
  thinking?: {
37
26
  type: "enabled" | "disabled";
38
27
  budgetTokens?: number | undefined;
39
28
  } | undefined;
40
29
  }, {
30
+ sendReasoning?: boolean | undefined;
41
31
  thinking?: {
42
32
  type: "enabled" | "disabled";
43
33
  budgetTokens?: number | undefined;
44
34
  } | undefined;
45
35
  }>;
46
- type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptionsSchema>;
36
+ type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
47
37
 
48
38
  type ExecuteFunction<PARAMETERS, RESULT> = undefined | ((args: PARAMETERS, options: {
49
39
  abortSignal?: AbortSignal;
50
40
  }) => Promise<RESULT>);
51
- type ToolResultContent = Array<{
52
- type: 'text';
53
- text: string;
54
- } | {
55
- type: 'image';
56
- data: string;
57
- mimeType?: string;
58
- }>;
59
41
  declare const Bash20241022Parameters: z.ZodObject<{
60
42
  command: z.ZodString;
61
43
  restart: z.ZodOptional<z.ZodBoolean>;
@@ -440,23 +422,23 @@ declare const anthropicTools: {
440
422
  computer_20250124: typeof computerTool_20250124;
441
423
  };
442
424
 
443
- interface AnthropicProvider extends ProviderV1 {
425
+ interface AnthropicProvider extends ProviderV2 {
444
426
  /**
445
427
  Creates a model for text generation.
446
428
  */
447
- (modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): LanguageModelV1;
429
+ (modelId: AnthropicMessagesModelId): LanguageModelV2;
448
430
  /**
449
431
  Creates a model for text generation.
450
432
  */
451
- languageModel(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): LanguageModelV1;
433
+ languageModel(modelId: AnthropicMessagesModelId): LanguageModelV2;
452
434
  /**
453
435
  @deprecated Use `.languageModel()` instead.
454
436
  */
455
- chat(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): LanguageModelV1;
437
+ chat(modelId: AnthropicMessagesModelId): LanguageModelV2;
456
438
  /**
457
439
  @deprecated Use `.languageModel()` instead.
458
440
  */
459
- messages(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): LanguageModelV1;
441
+ messages(modelId: AnthropicMessagesModelId): LanguageModelV2;
460
442
  /**
461
443
  Anthropic-specific computer use tool.
462
444
  */