(model: string)
| 331 | } |
| 332 | |
| 333 | export function getPromptCachingEnabled(model: string): boolean { |
| 334 | // Global disable takes precedence |
| 335 | if (isEnvTruthy(process.env.DISABLE_PROMPT_CACHING)) return false |
| 336 | |
| 337 | // Check if we should disable for small/fast model |
| 338 | if (isEnvTruthy(process.env.DISABLE_PROMPT_CACHING_HAIKU)) { |
| 339 | const smallFastModel = getSmallFastModel() |
| 340 | if (model === smallFastModel) return false |
| 341 | } |
| 342 | |
| 343 | // Check if we should disable for default Sonnet |
| 344 | if (isEnvTruthy(process.env.DISABLE_PROMPT_CACHING_SONNET)) { |
| 345 | const defaultSonnet = getDefaultSonnetModel() |
| 346 | if (model === defaultSonnet) return false |
| 347 | } |
| 348 | |
| 349 | // Check if we should disable for default Opus |
| 350 | if (isEnvTruthy(process.env.DISABLE_PROMPT_CACHING_OPUS)) { |
| 351 | const defaultOpus = getDefaultOpusModel() |
| 352 | if (model === defaultOpus) return false |
| 353 | } |
| 354 | |
| 355 | return true |
| 356 | } |
| 357 | |
| 358 | export function getCacheControl({ |
| 359 | scope, |
no test coverage detected