~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
"""Shared formatting utilities."""
def human_size(size_bytes: float) -> str:
"""Convert bytes to human-readable size string.
Args:
size_bytes: Size in bytes.
Returns:
Human-readable string like "247.0 MB" or "1.5 GB".
"""
for unit in ("B", "KB", "MB", "GB", "TB", "PB"):
if abs(size_bytes) < 1024:
return f"{size_bytes:.1f} {unit}"
size_bytes /= 1024
return f"{size_bytes:.1f} EB"
def short_id(value: str, n: int = 8) -> str:
"""Render an id for log messages without a misleading ellipsis.
An id longer than ``n`` characters shortens to its first ``n``
characters followed by ``...``. An id that is already at most ``n``
characters (for example a short test fixture id) renders as-is, so an
operator can trust that ``...`` really means truncation (#5583).
Use this instead of an inline ``f"{some_id[:8]}..."``: the slice alone
cannot tell a truncated id from one that was never truncated.
Args:
value: The id to render; it must be a ``str``.
n: How many leading characters to keep.
Returns:
``value`` itself when it has at most ``n`` characters, otherwise its
first ``n`` characters followed by ``...``.
"""
return value[:n] + ("..." if len(value) > n else "")