Format timing and token usage into a short summary string.
(elapsed: float, usage)
| 362 | |
| 363 | |
| 364 | def _format_usage(elapsed: float, usage) -> str: |
| 365 | """Format timing and token usage into a short summary string.""" |
| 366 | cached = getattr(usage, "prompt_tokens_details", None) |
| 367 | cache_info = "" |
| 368 | if cached and hasattr(cached, "cached_tokens") and cached.cached_tokens: |
| 369 | cache_info = f", cached={cached.cached_tokens}" |
| 370 | return f"{elapsed:.1f}s (in={usage.prompt_tokens}, out={usage.completion_tokens}{cache_info})" |
| 371 | |
| 372 | |
| 373 | def _fmt_messages(messages: list[dict], max_content: int = 200) -> str: |
no outgoing calls
no test coverage detected