Files
spring-ai/advisors/output/12-token-budget.txt
T
Claude 527f4ba7ff Add advisors module: custom logging, PII redaction and token-budget advisors
Tests pin down chain ordering (including ties), BaseAdvisor stream behaviour, redaction order versus memory and logging, the tool loop, and how a refusal surfaces on calls, streams and over HTTP.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ja4jkzrbQ4LQZBNrb5mkZE
2026-09-24 16:21:19 +00:00

16 lines
659 B
Plaintext

# TokenBudgetAdvisor: 40 tokens per request, 60 per user
alice asks short questions; "spent" is the usage the model reported:
call 1: answered, spent=13, model calls=1
call 2: answered, spent=26, model calls=2
call 3: answered, spent=39, model calls=3
call 4: answered, spent=52, model calls=4
call 5: answered, spent=65, model calls=5
call 6: refused (user alice has used 65 of 60 tokens), spent=65, model calls=5
bob pastes a stack trace of 103 estimated tokens:
refused: prompt is about 103 tokens, the limit per request is 40
model calls: 5 (was 5), bob's spent: 0
bob then asks a short question: answered, bob spent=13, alice spent=65