MCPcopy Create free account
hub / github.com/Noumena-Network/code / buildSystemPromptBlocks

Function buildSystemPromptBlocks

src/services/api/claude.ts:3240–3264  ·  view source on GitHub ↗
(
  systemPrompt: SystemPrompt,
  enablePromptCaching: boolean,
  options?: {
    skipGlobalCacheForSystemPrompt?: boolean
    querySource?: QuerySource
  },
)

Source from the content-addressed store, hash-verified

3238}
3239
3240export function buildSystemPromptBlocks(
3241 systemPrompt: SystemPrompt,
3242 enablePromptCaching: boolean,
3243 options?: {
3244 skipGlobalCacheForSystemPrompt?: boolean
3245 querySource?: QuerySource
3246 },
3247): TextBlockParam[] {
3248 // IMPORTANT: Do not add any more blocks for caching or you will get a 400
3249 return splitSysPromptPrefix(systemPrompt, {
3250 skipGlobalCacheForSystemPrompt: options?.skipGlobalCacheForSystemPrompt,
3251 }).map(block => {
3252 return {
3253 type: 'text' as const,
3254 text: block.text,
3255 ...(enablePromptCaching &&
3256 block.cacheScope !== null && {
3257 cache_control: getCacheControl({
3258 scope: block.cacheScope,
3259 querySource: options?.querySource,
3260 }),
3261 }),
3262 }
3263 })
3264}
3265
3266type HaikuOptions = Omit<Options, 'model' | 'getToolPermissionContext'>
3267

Callers 1

queryModelFunction · 0.85

Calls 2

splitSysPromptPrefixFunction · 0.85
getCacheControlFunction · 0.85

Tested by

no test coverage detected