ChatBot.guard_stats()

Get activation statistics for all attached guardrails.

Usage

Source

ChatBot.guard_stats()

Returns

dict[str, dict[str, int]]
Mapping of guard name to counts of passed, blocked, and rewritten activations.

Examples

stats = bot.guard_stats()
# {'no_pii': {'passed': 42, 'blocked': 0, 'rewritten': 3},
#  'max_response_length': {'passed': 40, 'blocked': 0, 'rewritten': 5}}