MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _check_trivial

Function _check_trivial

uncommon_route/router/classifier.py:212–222  ·  view source on GitHub ↗

Detect trivially simple or trivially long prompts via structure only.

(prompt: str, tokens: int)

Source from the content-addressed store, hash-verified

210# ─── Trivial Detection (structural only, no keyword lists) ───
211
212def _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
225def _soften_short_code_question(prompt: str, estimated_tokens: int, tier: Tier) -> Tier:

Callers 1

classifyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected