swarm repositories / source
aboutsummaryrefslogtreecommitdiff
path: root/assemble-pro-review-package/scripts/inline_section.py
diff options
context:
space:
mode:
Diffstat (limited to 'assemble-pro-review-package/scripts/inline_section.py')
-rwxr-xr-xassemble-pro-review-package/scripts/inline_section.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/assemble-pro-review-package/scripts/inline_section.py b/assemble-pro-review-package/scripts/inline_section.py
index 2a8f4f3..23daaf0 100755
--- a/assemble-pro-review-package/scripts/inline_section.py
+++ b/assemble-pro-review-package/scripts/inline_section.py
@@ -48,12 +48,14 @@ LANGUAGE_BY_SUFFIX = {
".yml": "yaml",
}
+HARD_MAX_TOKENS = 100_000
+
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description=(
"Append a labeled markdown section containing a file or excerpt to a "
- "target document, while enforcing a hard total token budget."
+ "target document, while enforcing the skill's fixed 100k-token hard budget."
)
)
parser.add_argument("source", type=Path, help="Source file to inline.")
@@ -91,12 +93,6 @@ def parse_args() -> argparse.Namespace:
"back to --encoding."
),
)
- parser.add_argument(
- "--max-tokens",
- type=int,
- default=100_000,
- help="Hard maximum for the full target document after append. Defaults to 100000.",
- )
return parser.parse_args()
@@ -217,10 +213,10 @@ def main() -> None:
section_tokens = len(encoding.encode(section))
existing_tokens = len(encoding.encode(existing))
- if total_tokens > args.max_tokens:
+ if total_tokens > HARD_MAX_TOKENS:
fail(
"refusing append because the projected document would exceed the hard budget: "
- f"{total_tokens} > {args.max_tokens} ({encoding_label}; existing={existing_tokens}; "
+ f"{total_tokens} > {HARD_MAX_TOKENS} ({encoding_label}; existing={existing_tokens}; "
f"section={section_tokens})"
)