Skip to content

bmel:compressionRatio

Category: LLM & AI Observability · Returns: bmel:number

bmel:compressionRatio(original: bmel:string, compressed: bmel:string)

Description

Returns the token compression ratio between an original text and a compressed/summarized version: tokenCount(original) / tokenCount(compressed). A ratio of 4.0 means the summary uses 4x fewer tokens. Useful for evaluating summarization efficiency and context compression strategies in RAG pipelines.

Arguments

Parameter Type Required Description
original bmel:string The original (longer) text.
compressed bmel:string The compressed or summarized version of the text.

Example

bmel:compressionRatio({doc:Request Payload}.$.original_text, {doc:Response Payload}.$.summary)

Back to BMEL Reference