Format a token count with k/M suffix, keeping the ~ prefix for estimates.
(tokens: int)
| 143 | |
| 144 | |
| 145 | def _format_token_count(tokens: int) -> str: |
| 146 | """Format a token count with k/M suffix, keeping the ~ prefix for estimates.""" |
| 147 | if tokens >= 1_000_000: |
| 148 | return f"~{tokens / 1_000_000:.1f}M" |
| 149 | if tokens >= 1_000: |
| 150 | return f"~{tokens / 1_000:.1f}k" |
| 151 | return f"~{tokens}" |
| 152 | |
| 153 | |
| 154 | def _format_calls(calls: int) -> str: |
no outgoing calls
no test coverage detected