@ai-sdk/anthropic 3.0.80 → 3.0.81
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 +6 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -10
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +2 -2
- package/dist/internal/index.d.ts +2 -2
- package/dist/internal/index.js +10 -9
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +10 -9
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +5 -4
- package/package.json +1 -1
- package/src/anthropic-messages-api.ts +9 -1
- package/src/anthropic-messages-language-model.ts +4 -1
- package/src/anthropic-messages-options.ts +1 -0
- package/src/anthropic-tools.ts +1 -1
- package/src/convert-to-anthropic-messages-prompt.ts +9 -9
- package/src/tool/advisor_20260301.ts +1 -1
package/docs/05-anthropic.mdx
CHANGED
|
@@ -243,7 +243,7 @@ import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
|
|
|
243
243
|
import { generateText } from 'ai';
|
|
244
244
|
|
|
245
245
|
const { text } = await generateText({
|
|
246
|
-
model: anthropic('claude-opus-4-
|
|
246
|
+
model: anthropic('claude-opus-4-8'),
|
|
247
247
|
prompt: 'Research the pros and cons of Rust vs Go for building CLI tools.',
|
|
248
248
|
providerOptions: {
|
|
249
249
|
anthropic: {
|
|
@@ -342,7 +342,7 @@ Starting with `claude-opus-4-7`, thinking content is omitted from the response b
|
|
|
342
342
|
|
|
343
343
|
```ts highlight="5"
|
|
344
344
|
const { text, reasoningText } = await generateText({
|
|
345
|
-
model: anthropic('claude-opus-4-
|
|
345
|
+
model: anthropic('claude-opus-4-8'),
|
|
346
346
|
providerOptions: {
|
|
347
347
|
anthropic: {
|
|
348
348
|
thinking: { type: 'adaptive', display: 'summarized' },
|
|
@@ -971,7 +971,7 @@ const result = await generateText({
|
|
|
971
971
|
'Build a concurrent worker pool in Go with graceful shutdown. Outline the design first.',
|
|
972
972
|
tools: {
|
|
973
973
|
advisor: anthropic.tools.advisor_20260301({
|
|
974
|
-
model: 'claude-opus-4-
|
|
974
|
+
model: 'claude-opus-4-8',
|
|
975
975
|
maxUses: 3,
|
|
976
976
|
}),
|
|
977
977
|
},
|
|
@@ -989,7 +989,7 @@ The advisor tool supports the following configuration options:
|
|
|
989
989
|
|
|
990
990
|
- **model** _string_
|
|
991
991
|
|
|
992
|
-
Required. The advisor model ID, such as `claude-opus-4-
|
|
992
|
+
Required. The advisor model ID, such as `claude-opus-4-8`. The advisor model must be at least as capable as the executor model.
|
|
993
993
|
|
|
994
994
|
- **maxUses** _number_
|
|
995
995
|
|
|
@@ -1502,6 +1502,7 @@ and the `mediaType` should be set to `'application/pdf'`.
|
|
|
1502
1502
|
|
|
1503
1503
|
| Model | Image Input | Object Generation | Tool Usage | Computer Use | Web Search | Tool Search | Compaction |
|
|
1504
1504
|
| ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
|
|
1505
|
+
| `claude-opus-4-8` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
1505
1506
|
| `claude-opus-4-7` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
1506
1507
|
| `claude-opus-4-6` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
1507
1508
|
| `claude-sonnet-4-6` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | |
|
package/package.json
CHANGED
|
@@ -11,13 +11,21 @@ export type AnthropicMessagesPrompt = {
|
|
|
11
11
|
messages: AnthropicMessage[];
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export type AnthropicMessage =
|
|
14
|
+
export type AnthropicMessage =
|
|
15
|
+
| AnthropicUserMessage
|
|
16
|
+
| AnthropicAssistantMessage
|
|
17
|
+
| AnthropicSystemMessage;
|
|
15
18
|
|
|
16
19
|
export type AnthropicCacheControl = {
|
|
17
20
|
type: 'ephemeral';
|
|
18
21
|
ttl?: '5m' | '1h';
|
|
19
22
|
};
|
|
20
23
|
|
|
24
|
+
export interface AnthropicSystemMessage {
|
|
25
|
+
role: 'system';
|
|
26
|
+
content: Array<AnthropicTextContent>;
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
export interface AnthropicUserMessage {
|
|
22
30
|
role: 'user';
|
|
23
31
|
content: Array<
|
|
@@ -2528,7 +2528,10 @@ function getModelCapabilities(modelId: string): {
|
|
|
2528
2528
|
rejectsSamplingParameters: boolean;
|
|
2529
2529
|
isKnownModel: boolean;
|
|
2530
2530
|
} {
|
|
2531
|
-
if (
|
|
2531
|
+
if (
|
|
2532
|
+
modelId.includes('claude-opus-4-8') ||
|
|
2533
|
+
modelId.includes('claude-opus-4-7')
|
|
2534
|
+
) {
|
|
2532
2535
|
return {
|
|
2533
2536
|
maxOutputTokens: 128000,
|
|
2534
2537
|
supportsStructuredOutput: true,
|
package/src/anthropic-tools.ts
CHANGED
|
@@ -42,7 +42,7 @@ export const anthropicTools = {
|
|
|
42
42
|
* Supported executor models: Claude Haiku 4.5, Sonnet 4.6, Opus 4.6,
|
|
43
43
|
* Opus 4.7. The advisor must be at least as capable as the executor.
|
|
44
44
|
*
|
|
45
|
-
* @param model - The advisor model ID (required), e.g. `"claude-opus-4-
|
|
45
|
+
* @param model - The advisor model ID (required), e.g. `"claude-opus-4-8"`.
|
|
46
46
|
* @param maxUses - Maximum advisor calls per request (per-request cap).
|
|
47
47
|
* @param caching - Enables prompt caching for the advisor's transcript
|
|
48
48
|
* across calls within a conversation. Worthwhile from ~3 advisor calls
|
|
@@ -157,15 +157,8 @@ export async function convertToAnthropicMessagesPrompt({
|
|
|
157
157
|
|
|
158
158
|
switch (type) {
|
|
159
159
|
case 'system': {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
functionality:
|
|
163
|
-
'Multiple system messages that are separated by user/assistant messages',
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
system = block.messages.map(({ content, providerOptions }) => ({
|
|
168
|
-
type: 'text',
|
|
160
|
+
const content = block.messages.map(({ content, providerOptions }) => ({
|
|
161
|
+
type: 'text' as const,
|
|
169
162
|
text: content,
|
|
170
163
|
cache_control: validator.getCacheControl(providerOptions, {
|
|
171
164
|
type: 'system message',
|
|
@@ -173,6 +166,13 @@ export async function convertToAnthropicMessagesPrompt({
|
|
|
173
166
|
}),
|
|
174
167
|
}));
|
|
175
168
|
|
|
169
|
+
if (system == null) {
|
|
170
|
+
system = content;
|
|
171
|
+
} else {
|
|
172
|
+
messages.push({ role: 'system', content });
|
|
173
|
+
betas.add('mid-conversation-system-2026-04-07');
|
|
174
|
+
}
|
|
175
|
+
|
|
176
176
|
break;
|
|
177
177
|
}
|
|
178
178
|
|
|
@@ -77,7 +77,7 @@ const factory = createProviderToolFactoryWithOutputSchema<
|
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
/**
|
|
80
|
-
* The advisor model ID, such as `"claude-opus-4-
|
|
80
|
+
* The advisor model ID, such as `"claude-opus-4-8"`. Billed at this
|
|
81
81
|
* model's rates for the sub-inference.
|
|
82
82
|
*
|
|
83
83
|
* The advisor must be at least as capable as the executor; an invalid
|