( systemContent: string, modelString: string, cacheTtl?: AnthropicCacheTtl | null )
| 120 | * System messages rarely change and should always be cached. |
| 121 | */ |
| 122 | export function createCachedSystemMessage( |
| 123 | systemContent: string, |
| 124 | modelString: string, |
| 125 | cacheTtl?: AnthropicCacheTtl | null |
| 126 | ): ModelMessage | null { |
| 127 | if (!systemContent || !supportsAnthropicCache(modelString)) { |
| 128 | return null; |
| 129 | } |
| 130 | |
| 131 | return { |
| 132 | role: "system" as const, |
| 133 | content: systemContent, |
| 134 | providerOptions: cacheTtl ? anthropicCacheControl(cacheTtl) : ANTHROPIC_CACHE_CONTROL, |
| 135 | }; |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Apply cache control to tool definitions for Anthropic models. |
no test coverage detected