@tanstack/ai-anthropic 0.0.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/LICENSE +21 -0
- package/dist/esm/anthropic-adapter.d.ts +69 -0
- package/dist/esm/anthropic-adapter.js +473 -0
- package/dist/esm/anthropic-adapter.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/message-types.d.ts +69 -0
- package/dist/esm/model-meta.d.ts +215 -0
- package/dist/esm/model-meta.js +42 -0
- package/dist/esm/model-meta.js.map +1 -0
- package/dist/esm/text/text-provider-options.d.ts +139 -0
- package/dist/esm/text/text-provider-options.js +30 -0
- package/dist/esm/text/text-provider-options.js.map +1 -0
- package/dist/esm/tools/bash-tool.d.ts +5 -0
- package/dist/esm/tools/bash-tool.js +8 -0
- package/dist/esm/tools/bash-tool.js.map +1 -0
- package/dist/esm/tools/code-execution-tool.d.ts +5 -0
- package/dist/esm/tools/code-execution-tool.js +8 -0
- package/dist/esm/tools/code-execution-tool.js.map +1 -0
- package/dist/esm/tools/computer-use-tool.d.ts +5 -0
- package/dist/esm/tools/computer-use-tool.js +8 -0
- package/dist/esm/tools/computer-use-tool.js.map +1 -0
- package/dist/esm/tools/custom-tool.d.ts +25 -0
- package/dist/esm/tools/custom-tool.js +21 -0
- package/dist/esm/tools/custom-tool.js.map +1 -0
- package/dist/esm/tools/index.d.ts +10 -0
- package/dist/esm/tools/memory-tool.d.ts +5 -0
- package/dist/esm/tools/memory-tool.js +11 -0
- package/dist/esm/tools/memory-tool.js.map +1 -0
- package/dist/esm/tools/text-editor-tool.d.ts +5 -0
- package/dist/esm/tools/text-editor-tool.js +10 -0
- package/dist/esm/tools/text-editor-tool.js.map +1 -0
- package/dist/esm/tools/tool-converter.d.ts +27 -0
- package/dist/esm/tools/tool-converter.js +35 -0
- package/dist/esm/tools/tool-converter.js.map +1 -0
- package/dist/esm/tools/web-fetch-tool.d.ts +5 -0
- package/dist/esm/tools/web-fetch-tool.js +12 -0
- package/dist/esm/tools/web-fetch-tool.js.map +1 -0
- package/dist/esm/tools/web-search-tool.d.ts +5 -0
- package/dist/esm/tools/web-search-tool.js +16 -0
- package/dist/esm/tools/web-search-tool.js.map +1 -0
- package/package.json +53 -0
- package/src/anthropic-adapter.ts +680 -0
- package/src/index.ts +25 -0
- package/src/message-types.ts +85 -0
- package/src/model-meta.ts +482 -0
- package/src/text/text-provider-options.ts +205 -0
- package/src/tools/bash-tool.ts +19 -0
- package/src/tools/code-execution-tool.ts +24 -0
- package/src/tools/computer-use-tool.ts +24 -0
- package/src/tools/custom-tool.ts +64 -0
- package/src/tools/index.ts +30 -0
- package/src/tools/memory-tool.ts +20 -0
- package/src/tools/text-editor-tool.ts +28 -0
- package/src/tools/tool-converter.ts +61 -0
- package/src/tools/web-fetch-tool.ts +23 -0
- package/src/tools/web-search-tool.ts +81 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anthropic-specific metadata types for multimodal content parts.
|
|
3
|
+
* These types extend the base ContentPart metadata with Anthropic-specific options.
|
|
4
|
+
*
|
|
5
|
+
* @see https://docs.anthropic.com/claude/docs/vision
|
|
6
|
+
* @see https://docs.anthropic.com/claude/docs/pdf-support
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Supported image media types for Anthropic.
|
|
11
|
+
*/
|
|
12
|
+
export type AnthropicImageMediaType =
|
|
13
|
+
| 'image/jpeg'
|
|
14
|
+
| 'image/png'
|
|
15
|
+
| 'image/gif'
|
|
16
|
+
| 'image/webp'
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Metadata for Anthropic image content parts.
|
|
20
|
+
*/
|
|
21
|
+
export interface AnthropicImageMetadata {
|
|
22
|
+
/**
|
|
23
|
+
* The MIME type of the image.
|
|
24
|
+
* Required when using base64 source type.
|
|
25
|
+
*
|
|
26
|
+
* @see https://docs.anthropic.com/claude/docs/vision#supported-image-types
|
|
27
|
+
*/
|
|
28
|
+
mediaType?: AnthropicImageMediaType
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Supported document media types for Anthropic.
|
|
33
|
+
*/
|
|
34
|
+
export type AnthropicDocumentMediaType = 'application/pdf'
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Metadata for Anthropic document content parts (e.g., PDFs).
|
|
38
|
+
*/
|
|
39
|
+
export interface AnthropicDocumentMetadata {
|
|
40
|
+
/**
|
|
41
|
+
* The MIME type of the document.
|
|
42
|
+
* Required for document content, typically 'application/pdf'.
|
|
43
|
+
*
|
|
44
|
+
* @see https://docs.anthropic.com/claude/docs/pdf-support
|
|
45
|
+
*/
|
|
46
|
+
mediaType?: AnthropicDocumentMediaType
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Metadata for Anthropic audio content parts.
|
|
51
|
+
* Note: Audio support in Anthropic may be limited; check current API capabilities.
|
|
52
|
+
*/
|
|
53
|
+
export interface AnthropicAudioMetadata {
|
|
54
|
+
/**
|
|
55
|
+
* The MIME type of the audio.
|
|
56
|
+
*/
|
|
57
|
+
mediaType?:
|
|
58
|
+
| 'audio/mpeg'
|
|
59
|
+
| 'audio/wav'
|
|
60
|
+
| 'audio/ogg'
|
|
61
|
+
| 'audio/webm'
|
|
62
|
+
| 'audio/flac'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Metadata for Anthropic video content parts.
|
|
67
|
+
* Note: Video support in Anthropic may be limited; check current API capabilities.
|
|
68
|
+
*/
|
|
69
|
+
export interface AnthropicVideoMetadata {
|
|
70
|
+
/**
|
|
71
|
+
* The MIME type of the video.
|
|
72
|
+
*/
|
|
73
|
+
mediaType?: 'video/mp4' | 'video/webm' | 'video/mpeg'
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Map of modality types to their Anthropic-specific metadata types.
|
|
78
|
+
* Used for type inference when constructing multimodal messages.
|
|
79
|
+
*/
|
|
80
|
+
export interface AnthropicMessageMetadataByModality {
|
|
81
|
+
image: AnthropicImageMetadata
|
|
82
|
+
audio: AnthropicAudioMetadata
|
|
83
|
+
video: AnthropicVideoMetadata
|
|
84
|
+
document: AnthropicDocumentMetadata
|
|
85
|
+
}
|
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AnthropicContainerOptions,
|
|
3
|
+
AnthropicContextManagementOptions,
|
|
4
|
+
AnthropicMCPOptions,
|
|
5
|
+
AnthropicSamplingOptions,
|
|
6
|
+
AnthropicServiceTierOptions,
|
|
7
|
+
AnthropicStopSequencesOptions,
|
|
8
|
+
AnthropicThinkingOptions,
|
|
9
|
+
AnthropicToolChoiceOptions,
|
|
10
|
+
} from './text/text-provider-options'
|
|
11
|
+
|
|
12
|
+
interface ModelMeta<
|
|
13
|
+
TProviderOptions = unknown,
|
|
14
|
+
TToolCapabilities = unknown,
|
|
15
|
+
TMessageCapabilities = unknown,
|
|
16
|
+
> {
|
|
17
|
+
name: string
|
|
18
|
+
id: string
|
|
19
|
+
supports: {
|
|
20
|
+
input: Array<'text' | 'image' | 'audio' | 'video' | 'document'>
|
|
21
|
+
extended_thinking?: boolean
|
|
22
|
+
priority_tier?: boolean
|
|
23
|
+
}
|
|
24
|
+
context_window?: number
|
|
25
|
+
max_output_tokens?: number
|
|
26
|
+
knowledge_cutoff?: string
|
|
27
|
+
pricing: {
|
|
28
|
+
input: {
|
|
29
|
+
normal: number
|
|
30
|
+
cached?: number
|
|
31
|
+
}
|
|
32
|
+
output: {
|
|
33
|
+
normal: number
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Type-level description of which provider options this model supports.
|
|
38
|
+
*/
|
|
39
|
+
providerOptions?: TProviderOptions
|
|
40
|
+
/**
|
|
41
|
+
* Type-level description of which tool capabilities this model supports.
|
|
42
|
+
*/
|
|
43
|
+
toolCapabilities?: TToolCapabilities
|
|
44
|
+
/**
|
|
45
|
+
* Type-level description of which message/input capabilities this model supports.
|
|
46
|
+
*/
|
|
47
|
+
messageCapabilities?: TMessageCapabilities
|
|
48
|
+
}
|
|
49
|
+
const CLAUDE_SONNET_4_5 = {
|
|
50
|
+
name: 'claude-sonnet-4-5',
|
|
51
|
+
id: 'claude-sonnet-4-5',
|
|
52
|
+
context_window: 200_000,
|
|
53
|
+
max_output_tokens: 64_000,
|
|
54
|
+
knowledge_cutoff: '2025-09-29',
|
|
55
|
+
pricing: {
|
|
56
|
+
input: {
|
|
57
|
+
normal: 3,
|
|
58
|
+
},
|
|
59
|
+
output: {
|
|
60
|
+
normal: 15,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
supports: {
|
|
64
|
+
input: ['text', 'image', 'document'],
|
|
65
|
+
extended_thinking: true,
|
|
66
|
+
priority_tier: true,
|
|
67
|
+
},
|
|
68
|
+
} as const satisfies ModelMeta<
|
|
69
|
+
AnthropicContainerOptions &
|
|
70
|
+
AnthropicContextManagementOptions &
|
|
71
|
+
AnthropicMCPOptions &
|
|
72
|
+
AnthropicServiceTierOptions &
|
|
73
|
+
AnthropicStopSequencesOptions &
|
|
74
|
+
AnthropicThinkingOptions &
|
|
75
|
+
AnthropicToolChoiceOptions &
|
|
76
|
+
AnthropicSamplingOptions
|
|
77
|
+
>
|
|
78
|
+
|
|
79
|
+
const CLAUDE_HAIKU_4_5 = {
|
|
80
|
+
name: 'claude-haiku-4-5',
|
|
81
|
+
id: 'claude-haiku-4-5',
|
|
82
|
+
context_window: 200_000,
|
|
83
|
+
max_output_tokens: 64_000,
|
|
84
|
+
knowledge_cutoff: '2025-10-01',
|
|
85
|
+
pricing: {
|
|
86
|
+
input: {
|
|
87
|
+
normal: 1,
|
|
88
|
+
},
|
|
89
|
+
output: {
|
|
90
|
+
normal: 5,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
supports: {
|
|
94
|
+
input: ['text', 'image', 'document'],
|
|
95
|
+
extended_thinking: true,
|
|
96
|
+
priority_tier: true,
|
|
97
|
+
},
|
|
98
|
+
} as const satisfies ModelMeta<
|
|
99
|
+
AnthropicContainerOptions &
|
|
100
|
+
AnthropicContextManagementOptions &
|
|
101
|
+
AnthropicMCPOptions &
|
|
102
|
+
AnthropicServiceTierOptions &
|
|
103
|
+
AnthropicStopSequencesOptions &
|
|
104
|
+
AnthropicThinkingOptions &
|
|
105
|
+
AnthropicToolChoiceOptions &
|
|
106
|
+
AnthropicSamplingOptions
|
|
107
|
+
>
|
|
108
|
+
|
|
109
|
+
const CLAUDE_OPUS_4_1 = {
|
|
110
|
+
name: 'claude-opus-4-1',
|
|
111
|
+
id: 'claude-opus-4-1',
|
|
112
|
+
context_window: 200_000,
|
|
113
|
+
max_output_tokens: 64_000,
|
|
114
|
+
knowledge_cutoff: '2025-08-05',
|
|
115
|
+
pricing: {
|
|
116
|
+
input: {
|
|
117
|
+
normal: 15,
|
|
118
|
+
},
|
|
119
|
+
output: {
|
|
120
|
+
normal: 75,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
supports: {
|
|
124
|
+
input: ['text', 'image', 'document'],
|
|
125
|
+
extended_thinking: true,
|
|
126
|
+
priority_tier: true,
|
|
127
|
+
},
|
|
128
|
+
} as const satisfies ModelMeta<
|
|
129
|
+
AnthropicContainerOptions &
|
|
130
|
+
AnthropicContextManagementOptions &
|
|
131
|
+
AnthropicMCPOptions &
|
|
132
|
+
AnthropicServiceTierOptions &
|
|
133
|
+
AnthropicStopSequencesOptions &
|
|
134
|
+
AnthropicThinkingOptions &
|
|
135
|
+
AnthropicToolChoiceOptions &
|
|
136
|
+
AnthropicSamplingOptions
|
|
137
|
+
>
|
|
138
|
+
|
|
139
|
+
const CLAUDE_OPUS_4_5 = {
|
|
140
|
+
name: 'claude-opus-4-5',
|
|
141
|
+
id: 'claude-opus-4-5',
|
|
142
|
+
context_window: 200_000,
|
|
143
|
+
max_output_tokens: 32_000,
|
|
144
|
+
knowledge_cutoff: '2025-11-01',
|
|
145
|
+
pricing: {
|
|
146
|
+
input: {
|
|
147
|
+
normal: 15,
|
|
148
|
+
},
|
|
149
|
+
output: {
|
|
150
|
+
normal: 75,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
supports: {
|
|
154
|
+
input: ['text', 'image', 'document'],
|
|
155
|
+
extended_thinking: true,
|
|
156
|
+
priority_tier: true,
|
|
157
|
+
},
|
|
158
|
+
} as const satisfies ModelMeta<
|
|
159
|
+
AnthropicContainerOptions &
|
|
160
|
+
AnthropicContextManagementOptions &
|
|
161
|
+
AnthropicMCPOptions &
|
|
162
|
+
AnthropicServiceTierOptions &
|
|
163
|
+
AnthropicStopSequencesOptions &
|
|
164
|
+
AnthropicThinkingOptions &
|
|
165
|
+
AnthropicToolChoiceOptions &
|
|
166
|
+
AnthropicSamplingOptions
|
|
167
|
+
>
|
|
168
|
+
|
|
169
|
+
const CLAUDE_SONNET_4 = {
|
|
170
|
+
name: 'claude-sonnet-4',
|
|
171
|
+
id: 'claude-sonnet-4',
|
|
172
|
+
context_window: 200_000,
|
|
173
|
+
max_output_tokens: 64_000,
|
|
174
|
+
knowledge_cutoff: '2025-05-14',
|
|
175
|
+
pricing: {
|
|
176
|
+
input: {
|
|
177
|
+
normal: 3,
|
|
178
|
+
},
|
|
179
|
+
output: {
|
|
180
|
+
normal: 15,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
supports: {
|
|
184
|
+
input: ['text', 'image', 'document'],
|
|
185
|
+
extended_thinking: true,
|
|
186
|
+
priority_tier: true,
|
|
187
|
+
},
|
|
188
|
+
} as const satisfies ModelMeta<
|
|
189
|
+
AnthropicContainerOptions &
|
|
190
|
+
AnthropicContextManagementOptions &
|
|
191
|
+
AnthropicMCPOptions &
|
|
192
|
+
AnthropicServiceTierOptions &
|
|
193
|
+
AnthropicStopSequencesOptions &
|
|
194
|
+
AnthropicThinkingOptions &
|
|
195
|
+
AnthropicToolChoiceOptions &
|
|
196
|
+
AnthropicSamplingOptions
|
|
197
|
+
>
|
|
198
|
+
|
|
199
|
+
const CLAUDE_SONNET_3_7 = {
|
|
200
|
+
name: 'claude-sonnet-3-7',
|
|
201
|
+
id: 'claude-3-7-sonnet',
|
|
202
|
+
max_output_tokens: 64_000,
|
|
203
|
+
knowledge_cutoff: '2025-05-14',
|
|
204
|
+
pricing: {
|
|
205
|
+
input: {
|
|
206
|
+
normal: 3,
|
|
207
|
+
},
|
|
208
|
+
output: {
|
|
209
|
+
normal: 15,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
supports: {
|
|
213
|
+
input: ['text', 'image', 'document'],
|
|
214
|
+
extended_thinking: true,
|
|
215
|
+
priority_tier: true,
|
|
216
|
+
},
|
|
217
|
+
} as const satisfies ModelMeta<
|
|
218
|
+
AnthropicContainerOptions &
|
|
219
|
+
AnthropicContextManagementOptions &
|
|
220
|
+
AnthropicMCPOptions &
|
|
221
|
+
AnthropicServiceTierOptions &
|
|
222
|
+
AnthropicStopSequencesOptions &
|
|
223
|
+
AnthropicThinkingOptions &
|
|
224
|
+
AnthropicToolChoiceOptions &
|
|
225
|
+
AnthropicSamplingOptions
|
|
226
|
+
>
|
|
227
|
+
|
|
228
|
+
const CLAUDE_OPUS_4 = {
|
|
229
|
+
name: 'claude-opus-4',
|
|
230
|
+
id: 'claude-opus-4',
|
|
231
|
+
context_window: 200_000,
|
|
232
|
+
max_output_tokens: 32_000,
|
|
233
|
+
knowledge_cutoff: '2025-05-14',
|
|
234
|
+
pricing: {
|
|
235
|
+
input: {
|
|
236
|
+
normal: 15,
|
|
237
|
+
},
|
|
238
|
+
output: {
|
|
239
|
+
normal: 75,
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
supports: {
|
|
243
|
+
input: ['text', 'image', 'document'],
|
|
244
|
+
extended_thinking: true,
|
|
245
|
+
priority_tier: true,
|
|
246
|
+
},
|
|
247
|
+
} as const satisfies ModelMeta<
|
|
248
|
+
AnthropicContainerOptions &
|
|
249
|
+
AnthropicContextManagementOptions &
|
|
250
|
+
AnthropicMCPOptions &
|
|
251
|
+
AnthropicServiceTierOptions &
|
|
252
|
+
AnthropicStopSequencesOptions &
|
|
253
|
+
AnthropicThinkingOptions &
|
|
254
|
+
AnthropicToolChoiceOptions &
|
|
255
|
+
AnthropicSamplingOptions
|
|
256
|
+
>
|
|
257
|
+
|
|
258
|
+
const CLAUDE_HAIKU_3_5 = {
|
|
259
|
+
name: 'claude-haiku-3-5',
|
|
260
|
+
id: 'claude-3-5-haiku',
|
|
261
|
+
context_window: 200_000,
|
|
262
|
+
max_output_tokens: 8_000,
|
|
263
|
+
knowledge_cutoff: '2025-10-22',
|
|
264
|
+
pricing: {
|
|
265
|
+
input: {
|
|
266
|
+
normal: 0.8,
|
|
267
|
+
},
|
|
268
|
+
output: {
|
|
269
|
+
normal: 4,
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
supports: {
|
|
273
|
+
input: ['text', 'image', 'document'],
|
|
274
|
+
extended_thinking: false,
|
|
275
|
+
priority_tier: true,
|
|
276
|
+
},
|
|
277
|
+
} as const satisfies ModelMeta<
|
|
278
|
+
AnthropicContainerOptions &
|
|
279
|
+
AnthropicContextManagementOptions &
|
|
280
|
+
AnthropicMCPOptions &
|
|
281
|
+
AnthropicServiceTierOptions &
|
|
282
|
+
AnthropicStopSequencesOptions &
|
|
283
|
+
AnthropicThinkingOptions &
|
|
284
|
+
AnthropicToolChoiceOptions &
|
|
285
|
+
AnthropicSamplingOptions
|
|
286
|
+
>
|
|
287
|
+
|
|
288
|
+
const CLAUDE_HAIKU_3 = {
|
|
289
|
+
name: 'claude-haiku-3',
|
|
290
|
+
id: 'claude-3-haiku',
|
|
291
|
+
context_window: 200_000,
|
|
292
|
+
max_output_tokens: 4_000,
|
|
293
|
+
knowledge_cutoff: '2024-03-07',
|
|
294
|
+
pricing: {
|
|
295
|
+
input: {
|
|
296
|
+
normal: 0.25,
|
|
297
|
+
},
|
|
298
|
+
output: {
|
|
299
|
+
normal: 1.25,
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
supports: {
|
|
303
|
+
input: ['text', 'image', 'document'],
|
|
304
|
+
extended_thinking: false,
|
|
305
|
+
priority_tier: false,
|
|
306
|
+
},
|
|
307
|
+
} as const satisfies ModelMeta<
|
|
308
|
+
AnthropicContainerOptions &
|
|
309
|
+
AnthropicContextManagementOptions &
|
|
310
|
+
AnthropicMCPOptions &
|
|
311
|
+
AnthropicServiceTierOptions &
|
|
312
|
+
AnthropicStopSequencesOptions &
|
|
313
|
+
AnthropicThinkingOptions &
|
|
314
|
+
AnthropicToolChoiceOptions &
|
|
315
|
+
AnthropicSamplingOptions
|
|
316
|
+
>
|
|
317
|
+
|
|
318
|
+
/* const ANTHROPIC_MODEL_META = {
|
|
319
|
+
[CLAUDE_OPUS_4_5.name]: CLAUDE_OPUS_4_5,
|
|
320
|
+
[CLAUDE_SONNET_4_5.name]: CLAUDE_SONNET_4_5,
|
|
321
|
+
[CLAUDE_HAIKU_4_5.name]: CLAUDE_HAIKU_4_5,
|
|
322
|
+
[CLAUDE_OPUS_4_1.name]: CLAUDE_OPUS_4_1,
|
|
323
|
+
[CLAUDE_SONNET_4.name]: CLAUDE_SONNET_4,
|
|
324
|
+
[CLAUDE_SONNET_3_7.name]: CLAUDE_SONNET_3_7,
|
|
325
|
+
[CLAUDE_OPUS_4.name]: CLAUDE_OPUS_4,
|
|
326
|
+
[CLAUDE_HAIKU_3_5.name]: CLAUDE_HAIKU_3_5,
|
|
327
|
+
[CLAUDE_HAIKU_3.name]: CLAUDE_HAIKU_3,
|
|
328
|
+
} as const */
|
|
329
|
+
|
|
330
|
+
/* export type AnthropicModelProviderOptions<
|
|
331
|
+
TModel extends keyof AnthropicModelMetaMap,
|
|
332
|
+
> =
|
|
333
|
+
AnthropicModelMetaMap[TModel] extends ModelMeta<
|
|
334
|
+
infer TProviderOptions,
|
|
335
|
+
any,
|
|
336
|
+
any
|
|
337
|
+
>
|
|
338
|
+
? TProviderOptions
|
|
339
|
+
: unknown */
|
|
340
|
+
|
|
341
|
+
/* export type AnthropicModelToolCapabilities<
|
|
342
|
+
TModel extends keyof AnthropicModelMetaMap,
|
|
343
|
+
> =
|
|
344
|
+
AnthropicModelMetaMap[TModel] extends ModelMeta<
|
|
345
|
+
any,
|
|
346
|
+
infer TToolCapabilities,
|
|
347
|
+
any
|
|
348
|
+
>
|
|
349
|
+
? TToolCapabilities
|
|
350
|
+
: unknown
|
|
351
|
+
*/
|
|
352
|
+
/* export type AnthropicModelMessageCapabilities<
|
|
353
|
+
TModel extends keyof AnthropicModelMetaMap,
|
|
354
|
+
> =
|
|
355
|
+
AnthropicModelMetaMap[TModel] extends ModelMeta<
|
|
356
|
+
any,
|
|
357
|
+
any,
|
|
358
|
+
infer TMessageCapabilities
|
|
359
|
+
>
|
|
360
|
+
? TMessageCapabilities
|
|
361
|
+
: unknown */
|
|
362
|
+
|
|
363
|
+
export const ANTHROPIC_MODELS = [
|
|
364
|
+
CLAUDE_OPUS_4_5.id,
|
|
365
|
+
CLAUDE_SONNET_4_5.id,
|
|
366
|
+
CLAUDE_HAIKU_4_5.id,
|
|
367
|
+
CLAUDE_OPUS_4_1.id,
|
|
368
|
+
CLAUDE_SONNET_4.id,
|
|
369
|
+
CLAUDE_SONNET_3_7.id,
|
|
370
|
+
CLAUDE_OPUS_4.id,
|
|
371
|
+
CLAUDE_HAIKU_3_5.id,
|
|
372
|
+
CLAUDE_HAIKU_3.id,
|
|
373
|
+
] as const
|
|
374
|
+
|
|
375
|
+
// const ANTHROPIC_IMAGE_MODELS = [] as const
|
|
376
|
+
// const ANTHROPIC_EMBEDDING_MODELS = [] as const
|
|
377
|
+
// const ANTHROPIC_AUDIO_MODELS = [] as const
|
|
378
|
+
// const ANTHROPIC_VIDEO_MODELS = [] as const
|
|
379
|
+
|
|
380
|
+
/* type AnthropicModel = (typeof ANTHROPIC_MODELS)[number] */
|
|
381
|
+
|
|
382
|
+
// Manual type map for per-model provider options
|
|
383
|
+
// Models are differentiated by extended_thinking and priority_tier support
|
|
384
|
+
export type AnthropicChatModelProviderOptionsByName = {
|
|
385
|
+
// Models with both extended_thinking and priority_tier
|
|
386
|
+
[CLAUDE_OPUS_4_5.id]: AnthropicContainerOptions &
|
|
387
|
+
AnthropicContextManagementOptions &
|
|
388
|
+
AnthropicMCPOptions &
|
|
389
|
+
AnthropicServiceTierOptions &
|
|
390
|
+
AnthropicStopSequencesOptions &
|
|
391
|
+
AnthropicThinkingOptions &
|
|
392
|
+
AnthropicToolChoiceOptions &
|
|
393
|
+
AnthropicSamplingOptions
|
|
394
|
+
[CLAUDE_SONNET_4_5.id]: AnthropicContainerOptions &
|
|
395
|
+
AnthropicContextManagementOptions &
|
|
396
|
+
AnthropicMCPOptions &
|
|
397
|
+
AnthropicServiceTierOptions &
|
|
398
|
+
AnthropicStopSequencesOptions &
|
|
399
|
+
AnthropicThinkingOptions &
|
|
400
|
+
AnthropicToolChoiceOptions &
|
|
401
|
+
AnthropicSamplingOptions
|
|
402
|
+
[CLAUDE_HAIKU_4_5.id]: AnthropicContainerOptions &
|
|
403
|
+
AnthropicContextManagementOptions &
|
|
404
|
+
AnthropicMCPOptions &
|
|
405
|
+
AnthropicServiceTierOptions &
|
|
406
|
+
AnthropicStopSequencesOptions &
|
|
407
|
+
AnthropicThinkingOptions &
|
|
408
|
+
AnthropicToolChoiceOptions &
|
|
409
|
+
AnthropicSamplingOptions
|
|
410
|
+
[CLAUDE_OPUS_4_1.id]: AnthropicContainerOptions &
|
|
411
|
+
AnthropicContextManagementOptions &
|
|
412
|
+
AnthropicMCPOptions &
|
|
413
|
+
AnthropicServiceTierOptions &
|
|
414
|
+
AnthropicStopSequencesOptions &
|
|
415
|
+
AnthropicThinkingOptions &
|
|
416
|
+
AnthropicToolChoiceOptions &
|
|
417
|
+
AnthropicSamplingOptions
|
|
418
|
+
[CLAUDE_SONNET_4.id]: AnthropicContainerOptions &
|
|
419
|
+
AnthropicContextManagementOptions &
|
|
420
|
+
AnthropicMCPOptions &
|
|
421
|
+
AnthropicServiceTierOptions &
|
|
422
|
+
AnthropicStopSequencesOptions &
|
|
423
|
+
AnthropicThinkingOptions &
|
|
424
|
+
AnthropicToolChoiceOptions &
|
|
425
|
+
AnthropicSamplingOptions
|
|
426
|
+
[CLAUDE_SONNET_3_7.id]: AnthropicContainerOptions &
|
|
427
|
+
AnthropicContextManagementOptions &
|
|
428
|
+
AnthropicMCPOptions &
|
|
429
|
+
AnthropicServiceTierOptions &
|
|
430
|
+
AnthropicStopSequencesOptions &
|
|
431
|
+
AnthropicThinkingOptions &
|
|
432
|
+
AnthropicToolChoiceOptions &
|
|
433
|
+
AnthropicSamplingOptions
|
|
434
|
+
[CLAUDE_OPUS_4.id]: AnthropicContainerOptions &
|
|
435
|
+
AnthropicContextManagementOptions &
|
|
436
|
+
AnthropicMCPOptions &
|
|
437
|
+
AnthropicServiceTierOptions &
|
|
438
|
+
AnthropicStopSequencesOptions &
|
|
439
|
+
AnthropicThinkingOptions &
|
|
440
|
+
AnthropicToolChoiceOptions &
|
|
441
|
+
AnthropicSamplingOptions
|
|
442
|
+
|
|
443
|
+
// Model with priority_tier but NO extended_thinking
|
|
444
|
+
[CLAUDE_HAIKU_3_5.id]: AnthropicContainerOptions &
|
|
445
|
+
AnthropicContextManagementOptions &
|
|
446
|
+
AnthropicMCPOptions &
|
|
447
|
+
AnthropicServiceTierOptions &
|
|
448
|
+
AnthropicStopSequencesOptions &
|
|
449
|
+
AnthropicToolChoiceOptions &
|
|
450
|
+
AnthropicSamplingOptions
|
|
451
|
+
|
|
452
|
+
// Model with neither extended_thinking nor priority_tier
|
|
453
|
+
[CLAUDE_HAIKU_3.id]: AnthropicContainerOptions &
|
|
454
|
+
AnthropicContextManagementOptions &
|
|
455
|
+
AnthropicMCPOptions &
|
|
456
|
+
AnthropicStopSequencesOptions &
|
|
457
|
+
AnthropicToolChoiceOptions &
|
|
458
|
+
AnthropicSamplingOptions
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Type-only map from chat model name to its supported input modalities.
|
|
463
|
+
* All Anthropic Claude models support text, image, and document (PDF) input.
|
|
464
|
+
* Used by the core AI types to constrain ContentPart types based on the selected model.
|
|
465
|
+
* Note: These must be inlined as readonly arrays (not typeof) because the model
|
|
466
|
+
* constants are not exported and typeof references don't work in .d.ts files
|
|
467
|
+
* when consumed by external packages.
|
|
468
|
+
*
|
|
469
|
+
* @see https://docs.anthropic.com/claude/docs/vision
|
|
470
|
+
* @see https://docs.anthropic.com/claude/docs/pdf-support
|
|
471
|
+
*/
|
|
472
|
+
export type AnthropicModelInputModalitiesByName = {
|
|
473
|
+
[CLAUDE_OPUS_4_5.id]: typeof CLAUDE_OPUS_4_5.supports.input
|
|
474
|
+
[CLAUDE_SONNET_4_5.id]: typeof CLAUDE_SONNET_4_5.supports.input
|
|
475
|
+
[CLAUDE_HAIKU_4_5.id]: typeof CLAUDE_HAIKU_4_5.supports.input
|
|
476
|
+
[CLAUDE_OPUS_4_1.id]: typeof CLAUDE_OPUS_4_1.supports.input
|
|
477
|
+
[CLAUDE_SONNET_4.id]: typeof CLAUDE_SONNET_4.supports.input
|
|
478
|
+
[CLAUDE_SONNET_3_7.id]: typeof CLAUDE_SONNET_3_7.supports.input
|
|
479
|
+
[CLAUDE_OPUS_4.id]: typeof CLAUDE_OPUS_4.supports.input
|
|
480
|
+
[CLAUDE_HAIKU_3_5.id]: typeof CLAUDE_HAIKU_3_5.supports.input
|
|
481
|
+
[CLAUDE_HAIKU_3.id]: typeof CLAUDE_HAIKU_3.supports.input
|
|
482
|
+
}
|