DocuMint / router.py
himu1780's picture
Create router.py
c8a91e9 verified
Raw
History Blame Contribute Delete
1.28 kB
# router.py
# =================================
# Core-first routing
# Let Core reasoning dominate
# Skill is attached only on strong signals
# =================================
def route_skill(prompt: str):
"""
Returns:
- skill name (str) if high confidence
- None if Core/Base should handle it
"""
if not prompt:
return None
text = prompt.lower()
# ---------- STRONG SIGNALS (explicit tasks) ----------
# Excel / spreadsheet specific actions
excel_signals = [
"excel file", "spreadsheet", "xlsx", "csv",
"sheet", "pivot table", "cell", "column", "row"
]
if any(k in text for k in excel_signals):
return "excel"
# VAT / Invoice calculations
vat_signals = [
"vat calculation", "invoice total",
"tax amount", "vat %", "bill amount"
]
if any(k in text for k in vat_signals):
return "vat"
# Document processing (analysis, extraction)
doc_signals = [
"analyze document", "extract from pdf",
"document review", "read this pdf",
"contract analysis"
]
if any(k in text for k in doc_signals):
return "docs"
# ---------- WEAK / AMBIGUOUS INPUT ----------
# Let Base + Core reasoning decide
return None