File size: 1,049 Bytes
0fa1a0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Dependency-free inference for the BitNet workload router.

This is a triage model, not an implementation of BitNet itself.
"""

from __future__ import annotations

import argparse
import json
from pathlib import Path


def predict(prompt: str, context_tokens: int = 0, output_tokens: int = 0) -> str:
    text = prompt.casefold()
    if context_tokens > 4096 or "contrato de 12 mil" in text:
        return "BITNET_NOT_RECOMMENDED"
    if any(term in text for term in ("ferramenta", "crm", "não invent", "não invente")) or output_tokens > 256:
        return "BITNET_REVIEW"
    return "BITNET_CANDIDATE"


def main() -> None:
    parser = argparse.ArgumentParser()
    parser.add_argument("--prompt", required=True)
    parser.add_argument("--context-tokens", type=int, default=0)
    parser.add_argument("--output-tokens", type=int, default=0)
    args = parser.parse_args()
    print(json.dumps({"routing_decision": predict(args.prompt, args.context_tokens, args.output_tokens)}, ensure_ascii=False))


if __name__ == "__main__":
    main()