@ai-sdk/anthropic 4.0.104 → 4.0.105
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.ts +106 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +234 -131
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +9 -2
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +5 -0
- package/package.json +1 -1
- package/src/anthropic-language-model-options.ts +2 -27
- package/src/anthropic-model-catalog.ts +21 -6
package/docs/05-anthropic.mdx
CHANGED
package/package.json
CHANGED
|
@@ -4,35 +4,10 @@ import {
|
|
|
4
4
|
type InferSchema,
|
|
5
5
|
} from '@ai-sdk/provider-utils';
|
|
6
6
|
import { z } from 'zod/v4';
|
|
7
|
+
import type { AnthropicModelIds } from './anthropic-model-catalog';
|
|
7
8
|
|
|
8
9
|
// https://docs.claude.com/en/docs/about-claude/models/overview
|
|
9
|
-
export type AnthropicModelId =
|
|
10
|
-
| 'claude-3-haiku-20240307'
|
|
11
|
-
| 'claude-haiku-4-5-20251001'
|
|
12
|
-
| 'claude-haiku-4-5'
|
|
13
|
-
| 'claude-haiku-5-5'
|
|
14
|
-
| 'claude-opus-4-0'
|
|
15
|
-
| 'claude-opus-4-20250514'
|
|
16
|
-
| 'claude-opus-4-1-20250805'
|
|
17
|
-
| 'claude-opus-4-1'
|
|
18
|
-
| 'claude-opus-4-5'
|
|
19
|
-
| 'claude-opus-4-5-20251101'
|
|
20
|
-
| 'claude-sonnet-4-0'
|
|
21
|
-
| 'claude-sonnet-4-20250514'
|
|
22
|
-
| 'claude-sonnet-4-5-20250929'
|
|
23
|
-
| 'claude-sonnet-4-5'
|
|
24
|
-
| 'claude-sonnet-4-6'
|
|
25
|
-
| 'claude-opus-4-6'
|
|
26
|
-
| 'claude-opus-4-7'
|
|
27
|
-
| 'claude-opus-4-8'
|
|
28
|
-
| 'claude-opus-5'
|
|
29
|
-
| 'claude-opus-5-5'
|
|
30
|
-
| 'claude-fable-5'
|
|
31
|
-
| 'claude-fable-5-1'
|
|
32
|
-
| 'claude-fable-5-2'
|
|
33
|
-
| 'claude-sonnet-5'
|
|
34
|
-
| 'claude-sonnet-5-5'
|
|
35
|
-
| (string & {});
|
|
10
|
+
export type AnthropicModelId = AnthropicModelIds['language'] | (string & {});
|
|
36
11
|
|
|
37
12
|
/**
|
|
38
13
|
* Anthropic file part provider options for document-specific features.
|
|
@@ -248,7 +248,7 @@ const runtimeRules: readonly {
|
|
|
248
248
|
},
|
|
249
249
|
];
|
|
250
250
|
|
|
251
|
-
const
|
|
251
|
+
const languageModelDefinitions = {
|
|
252
252
|
'claude-opus-5-5': { toolSearch: true, compaction: true, effort: true },
|
|
253
253
|
'claude-opus-5': { toolSearch: true, compaction: true, effort: true },
|
|
254
254
|
'claude-sonnet-5-5': { toolSearch: true, compaction: true, effort: true },
|
|
@@ -267,15 +267,25 @@ const documentedModels: Readonly<Record<string, DocumentedCapabilities>> = {
|
|
|
267
267
|
'claude-opus-4-1': { toolSearch: false, compaction: false, effort: false },
|
|
268
268
|
'claude-opus-4-0': { toolSearch: false, compaction: false, effort: false },
|
|
269
269
|
'claude-sonnet-4-0': { toolSearch: false, compaction: false, effort: false },
|
|
270
|
-
|
|
270
|
+
// Known IDs without declared capabilities retain the custom-model fallback.
|
|
271
|
+
'claude-3-haiku-20240307': undefined,
|
|
272
|
+
'claude-haiku-4-5-20251001': undefined,
|
|
273
|
+
'claude-opus-4-1-20250805': undefined,
|
|
274
|
+
'claude-opus-4-20250514': undefined,
|
|
275
|
+
'claude-opus-4-5-20251101': undefined,
|
|
276
|
+
'claude-sonnet-4-20250514': undefined,
|
|
277
|
+
'claude-sonnet-4-5-20250929': undefined,
|
|
278
|
+
} satisfies Readonly<Record<string, DocumentedCapabilities | undefined>>;
|
|
271
279
|
|
|
272
280
|
export const anthropicModelCatalog: Readonly<
|
|
273
281
|
Record<string, AnthropicLanguageModelEntry>
|
|
274
282
|
> = Object.fromEntries(
|
|
275
|
-
Object.entries(
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
283
|
+
Object.entries(languageModelDefinitions)
|
|
284
|
+
.filter(([, definition]) => definition != null)
|
|
285
|
+
.map(([modelId, capabilities]) => [
|
|
286
|
+
modelId,
|
|
287
|
+
createAnthropicLanguageModelEntry(modelId, capabilities),
|
|
288
|
+
]),
|
|
279
289
|
);
|
|
280
290
|
|
|
281
291
|
export function getAnthropicLanguageModelEntry(
|
|
@@ -413,3 +423,8 @@ export function getAnthropicModelCapabilities(modelId: string) {
|
|
|
413
423
|
|
|
414
424
|
// Compatibility name also exported by the Anthropic runtime adapter.
|
|
415
425
|
export { getAnthropicModelCapabilities as getModelCapabilities };
|
|
426
|
+
|
|
427
|
+
/** Known model IDs, derived from the declarations used to build the catalog. */
|
|
428
|
+
export type AnthropicModelIds = {
|
|
429
|
+
language: keyof typeof languageModelDefinitions;
|
|
430
|
+
};
|