MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / _format_usage

Function _format_usage

openkb/agent/compiler.py:364–370  ·  view source on GitHub ↗

Format timing and token usage into a short summary string.

(elapsed: float, usage)

Source from the content-addressed store, hash-verified

362
363
364def _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
373def _fmt_messages(messages: list[dict], max_content: int = 200) -> str:

Callers 2

_llm_callFunction · 0.85
_llm_call_asyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected