UNPKG

agentfootprint

Version:

The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.

47 lines (46 loc) • 1.9 kB
/** Converse cachePoint unions and usage, shared by complete and stream. * AWS contracts: /APIReference/API_runtime_{CachePointBlock,TokenUsage,Tool, * SystemContentBlock,ContentBlock}.html and /userguide/prompt-caching.html. * Model eligibility and TTL restrictions have one owner: bedrockModels.ts. */ import type { PromptCaching, CacheMarker } from '../../cache/types.js'; export interface BedrockCachePoint { cachePoint: { type: 'default'; ttl?: '1h'; }; } export interface BedrockMessagePosition { readonly message: number; readonly content: number; } interface MarkableBody { system?: unknown[]; messages: { content: unknown[]; }[]; toolConfig?: { tools: unknown[]; }; } export interface BedrockCacheUsage { readonly inputTokens: number; readonly outputTokens: number; readonly cacheReadInputTokens?: number; readonly cacheWriteInputTokens?: number; } export declare function bedrockPromptCaching(model: string): PromptCaching | undefined; /** Translate only valid original boundaries; a dropped message never marks a * neighbor. Deduplicate, cap, then insert backwards so indices never shift. * TTLs follow wire order (tools → system → messages), independent of marker * arrival order: a long TTL after a short one is safely reduced to default. */ export declare function applyCacheMarkers(body: MarkableBody, markers: readonly CacheMarker[], model: string, positions: readonly (BedrockMessagePosition | undefined)[]): void; /** Present zero is measured; absent or malformed cache counters stay absent. * inputTokens is fresh input (AWS excludes both cache reads and writes), the * same semantics the port cache meter expects from Anthropic's adapter. */ export declare function readCacheUsage(usage: BedrockCacheUsage | undefined): { cacheRead?: number; cacheWrite?: number; }; export {};