prompt_size.py 950 B

123456789101112131415161718192021
  1. """``hermes prompt-size`` subcommand parser."""
  2. from __future__ import annotations
  3. from typing import Callable
  4. from hermes_cli.subcommands._shared import add_json_flag
  5. def build_prompt_size_parser(subparsers, *, cmd_prompt_size: Callable) -> None:
  6. """Attach the ``prompt-size`` subcommand to ``subparsers``."""
  7. prompt_size_parser = subparsers.add_parser(
  8. "prompt-size", help="Show a byte breakdown of the system prompt + tool schemas",
  9. description="Report the fixed prompt budget for a fresh session: system "
  10. "prompt total, skills index, memory, user profile, and tool-schema "
  11. "JSON. Runs offline (no API call).")
  12. prompt_size_parser.add_argument(
  13. "--platform", default="cli",
  14. help="Platform to simulate (cli, telegram, discord, ...). Default: cli")
  15. add_json_flag(prompt_size_parser, "Emit the breakdown as JSON")
  16. prompt_size_parser.set_defaults(func=cmd_prompt_size)