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

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,219 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
- ## 1.2.11
3
+ ## 2.0.0-alpha.2
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [d87b9d1]
8
- - @ai-sdk/provider-utils@2.2.8
7
+ - Updated dependencies [26535e0]
8
+ - @ai-sdk/provider@2.0.0-alpha.2
9
+ - @ai-sdk/provider-utils@3.0.0-alpha.2
9
10
 
10
- ## 1.2.10
11
+ ## 2.0.0-alpha.1
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 [3f2f00c]
16
+ - @ai-sdk/provider@2.0.0-alpha.1
17
+ - @ai-sdk/provider-utils@3.0.0-alpha.1
17
18
 
18
- ## 1.2.9
19
+ ## 2.0.0-canary.19
19
20
 
20
21
  ### Patch Changes
21
22
 
22
- - aeba38e: Add support for URL-based PDF documents in the Anthropic provider
23
+ - Updated dependencies [faf8446]
24
+ - @ai-sdk/provider-utils@3.0.0-canary.19
23
25
 
24
- ## 1.2.8
26
+ ## 2.0.0-canary.18
25
27
 
26
28
  ### Patch Changes
27
29
 
28
- - Updated dependencies [013faa8]
29
- - @ai-sdk/provider@1.1.2
30
- - @ai-sdk/provider-utils@2.2.6
30
+ - Updated dependencies [40acf9b]
31
+ - @ai-sdk/provider-utils@3.0.0-canary.18
31
32
 
32
- ## 1.2.7
33
+ ## 2.0.0-canary.17
33
34
 
34
35
  ### Patch Changes
35
36
 
36
- - Updated dependencies [c21fa6d]
37
- - @ai-sdk/provider-utils@2.2.5
38
- - @ai-sdk/provider@1.1.1
37
+ - Updated dependencies [ea7a7c9]
38
+ - @ai-sdk/provider-utils@3.0.0-canary.17
39
39
 
40
- ## 1.2.6
40
+ ## 2.0.0-canary.16
41
41
 
42
42
  ### Patch Changes
43
43
 
44
- - Updated dependencies [2c19b9a]
45
- - @ai-sdk/provider-utils@2.2.4
44
+ - Updated dependencies [87b828f]
45
+ - @ai-sdk/provider-utils@3.0.0-canary.16
46
46
 
47
- ## 1.2.5
47
+ ## 2.0.0-canary.15
48
48
 
49
49
  ### Patch Changes
50
50
 
51
- - 292f543: fix (provider/google-vertex): fix anthropic support for image urls in messages
51
+ - Updated dependencies [a571d6e]
52
+ - Updated dependencies [a8c8bd5]
53
+ - Updated dependencies [7979f7f]
54
+ - Updated dependencies [41fa418]
55
+ - @ai-sdk/provider-utils@3.0.0-canary.15
56
+ - @ai-sdk/provider@2.0.0-canary.14
57
+
58
+ ## 2.0.0-canary.14
59
+
60
+ ### Patch Changes
61
+
62
+ - Updated dependencies [957b739]
63
+ - Updated dependencies [9bd5ab5]
64
+ - @ai-sdk/provider-utils@3.0.0-canary.14
65
+ - @ai-sdk/provider@2.0.0-canary.13
66
+
67
+ ## 2.0.0-canary.13
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [7b3ae3f]
72
+ - Updated dependencies [0ff02bb]
73
+ - @ai-sdk/provider@2.0.0-canary.12
74
+ - @ai-sdk/provider-utils@3.0.0-canary.13
75
+
76
+ ## 2.0.0-canary.12
77
+
78
+ ### Patch Changes
79
+
80
+ - 5c9eec4: chore(providers/anthropic): switch to providerOptions
81
+ - Updated dependencies [9bf7291]
82
+ - Updated dependencies [4617fab]
83
+ - Updated dependencies [e030615]
84
+ - @ai-sdk/provider@2.0.0-canary.11
85
+ - @ai-sdk/provider-utils@3.0.0-canary.12
86
+
87
+ ## 2.0.0-canary.11
88
+
89
+ ### Patch Changes
90
+
91
+ - 66962ed: fix(packages): export node10 compatible types
92
+ - Updated dependencies [66962ed]
93
+ - Updated dependencies [9301f86]
94
+ - Updated dependencies [a3f768e]
95
+ - @ai-sdk/provider-utils@3.0.0-canary.11
96
+ - @ai-sdk/provider@2.0.0-canary.10
97
+
98
+ ## 2.0.0-canary.10
99
+
100
+ ### Patch Changes
101
+
102
+ - Updated dependencies [e86be6f]
103
+ - @ai-sdk/provider@2.0.0-canary.9
104
+ - @ai-sdk/provider-utils@3.0.0-canary.10
105
+
106
+ ## 2.0.0-canary.9
107
+
108
+ ### Patch Changes
109
+
110
+ - Updated dependencies [95857aa]
111
+ - Updated dependencies [7ea4132]
112
+ - @ai-sdk/provider@2.0.0-canary.8
113
+ - @ai-sdk/provider-utils@3.0.0-canary.9
114
+
115
+ ## 2.0.0-canary.8
116
+
117
+ ### Patch Changes
118
+
119
+ - Updated dependencies [5d142ab]
120
+ - Updated dependencies [b6b43c7]
121
+ - Updated dependencies [8aa9e20]
122
+ - Updated dependencies [3795467]
123
+ - @ai-sdk/provider-utils@3.0.0-canary.8
124
+ - @ai-sdk/provider@2.0.0-canary.7
125
+
126
+ ## 2.0.0-canary.7
127
+
128
+ ### Patch Changes
129
+
130
+ - Updated dependencies [26735b5]
131
+ - Updated dependencies [443d8ec]
132
+ - Updated dependencies [14c9410]
133
+ - Updated dependencies [d9c98f4]
134
+ - Updated dependencies [c4a2fec]
135
+ - Updated dependencies [0054544]
136
+ - Updated dependencies [9e9c809]
137
+ - Updated dependencies [32831c6]
138
+ - Updated dependencies [d0f9495]
139
+ - Updated dependencies [fd65bc6]
140
+ - Updated dependencies [393138b]
141
+ - Updated dependencies [7182d14]
142
+ - @ai-sdk/provider@2.0.0-canary.6
143
+ - @ai-sdk/provider-utils@3.0.0-canary.7
144
+
145
+ ## 2.0.0-canary.6
146
+
147
+ ### Patch Changes
148
+
149
+ - f10304b: feat(tool-calling): don't require the user to have to pass parameters
150
+ - Updated dependencies [411e483]
151
+ - Updated dependencies [79457bd]
152
+ - Updated dependencies [ad80501]
153
+ - Updated dependencies [1766ede]
154
+ - Updated dependencies [f10304b]
155
+ - @ai-sdk/provider@2.0.0-canary.5
156
+ - @ai-sdk/provider-utils@3.0.0-canary.6
157
+
158
+ ## 2.0.0-canary.5
159
+
160
+ ### Patch Changes
161
+
162
+ - Updated dependencies [6f6bb89]
163
+ - @ai-sdk/provider@2.0.0-canary.4
164
+ - @ai-sdk/provider-utils@3.0.0-canary.5
165
+
166
+ ## 2.0.0-canary.4
167
+
168
+ ### Patch Changes
169
+
170
+ - Updated dependencies [d1a1aa1]
171
+ - @ai-sdk/provider@2.0.0-canary.3
172
+ - @ai-sdk/provider-utils@3.0.0-canary.4
173
+
174
+ ## 2.0.0-canary.3
175
+
176
+ ### Patch Changes
177
+
178
+ - 61ab528: Add support for URL-based PDF documents in the Anthropic provider
179
+ - Updated dependencies [a166433]
180
+ - Updated dependencies [abf9a79]
181
+ - Updated dependencies [9f95b35]
182
+ - Updated dependencies [0a87932]
183
+ - Updated dependencies [6dc848c]
184
+ - @ai-sdk/provider-utils@3.0.0-canary.3
185
+ - @ai-sdk/provider@2.0.0-canary.2
186
+
187
+ ## 2.0.0-canary.2
188
+
189
+ ### Patch Changes
190
+
191
+ - Updated dependencies [c57e248]
192
+ - Updated dependencies [33f4a6a]
193
+ - @ai-sdk/provider@2.0.0-canary.1
194
+ - @ai-sdk/provider-utils@3.0.0-canary.2
195
+
196
+ ## 2.0.0-canary.1
197
+
198
+ ### Patch Changes
199
+
200
+ - Updated dependencies [060370c]
201
+ - Updated dependencies [0c0c0b3]
202
+ - Updated dependencies [63d791d]
203
+ - @ai-sdk/provider-utils@3.0.0-canary.1
204
+
205
+ ## 2.0.0-canary.0
206
+
207
+ ### Major Changes
208
+
209
+ - d5f588f: AI SDK 5
210
+
211
+ ### Patch Changes
212
+
213
+ - 91715e5: fix (provider/google-vertex): fix anthropic support for image urls in messages
214
+ - Updated dependencies [d5f588f]
215
+ - @ai-sdk/provider-utils@3.0.0-canary.0
216
+ - @ai-sdk/provider@2.0.0-canary.0
52
217
 
53
218
  ## 1.2.4
54
219
 
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
  */