Files
spring-ai/prompt-caching/output/02-hits-and-invalidation.txt
T

15 lines
1.0 KiB
Plaintext

# A cache hit in Spring AI's Usage, and what one changed word costs (SYSTEM_AND_TOOLS, 4 tools, 24,000-character system prompt)
A. The same tools and system prompt, a different question each time
call 1 getPromptTokens=6959 getCacheReadInputTokens=0 getCacheWriteInputTokens=6628
call 2 getPromptTokens=6957 getCacheReadInputTokens=6628 getCacheWriteInputTokens=0
call 2: 6628 of 6957 prompt tokens came from the cache; 329 were billed at the plain input price
(getPromptTokens() includes the cached tokens in 2.1.0)
B. After a warm-up call, what does each change do? (read = served from cache, write = stored again)
(the four tool definitions alone are 550 tokens; the whole prefix is 6628)
nothing changed read=6628 write=0 uncached=326
only the retrieved context changed read=6628 write=0 uncached=1007
one word of the system prompt changed read=550 write=6079 uncached=12
one word of one tool description changed read=0 write=6628 uncached=12