core: fix message caching for Anthropic models to improve response consistency

thinking-toggle-wip
Dax Raad 2025-12-15 14:33:09 -05:00 committed by Aiden Cline
parent 6fd6eecbf5
commit 64b8f0a1a9
1 changed files with 6 additions and 1 deletions

View File

@ -206,7 +206,12 @@ export namespace ProviderTransform {
export function message(msgs: ModelMessage[], model: Provider.Model) {
msgs = unsupportedParts(msgs, model)
msgs = normalizeMessages(msgs, model)
if (model.providerID === "anthropic" || model.api.id.includes("anthropic") || model.api.id.includes("claude")) {
if (
model.providerID === "anthropic" ||
model.api.id.includes("anthropic") ||
model.api.id.includes("claude") ||
model.api.npm === "@ai-sdk/anthropic"
) {
msgs = applyCaching(msgs, model.providerID)
}