(
systemPrompt: SystemPrompt,
enablePromptCaching: boolean,
options?: {
skipGlobalCacheForSystemPrompt?: boolean
querySource?: QuerySource
},
)
| 3211 | } |
| 3212 | |
| 3213 | export function buildSystemPromptBlocks( |
| 3214 | systemPrompt: SystemPrompt, |
| 3215 | enablePromptCaching: boolean, |
| 3216 | options?: { |
| 3217 | skipGlobalCacheForSystemPrompt?: boolean |
| 3218 | querySource?: QuerySource |
| 3219 | }, |
| 3220 | ): TextBlockParam[] { |
| 3221 | // IMPORTANT: Do not add any more blocks for caching or you will get a 400 |
| 3222 | return splitSysPromptPrefix(systemPrompt, { |
| 3223 | skipGlobalCacheForSystemPrompt: options?.skipGlobalCacheForSystemPrompt, |
| 3224 | }).map(block => { |
| 3225 | return { |
| 3226 | type: 'text' as const, |
| 3227 | text: block.text, |
| 3228 | ...(enablePromptCaching && |
| 3229 | block.cacheScope !== null && { |
| 3230 | cache_control: getCacheControl({ |
| 3231 | scope: block.cacheScope, |
| 3232 | querySource: options?.querySource, |
| 3233 | }), |
| 3234 | }), |
| 3235 | } |
| 3236 | }) |
| 3237 | } |
| 3238 | |
| 3239 | type HaikuOptions = Omit<Options, 'model' | 'getToolPermissionContext'> |
| 3240 |
no test coverage detected