Detect trivially simple or trivially long prompts via structure only.
(prompt: str, tokens: int)
| 210 | # ─── Trivial Detection (structural only, no keyword lists) ─── |
| 211 | |
| 212 | def _check_trivial(prompt: str, tokens: int) -> Tier | None: |
| 213 | """Detect trivially simple or trivially long prompts via structure only.""" |
| 214 | if tokens <= 1: |
| 215 | return Tier.SIMPLE |
| 216 | if tokens > 100_000: |
| 217 | return Tier.COMPLEX |
| 218 | stripped = prompt.strip() |
| 219 | if len(stripped) < 15 and not any(c in stripped for c in "{}[]();=<>+-*/\\|@#$%^&"): |
| 220 | if stripped.endswith("?") or stripped.endswith("?"): |
| 221 | return Tier.SIMPLE |
| 222 | return None |
| 223 | |
| 224 | |
| 225 | def _soften_short_code_question(prompt: str, estimated_tokens: int, tier: Tier) -> Tier: |