{# Provider prompt-cache tiles shared by the usage, observability and Evalground views. read_percent: cached share of measured input tokens; hit_calls/measured_calls: calls that reported cache usage and read from the cache. None means not reported. #} {% macro cache_kpis(read_percent, hit_calls, measured_calls, cached_tokens, write_tokens) %} {% set read_percent, cached_tokens, write_tokens = read_percent|default(none), cached_tokens|default(none), write_tokens|default(none) %}
Cache read rate{{ '%.1f%%'|format(read_percent) if read_percent is not none else 'Unknown' }}of measured input tokens
Cache hit rate{{ '%.1f%%'|format(100 * hit_calls / measured_calls) if measured_calls else 'Unknown' }}{{ '{:,}'.format(hit_calls|int) if measured_calls else 0 }} of {{ '{:,}'.format((measured_calls or 0)|int) }} calls read from cache
Cached input tokens{{ '{:,}'.format(cached_tokens|int) if cached_tokens is not none else 'Unknown' }}billed at the cached-input rate
Cache write tokens{{ '{:,}'.format(write_tokens|int) if write_tokens is not none else 'Unknown' }}new cache entries, where reported
{% endmacro %}