Skip to main content

compress_text_blocks

Function compress_text_blocks 

Source
pub fn compress_text_blocks(blocks: &mut [Value], aggressiveness: f64) -> u32
Expand description

Compress every { "type": "text", "text": … } block in a content array (Anthropic message content / system blocks). Blocks carrying a cache_control breakpoint are skipped so client cache anchors survive. Returns the number of blocks rewritten.