@ai-sdk/anthropic 4.0.91 → 4.0.93
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 +28 -0
- package/dist/index.js +341 -229
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +17 -35
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +341 -229
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +11 -7
- package/package.json +3 -3
- package/src/anthropic-language-model.ts +11 -285
- package/src/anthropic-model-catalog.ts +406 -0
package/dist/internal/index.js
CHANGED
|
@@ -63,6 +63,330 @@ var AnthropicFiles = class {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
//#endregion
|
|
66
|
+
//#region src/anthropic-model-catalog.ts
|
|
67
|
+
/**
|
|
68
|
+
* Options accepted under `providerOptions.anthropic`. The `satisfies` check
|
|
69
|
+
* keeps this list in sync with the option schema.
|
|
70
|
+
*/
|
|
71
|
+
const anthropicProviderOptions = { language: {
|
|
72
|
+
sendReasoning: { description: "Whether to send reasoning to the model." },
|
|
73
|
+
structuredOutputMode: { description: "How structured outputs are generated." },
|
|
74
|
+
thinking: { description: "Extended thinking configuration." },
|
|
75
|
+
disableParallelToolUse: { description: "Use at most one tool per response." },
|
|
76
|
+
cacheControl: { description: "Prompt cache control settings." },
|
|
77
|
+
metadata: { description: "Request metadata, such as a user ID." },
|
|
78
|
+
mcpServers: { description: "MCP servers to use in the request." },
|
|
79
|
+
container: { description: "Container and Agent Skills configuration." },
|
|
80
|
+
toolStreaming: { description: "Fine-grained streaming of tool inputs and outputs." },
|
|
81
|
+
effort: { description: "Effort spent on thinking, text, and tool calls." },
|
|
82
|
+
taskBudget: { description: "Advisory token budget for an agentic task." },
|
|
83
|
+
speed: { description: "Fast mode for faster output token speeds." },
|
|
84
|
+
serviceTier: { description: "Service tier for the request." },
|
|
85
|
+
inferenceGeo: { description: "Where model inference runs." },
|
|
86
|
+
fallbacks: { description: "Server-side fallback models." },
|
|
87
|
+
anthropicBeta: { description: "Additional beta features to enable." },
|
|
88
|
+
safeguards: { description: "Server-side safeguards to run." },
|
|
89
|
+
compaction: { description: "On-demand conversation summary." },
|
|
90
|
+
contextManagement: { description: "Server-side context management." }
|
|
91
|
+
} };
|
|
92
|
+
const legacyClaude = defineRuntime({});
|
|
93
|
+
const currentClaude = defineRuntime({
|
|
94
|
+
maxOutputTokens: 128e3,
|
|
95
|
+
nativeStructuredOutput: true,
|
|
96
|
+
adaptiveThinking: true
|
|
97
|
+
});
|
|
98
|
+
const currentClaudeWithoutSampling = defineRuntime({
|
|
99
|
+
...currentClaude,
|
|
100
|
+
samplingParameters: false,
|
|
101
|
+
xhighEffort: true
|
|
102
|
+
});
|
|
103
|
+
function defineRuntime(overrides) {
|
|
104
|
+
return {
|
|
105
|
+
maxOutputTokens: 4096,
|
|
106
|
+
nativeStructuredOutput: false,
|
|
107
|
+
adaptiveThinking: false,
|
|
108
|
+
samplingParameters: true,
|
|
109
|
+
xhighEffort: false,
|
|
110
|
+
thinkingCanBeDisabledAboveHighEffort: true,
|
|
111
|
+
thinkingCanBeDisabled: true,
|
|
112
|
+
budgetThinking: true,
|
|
113
|
+
forcedToolUse: true,
|
|
114
|
+
betweenToolsThinking: false,
|
|
115
|
+
knownModel: true,
|
|
116
|
+
...overrides
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const runtimeRules = [
|
|
120
|
+
{
|
|
121
|
+
matches: (modelId) => modelId.includes("claude-sonnet-5-5"),
|
|
122
|
+
definition: defineRuntime({
|
|
123
|
+
...currentClaudeWithoutSampling,
|
|
124
|
+
thinkingCanBeDisabledAboveHighEffort: false,
|
|
125
|
+
thinkingCanBeDisabled: false,
|
|
126
|
+
budgetThinking: false,
|
|
127
|
+
forcedToolUse: false,
|
|
128
|
+
betweenToolsThinking: true
|
|
129
|
+
})
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
matches: (modelId) => modelId.includes("claude-opus-5-5"),
|
|
133
|
+
definition: defineRuntime({
|
|
134
|
+
...currentClaudeWithoutSampling,
|
|
135
|
+
thinkingCanBeDisabledAboveHighEffort: false,
|
|
136
|
+
thinkingCanBeDisabled: false,
|
|
137
|
+
budgetThinking: false,
|
|
138
|
+
forcedToolUse: false
|
|
139
|
+
})
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
matches: (modelId) => modelId.includes("claude-haiku-5-5"),
|
|
143
|
+
definition: defineRuntime({
|
|
144
|
+
...currentClaudeWithoutSampling,
|
|
145
|
+
thinkingCanBeDisabledAboveHighEffort: false,
|
|
146
|
+
budgetThinking: false
|
|
147
|
+
})
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
matches: (modelId) => modelId.includes("claude-opus-5"),
|
|
151
|
+
definition: defineRuntime({
|
|
152
|
+
...currentClaudeWithoutSampling,
|
|
153
|
+
thinkingCanBeDisabledAboveHighEffort: false
|
|
154
|
+
})
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
matches: (modelId) => modelId.includes("claude-fable-5-1"),
|
|
158
|
+
definition: defineRuntime({
|
|
159
|
+
...currentClaudeWithoutSampling,
|
|
160
|
+
thinkingCanBeDisabled: false,
|
|
161
|
+
budgetThinking: false,
|
|
162
|
+
forcedToolUse: false
|
|
163
|
+
})
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
matches: (modelId) => modelId.includes("claude-fable-5"),
|
|
167
|
+
definition: defineRuntime({
|
|
168
|
+
...currentClaudeWithoutSampling,
|
|
169
|
+
thinkingCanBeDisabled: false,
|
|
170
|
+
budgetThinking: false
|
|
171
|
+
})
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
matches: (modelId) => modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5"),
|
|
175
|
+
definition: currentClaudeWithoutSampling
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
matches: (modelId) => modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6"),
|
|
179
|
+
definition: currentClaude
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
matches: (modelId) => modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5"),
|
|
183
|
+
definition: defineRuntime({
|
|
184
|
+
maxOutputTokens: 64e3,
|
|
185
|
+
nativeStructuredOutput: true
|
|
186
|
+
})
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
matches: (modelId) => modelId.includes("claude-opus-4-1"),
|
|
190
|
+
definition: defineRuntime({
|
|
191
|
+
maxOutputTokens: 32e3,
|
|
192
|
+
nativeStructuredOutput: true
|
|
193
|
+
})
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
matches: (modelId) => /claude-sonnet-4(?:-|@)/.test(modelId),
|
|
197
|
+
definition: defineRuntime({ maxOutputTokens: 64e3 })
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
matches: (modelId) => /claude-opus-4(?:-|@)/.test(modelId),
|
|
201
|
+
definition: defineRuntime({ maxOutputTokens: 32e3 })
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
matches: (modelId) => modelId.includes("claude-3-haiku"),
|
|
205
|
+
definition: legacyClaude
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
matches: (modelId) => /claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId),
|
|
209
|
+
definition: defineRuntime({ knownModel: false })
|
|
210
|
+
}
|
|
211
|
+
];
|
|
212
|
+
const anthropicModelCatalog = Object.fromEntries(Object.entries({
|
|
213
|
+
"claude-opus-5-5": {
|
|
214
|
+
toolSearch: true,
|
|
215
|
+
compaction: true,
|
|
216
|
+
effort: true
|
|
217
|
+
},
|
|
218
|
+
"claude-opus-5": {
|
|
219
|
+
toolSearch: true,
|
|
220
|
+
compaction: true,
|
|
221
|
+
effort: true
|
|
222
|
+
},
|
|
223
|
+
"claude-sonnet-5-5": {
|
|
224
|
+
toolSearch: true,
|
|
225
|
+
compaction: true,
|
|
226
|
+
effort: true
|
|
227
|
+
},
|
|
228
|
+
"claude-sonnet-5": {
|
|
229
|
+
toolSearch: true,
|
|
230
|
+
compaction: true,
|
|
231
|
+
effort: true
|
|
232
|
+
},
|
|
233
|
+
"claude-haiku-5-5": {
|
|
234
|
+
toolSearch: true,
|
|
235
|
+
compaction: true,
|
|
236
|
+
effort: true
|
|
237
|
+
},
|
|
238
|
+
"claude-fable-5-1": {
|
|
239
|
+
toolSearch: true,
|
|
240
|
+
compaction: true,
|
|
241
|
+
effort: true
|
|
242
|
+
},
|
|
243
|
+
"claude-fable-5": {
|
|
244
|
+
toolSearch: true,
|
|
245
|
+
compaction: true,
|
|
246
|
+
effort: true
|
|
247
|
+
},
|
|
248
|
+
"claude-opus-4-8": {
|
|
249
|
+
toolSearch: true,
|
|
250
|
+
compaction: true,
|
|
251
|
+
effort: true
|
|
252
|
+
},
|
|
253
|
+
"claude-opus-4-7": {
|
|
254
|
+
toolSearch: true,
|
|
255
|
+
compaction: true,
|
|
256
|
+
effort: true
|
|
257
|
+
},
|
|
258
|
+
"claude-opus-4-6": {
|
|
259
|
+
toolSearch: true,
|
|
260
|
+
compaction: true,
|
|
261
|
+
effort: true
|
|
262
|
+
},
|
|
263
|
+
"claude-sonnet-4-6": {
|
|
264
|
+
toolSearch: true,
|
|
265
|
+
compaction: true,
|
|
266
|
+
effort: true
|
|
267
|
+
},
|
|
268
|
+
"claude-opus-4-5": {
|
|
269
|
+
toolSearch: true,
|
|
270
|
+
compaction: false,
|
|
271
|
+
effort: true
|
|
272
|
+
},
|
|
273
|
+
"claude-haiku-4-5": {
|
|
274
|
+
toolSearch: true,
|
|
275
|
+
compaction: false,
|
|
276
|
+
effort: false
|
|
277
|
+
},
|
|
278
|
+
"claude-sonnet-4-5": {
|
|
279
|
+
toolSearch: true,
|
|
280
|
+
compaction: false,
|
|
281
|
+
effort: false
|
|
282
|
+
},
|
|
283
|
+
"claude-opus-4-1": {
|
|
284
|
+
toolSearch: false,
|
|
285
|
+
compaction: false,
|
|
286
|
+
effort: false
|
|
287
|
+
},
|
|
288
|
+
"claude-opus-4-0": {
|
|
289
|
+
toolSearch: false,
|
|
290
|
+
compaction: false,
|
|
291
|
+
effort: false
|
|
292
|
+
},
|
|
293
|
+
"claude-sonnet-4-0": {
|
|
294
|
+
toolSearch: false,
|
|
295
|
+
compaction: false,
|
|
296
|
+
effort: false
|
|
297
|
+
}
|
|
298
|
+
}).map(([modelId, capabilities]) => [modelId, createAnthropicLanguageModelEntry(modelId, capabilities)]));
|
|
299
|
+
function getAnthropicLanguageModelEntry(modelId) {
|
|
300
|
+
return Object.prototype.hasOwnProperty.call(anthropicModelCatalog, modelId) ? anthropicModelCatalog[modelId] : createAnthropicLanguageModelEntry(modelId);
|
|
301
|
+
}
|
|
302
|
+
function createAnthropicLanguageModelEntry(modelId, documented) {
|
|
303
|
+
const runtime = resolveRuntimeDefinition(modelId);
|
|
304
|
+
const declared = documented != null;
|
|
305
|
+
const samplingSupport = runtime.samplingParameters ? true : { condition: "Only supported when thinking is disabled." };
|
|
306
|
+
const reasoningSupport = runtime.adaptiveThinking || runtime.budgetThinking;
|
|
307
|
+
return {
|
|
308
|
+
capabilities: { language: {
|
|
309
|
+
inputs: {
|
|
310
|
+
image: declared ? true : "unknown",
|
|
311
|
+
audio: declared ? false : "unknown"
|
|
312
|
+
},
|
|
313
|
+
objectGeneration: declared ? true : "unknown",
|
|
314
|
+
tools: {
|
|
315
|
+
usage: declared ? true : "unknown",
|
|
316
|
+
streaming: declared ? true : "unknown",
|
|
317
|
+
forcedChoice: runtime.forcedToolUse,
|
|
318
|
+
computerUse: declared ? true : "unknown",
|
|
319
|
+
webSearch: declared ? true : "unknown",
|
|
320
|
+
toolSearch: documented?.toolSearch ?? "unknown"
|
|
321
|
+
},
|
|
322
|
+
reasoning: {
|
|
323
|
+
support: reasoningSupport,
|
|
324
|
+
efforts: runtime.xhighEffort ? [
|
|
325
|
+
"low",
|
|
326
|
+
"medium",
|
|
327
|
+
"high",
|
|
328
|
+
"xhigh",
|
|
329
|
+
"max"
|
|
330
|
+
] : void 0,
|
|
331
|
+
adaptive: runtime.adaptiveThinking,
|
|
332
|
+
budget: runtime.budgetThinking,
|
|
333
|
+
canDisable: runtime.thinkingCanBeDisabled,
|
|
334
|
+
canDisableAboveHighEffort: runtime.thinkingCanBeDisabledAboveHighEffort,
|
|
335
|
+
supportsXhighEffort: runtime.xhighEffort,
|
|
336
|
+
betweenTools: runtime.betweenToolsThinking
|
|
337
|
+
},
|
|
338
|
+
sampling: {
|
|
339
|
+
temperature: samplingSupport,
|
|
340
|
+
topP: samplingSupport,
|
|
341
|
+
topK: samplingSupport,
|
|
342
|
+
logprobs: false
|
|
343
|
+
},
|
|
344
|
+
structuredOutput: { native: runtime.nativeStructuredOutput },
|
|
345
|
+
compaction: documented?.compaction ?? "unknown"
|
|
346
|
+
} },
|
|
347
|
+
providerOptions: { language: declareProviderOptions(anthropicProviderOptions.language, declared ? true : "unknown", {
|
|
348
|
+
thinking: reasoningSupport,
|
|
349
|
+
effort: documented?.effort ?? "unknown",
|
|
350
|
+
speed: declared ? modelId === "claude-opus-4-6" : "unknown",
|
|
351
|
+
taskBudget: modelId === "claude-opus-4-7" ? true : "unknown"
|
|
352
|
+
}) },
|
|
353
|
+
requestConfig: { language: {
|
|
354
|
+
maxOutputTokens: runtime.maxOutputTokens,
|
|
355
|
+
knownModel: runtime.knownModel
|
|
356
|
+
} }
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
/** Applies one default support value to every option, except the listed ones. */
|
|
360
|
+
function declareProviderOptions(definitions, support, exceptions) {
|
|
361
|
+
return Object.fromEntries(Object.keys(definitions).map((option) => [option, exceptions[option] ?? support]));
|
|
362
|
+
}
|
|
363
|
+
function resolveRuntimeDefinition(modelId) {
|
|
364
|
+
const rule = runtimeRules.find((rule) => rule.matches(modelId));
|
|
365
|
+
if (rule != null) return rule.definition;
|
|
366
|
+
return modelId.includes("claude-") ? defineRuntime({
|
|
367
|
+
...currentClaudeWithoutSampling,
|
|
368
|
+
thinkingCanBeDisabledAboveHighEffort: false,
|
|
369
|
+
knownModel: false
|
|
370
|
+
}) : defineRuntime({ knownModel: false });
|
|
371
|
+
}
|
|
372
|
+
/** Compatibility projection for the provider's existing request preparation. */
|
|
373
|
+
function getAnthropicModelCapabilities(modelId) {
|
|
374
|
+
const { capabilities: { language }, requestConfig: { language: requestConfig } } = getAnthropicLanguageModelEntry(modelId);
|
|
375
|
+
return {
|
|
376
|
+
maxOutputTokens: requestConfig.maxOutputTokens,
|
|
377
|
+
supportsStructuredOutput: language.structuredOutput.native,
|
|
378
|
+
supportsAdaptiveThinking: language.reasoning.adaptive,
|
|
379
|
+
rejectsSamplingParameters: language.sampling.temperature !== true,
|
|
380
|
+
supportsXhighEffort: language.reasoning.supportsXhighEffort,
|
|
381
|
+
rejectsThinkingDisabledAboveHighEffort: !language.reasoning.canDisableAboveHighEffort,
|
|
382
|
+
rejectsThinkingDisabled: !language.reasoning.canDisable,
|
|
383
|
+
rejectsBudgetThinking: !language.reasoning.budget,
|
|
384
|
+
rejectsForcedToolUse: !language.tools.forcedChoice,
|
|
385
|
+
supportsBetweenToolsThinking: language.reasoning.betweenTools,
|
|
386
|
+
isKnownModel: requestConfig.knownModel
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
//#endregion
|
|
66
390
|
//#region src/map-anthropic-citation.ts
|
|
67
391
|
function mapAnthropicCitation(citation, documents) {
|
|
68
392
|
if (citation.type === "web_search_result_location" || citation.type === "search_result_location") {
|
|
@@ -3615,7 +3939,7 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
|
|
|
3615
3939
|
}) : null;
|
|
3616
3940
|
const usedCustomProviderKey = customProviderOptions != null;
|
|
3617
3941
|
const anthropicOptions = Object.assign({}, canonicalOptions ?? {}, customProviderOptions ?? {});
|
|
3618
|
-
const { maxOutputTokens: maxOutputTokensForModel, supportsStructuredOutput: modelSupportsStructuredOutput, supportsAdaptiveThinking, rejectsSamplingParameters, supportsXhighEffort, rejectsThinkingDisabledAboveHighEffort, rejectsThinkingDisabled, rejectsBudgetThinking, rejectsForcedToolUse, supportsBetweenToolsThinking, isKnownModel } =
|
|
3942
|
+
const { maxOutputTokens: maxOutputTokensForModel, supportsStructuredOutput: modelSupportsStructuredOutput, supportsAdaptiveThinking, rejectsSamplingParameters, supportsXhighEffort, rejectsThinkingDisabledAboveHighEffort, rejectsThinkingDisabled, rejectsBudgetThinking, rejectsForcedToolUse, supportsBetweenToolsThinking, isKnownModel } = getAnthropicModelCapabilities(modelId);
|
|
3619
3943
|
if (!isKnownModel && maxOutputTokens == null) warnings.push({
|
|
3620
3944
|
type: "compatibility",
|
|
3621
3945
|
feature: "maxOutputTokens",
|
|
@@ -5305,222 +5629,6 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
|
|
|
5305
5629
|
};
|
|
5306
5630
|
}
|
|
5307
5631
|
};
|
|
5308
|
-
/**
|
|
5309
|
-
* Returns the capabilities of a Claude model that are used for defaults and feature selection.
|
|
5310
|
-
*
|
|
5311
|
-
* @see https://docs.claude.com/en/docs/about-claude/models/overview#model-comparison-table
|
|
5312
|
-
* @see https://platform.claude.com/docs/en/build-with-claude/structured-outputs
|
|
5313
|
-
*/
|
|
5314
|
-
function getModelCapabilities(modelId) {
|
|
5315
|
-
if (modelId.includes("claude-sonnet-5-5")) return {
|
|
5316
|
-
maxOutputTokens: 128e3,
|
|
5317
|
-
supportsStructuredOutput: true,
|
|
5318
|
-
supportsAdaptiveThinking: true,
|
|
5319
|
-
rejectsSamplingParameters: true,
|
|
5320
|
-
supportsXhighEffort: true,
|
|
5321
|
-
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5322
|
-
rejectsThinkingDisabled: true,
|
|
5323
|
-
rejectsBudgetThinking: true,
|
|
5324
|
-
rejectsForcedToolUse: true,
|
|
5325
|
-
supportsBetweenToolsThinking: true,
|
|
5326
|
-
isKnownModel: true
|
|
5327
|
-
};
|
|
5328
|
-
else if (modelId.includes("claude-opus-5-5")) return {
|
|
5329
|
-
maxOutputTokens: 128e3,
|
|
5330
|
-
supportsStructuredOutput: true,
|
|
5331
|
-
supportsAdaptiveThinking: true,
|
|
5332
|
-
rejectsSamplingParameters: true,
|
|
5333
|
-
supportsXhighEffort: true,
|
|
5334
|
-
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5335
|
-
rejectsThinkingDisabled: true,
|
|
5336
|
-
rejectsBudgetThinking: true,
|
|
5337
|
-
rejectsForcedToolUse: true,
|
|
5338
|
-
supportsBetweenToolsThinking: false,
|
|
5339
|
-
isKnownModel: true
|
|
5340
|
-
};
|
|
5341
|
-
else if (modelId.includes("claude-haiku-5-5")) return {
|
|
5342
|
-
maxOutputTokens: 128e3,
|
|
5343
|
-
supportsStructuredOutput: true,
|
|
5344
|
-
supportsAdaptiveThinking: true,
|
|
5345
|
-
rejectsSamplingParameters: true,
|
|
5346
|
-
supportsXhighEffort: true,
|
|
5347
|
-
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5348
|
-
rejectsThinkingDisabled: false,
|
|
5349
|
-
rejectsBudgetThinking: true,
|
|
5350
|
-
rejectsForcedToolUse: false,
|
|
5351
|
-
supportsBetweenToolsThinking: false,
|
|
5352
|
-
isKnownModel: true
|
|
5353
|
-
};
|
|
5354
|
-
else if (modelId.includes("claude-opus-5")) return {
|
|
5355
|
-
maxOutputTokens: 128e3,
|
|
5356
|
-
supportsStructuredOutput: true,
|
|
5357
|
-
supportsAdaptiveThinking: true,
|
|
5358
|
-
rejectsSamplingParameters: true,
|
|
5359
|
-
supportsXhighEffort: true,
|
|
5360
|
-
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5361
|
-
rejectsThinkingDisabled: false,
|
|
5362
|
-
rejectsBudgetThinking: false,
|
|
5363
|
-
rejectsForcedToolUse: false,
|
|
5364
|
-
supportsBetweenToolsThinking: false,
|
|
5365
|
-
isKnownModel: true
|
|
5366
|
-
};
|
|
5367
|
-
else if (modelId.includes("claude-fable-5-1")) return {
|
|
5368
|
-
maxOutputTokens: 128e3,
|
|
5369
|
-
supportsStructuredOutput: true,
|
|
5370
|
-
supportsAdaptiveThinking: true,
|
|
5371
|
-
rejectsSamplingParameters: true,
|
|
5372
|
-
supportsXhighEffort: true,
|
|
5373
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5374
|
-
rejectsThinkingDisabled: true,
|
|
5375
|
-
rejectsBudgetThinking: true,
|
|
5376
|
-
rejectsForcedToolUse: true,
|
|
5377
|
-
supportsBetweenToolsThinking: false,
|
|
5378
|
-
isKnownModel: true
|
|
5379
|
-
};
|
|
5380
|
-
else if (modelId.includes("claude-fable-5")) return {
|
|
5381
|
-
maxOutputTokens: 128e3,
|
|
5382
|
-
supportsStructuredOutput: true,
|
|
5383
|
-
supportsAdaptiveThinking: true,
|
|
5384
|
-
rejectsSamplingParameters: true,
|
|
5385
|
-
supportsXhighEffort: true,
|
|
5386
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5387
|
-
rejectsThinkingDisabled: true,
|
|
5388
|
-
rejectsBudgetThinking: true,
|
|
5389
|
-
rejectsForcedToolUse: false,
|
|
5390
|
-
supportsBetweenToolsThinking: false,
|
|
5391
|
-
isKnownModel: true
|
|
5392
|
-
};
|
|
5393
|
-
else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5")) return {
|
|
5394
|
-
maxOutputTokens: 128e3,
|
|
5395
|
-
supportsStructuredOutput: true,
|
|
5396
|
-
supportsAdaptiveThinking: true,
|
|
5397
|
-
rejectsSamplingParameters: true,
|
|
5398
|
-
supportsXhighEffort: true,
|
|
5399
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5400
|
-
rejectsThinkingDisabled: false,
|
|
5401
|
-
rejectsBudgetThinking: false,
|
|
5402
|
-
rejectsForcedToolUse: false,
|
|
5403
|
-
supportsBetweenToolsThinking: false,
|
|
5404
|
-
isKnownModel: true
|
|
5405
|
-
};
|
|
5406
|
-
else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) return {
|
|
5407
|
-
maxOutputTokens: 128e3,
|
|
5408
|
-
supportsStructuredOutput: true,
|
|
5409
|
-
supportsAdaptiveThinking: true,
|
|
5410
|
-
rejectsSamplingParameters: false,
|
|
5411
|
-
supportsXhighEffort: false,
|
|
5412
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5413
|
-
rejectsThinkingDisabled: false,
|
|
5414
|
-
rejectsBudgetThinking: false,
|
|
5415
|
-
rejectsForcedToolUse: false,
|
|
5416
|
-
supportsBetweenToolsThinking: false,
|
|
5417
|
-
isKnownModel: true
|
|
5418
|
-
};
|
|
5419
|
-
else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) return {
|
|
5420
|
-
maxOutputTokens: 64e3,
|
|
5421
|
-
supportsStructuredOutput: true,
|
|
5422
|
-
supportsAdaptiveThinking: false,
|
|
5423
|
-
rejectsSamplingParameters: false,
|
|
5424
|
-
supportsXhighEffort: false,
|
|
5425
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5426
|
-
rejectsThinkingDisabled: false,
|
|
5427
|
-
rejectsBudgetThinking: false,
|
|
5428
|
-
rejectsForcedToolUse: false,
|
|
5429
|
-
supportsBetweenToolsThinking: false,
|
|
5430
|
-
isKnownModel: true
|
|
5431
|
-
};
|
|
5432
|
-
else if (modelId.includes("claude-opus-4-1")) return {
|
|
5433
|
-
maxOutputTokens: 32e3,
|
|
5434
|
-
supportsStructuredOutput: true,
|
|
5435
|
-
supportsAdaptiveThinking: false,
|
|
5436
|
-
rejectsSamplingParameters: false,
|
|
5437
|
-
supportsXhighEffort: false,
|
|
5438
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5439
|
-
rejectsThinkingDisabled: false,
|
|
5440
|
-
rejectsBudgetThinking: false,
|
|
5441
|
-
rejectsForcedToolUse: false,
|
|
5442
|
-
supportsBetweenToolsThinking: false,
|
|
5443
|
-
isKnownModel: true
|
|
5444
|
-
};
|
|
5445
|
-
else if (/claude-sonnet-4(?:-|@)/.test(modelId)) return {
|
|
5446
|
-
maxOutputTokens: 64e3,
|
|
5447
|
-
supportsStructuredOutput: false,
|
|
5448
|
-
supportsAdaptiveThinking: false,
|
|
5449
|
-
rejectsSamplingParameters: false,
|
|
5450
|
-
supportsXhighEffort: false,
|
|
5451
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5452
|
-
rejectsThinkingDisabled: false,
|
|
5453
|
-
rejectsBudgetThinking: false,
|
|
5454
|
-
rejectsForcedToolUse: false,
|
|
5455
|
-
supportsBetweenToolsThinking: false,
|
|
5456
|
-
isKnownModel: true
|
|
5457
|
-
};
|
|
5458
|
-
else if (/claude-opus-4(?:-|@)/.test(modelId)) return {
|
|
5459
|
-
maxOutputTokens: 32e3,
|
|
5460
|
-
supportsStructuredOutput: false,
|
|
5461
|
-
supportsAdaptiveThinking: false,
|
|
5462
|
-
rejectsSamplingParameters: false,
|
|
5463
|
-
supportsXhighEffort: false,
|
|
5464
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5465
|
-
rejectsThinkingDisabled: false,
|
|
5466
|
-
rejectsBudgetThinking: false,
|
|
5467
|
-
rejectsForcedToolUse: false,
|
|
5468
|
-
supportsBetweenToolsThinking: false,
|
|
5469
|
-
isKnownModel: true
|
|
5470
|
-
};
|
|
5471
|
-
else if (modelId.includes("claude-3-haiku")) return {
|
|
5472
|
-
maxOutputTokens: 4096,
|
|
5473
|
-
supportsStructuredOutput: false,
|
|
5474
|
-
supportsAdaptiveThinking: false,
|
|
5475
|
-
rejectsSamplingParameters: false,
|
|
5476
|
-
supportsXhighEffort: false,
|
|
5477
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5478
|
-
rejectsThinkingDisabled: false,
|
|
5479
|
-
rejectsBudgetThinking: false,
|
|
5480
|
-
rejectsForcedToolUse: false,
|
|
5481
|
-
supportsBetweenToolsThinking: false,
|
|
5482
|
-
isKnownModel: true
|
|
5483
|
-
};
|
|
5484
|
-
else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) return {
|
|
5485
|
-
maxOutputTokens: 4096,
|
|
5486
|
-
supportsStructuredOutput: false,
|
|
5487
|
-
supportsAdaptiveThinking: false,
|
|
5488
|
-
rejectsSamplingParameters: false,
|
|
5489
|
-
supportsXhighEffort: false,
|
|
5490
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5491
|
-
rejectsThinkingDisabled: false,
|
|
5492
|
-
rejectsBudgetThinking: false,
|
|
5493
|
-
rejectsForcedToolUse: false,
|
|
5494
|
-
supportsBetweenToolsThinking: false,
|
|
5495
|
-
isKnownModel: false
|
|
5496
|
-
};
|
|
5497
|
-
else if (modelId.includes("claude-")) return {
|
|
5498
|
-
maxOutputTokens: 128e3,
|
|
5499
|
-
supportsStructuredOutput: true,
|
|
5500
|
-
supportsAdaptiveThinking: true,
|
|
5501
|
-
rejectsSamplingParameters: true,
|
|
5502
|
-
supportsXhighEffort: true,
|
|
5503
|
-
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5504
|
-
rejectsThinkingDisabled: false,
|
|
5505
|
-
rejectsBudgetThinking: false,
|
|
5506
|
-
rejectsForcedToolUse: false,
|
|
5507
|
-
supportsBetweenToolsThinking: false,
|
|
5508
|
-
isKnownModel: false
|
|
5509
|
-
};
|
|
5510
|
-
else return {
|
|
5511
|
-
maxOutputTokens: 4096,
|
|
5512
|
-
supportsStructuredOutput: false,
|
|
5513
|
-
supportsAdaptiveThinking: false,
|
|
5514
|
-
rejectsSamplingParameters: false,
|
|
5515
|
-
supportsXhighEffort: false,
|
|
5516
|
-
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5517
|
-
rejectsThinkingDisabled: false,
|
|
5518
|
-
rejectsBudgetThinking: false,
|
|
5519
|
-
rejectsForcedToolUse: false,
|
|
5520
|
-
supportsBetweenToolsThinking: false,
|
|
5521
|
-
isKnownModel: false
|
|
5522
|
-
};
|
|
5523
|
-
}
|
|
5524
5632
|
function hasDynamicFilteringWebToolWithoutCodeExecution(tools) {
|
|
5525
5633
|
if (!tools) return false;
|
|
5526
5634
|
let hasDynamicFilteringWebTool = false;
|
|
@@ -5540,7 +5648,14 @@ function hasDynamicFilteringWebToolWithoutCodeExecution(tools) {
|
|
|
5540
5648
|
function resolveAnthropicReasoningConfig({ reasoning, modelId, supportsAdaptiveThinking, supportsXhighEffort, rejectsThinkingDisabled, supportsBetweenToolsThinking, maxOutputTokensForModel, warnings }) {
|
|
5541
5649
|
if (!isCustomReasoning(reasoning)) return;
|
|
5542
5650
|
if (reasoning === "none") {
|
|
5543
|
-
if (supportsBetweenToolsThinking)
|
|
5651
|
+
if (supportsBetweenToolsThinking) {
|
|
5652
|
+
warnings.push({
|
|
5653
|
+
type: "compatibility",
|
|
5654
|
+
feature: "reasoning",
|
|
5655
|
+
details: `reasoning 'none' is not supported by ${modelId}; thinking cannot be disabled. Using 'between_tools' thinking, the lowest thinking setting, instead.`
|
|
5656
|
+
});
|
|
5657
|
+
return { thinking: { type: "between_tools" } };
|
|
5658
|
+
}
|
|
5544
5659
|
if (rejectsThinkingDisabled) {
|
|
5545
5660
|
warnings.push({
|
|
5546
5661
|
type: "compatibility",
|
|
@@ -5559,26 +5674,23 @@ function resolveAnthropicReasoningConfig({ reasoning, modelId, supportsAdaptiveT
|
|
|
5559
5674
|
effort: mapReasoningToProviderEffort({
|
|
5560
5675
|
reasoning,
|
|
5561
5676
|
effortMap: {
|
|
5562
|
-
minimal: "low",
|
|
5563
5677
|
low: "low",
|
|
5564
5678
|
medium: "medium",
|
|
5565
5679
|
high: "high",
|
|
5566
|
-
|
|
5680
|
+
...supportsXhighEffort && { xhigh: "xhigh" },
|
|
5567
5681
|
max: "max"
|
|
5568
5682
|
},
|
|
5569
5683
|
warnings
|
|
5570
5684
|
})
|
|
5571
5685
|
};
|
|
5572
|
-
const budgetTokens = mapReasoningToProviderBudget({
|
|
5573
|
-
reasoning,
|
|
5574
|
-
maxOutputTokens: maxOutputTokensForModel,
|
|
5575
|
-
maxReasoningBudget: maxOutputTokensForModel,
|
|
5576
|
-
warnings
|
|
5577
|
-
});
|
|
5578
|
-
if (budgetTokens == null) return;
|
|
5579
5686
|
return { thinking: {
|
|
5580
5687
|
type: "enabled",
|
|
5581
|
-
budgetTokens
|
|
5688
|
+
budgetTokens: mapReasoningToProviderBudget({
|
|
5689
|
+
reasoning,
|
|
5690
|
+
maxOutputTokens: maxOutputTokensForModel,
|
|
5691
|
+
maxReasoningBudget: maxOutputTokensForModel,
|
|
5692
|
+
warnings
|
|
5693
|
+
})
|
|
5582
5694
|
} };
|
|
5583
5695
|
}
|
|
5584
5696
|
function mapAnthropicResponseContextManagement(contextManagement) {
|
|
@@ -6289,6 +6401,6 @@ var AnthropicSkills = class {
|
|
|
6289
6401
|
}
|
|
6290
6402
|
};
|
|
6291
6403
|
//#endregion
|
|
6292
|
-
export { AnthropicFiles, AnthropicLanguageModel, AnthropicLanguageModel as AnthropicMessagesLanguageModel, AnthropicSkills, anthropicTools, getModelCapabilities, prepareTools, sanitizeJsonSchema };
|
|
6404
|
+
export { AnthropicFiles, AnthropicLanguageModel, AnthropicLanguageModel as AnthropicMessagesLanguageModel, AnthropicSkills, anthropicTools, getAnthropicModelCapabilities as getModelCapabilities, prepareTools, sanitizeJsonSchema };
|
|
6293
6405
|
|
|
6294
6406
|
//# sourceMappingURL=index.js.map
|