Asmitha-28 commited on
Commit
5abd7f2
·
verified ·
1 Parent(s): 5e0f843

Upload folder using huggingface_hub

Browse files
Files changed (27) hide show
  1. src/__pycache__/api.cpython-310.pyc.1720180710480 +0 -0
  2. src/__pycache__/api.cpython-310.pyc.1906221088432 +0 -0
  3. src/__pycache__/api.cpython-310.pyc.1906249464720 +0 -0
  4. src/__pycache__/api.cpython-310.pyc.1970020760784 +0 -0
  5. src/__pycache__/clarification_engine.cpython-310.pyc.1721055161040 +0 -0
  6. src/__pycache__/clarification_engine.cpython-310.pyc.1904926602800 +0 -0
  7. src/__pycache__/clarification_engine.cpython-310.pyc.1906949946720 +0 -0
  8. src/__pycache__/clarification_engine.cpython-310.pyc.1970874161216 +0 -0
  9. src/__pycache__/confidence_router.cpython-310.pyc.1720840646208 +0 -0
  10. src/__pycache__/confidence_router.cpython-310.pyc.1904930151344 +0 -0
  11. src/__pycache__/ensemble_router.cpython-310.pyc.1720840608512 +0 -0
  12. src/__pycache__/ensemble_router.cpython-310.pyc.1904930247008 +0 -0
  13. src/__pycache__/ensemble_router.cpython-310.pyc.1906893405536 +0 -0
  14. src/__pycache__/ensemble_router.cpython-310.pyc.1970875488144 +0 -0
  15. src/__pycache__/feature_extraction.cpython-310.pyc.1721058800224 +0 -0
  16. src/__pycache__/feature_extraction.cpython-310.pyc.1904930158032 +0 -0
  17. src/__pycache__/feature_extraction.cpython-310.pyc.1906893394624 +0 -0
  18. src/__pycache__/feature_extraction.cpython-310.pyc.1970874739056 +0 -0
  19. src/__pycache__/sla_predictor.cpython-310.pyc.1721057874272 +0 -0
  20. src/__pycache__/sla_predictor.cpython-310.pyc.1904930256688 +0 -0
  21. src/__pycache__/sla_predictor.cpython-310.pyc.1906954017536 +0 -0
  22. src/__pycache__/sla_predictor.cpython-310.pyc.1971093652384 +0 -0
  23. src/__pycache__/ticket_validator.cpython-310.pyc.1720839795296 +0 -0
  24. src/__pycache__/ticket_validator.cpython-310.pyc.1906863721264 +0 -0
  25. src/__pycache__/ticket_validator.cpython-310.pyc.1906891999872 +0 -0
  26. src/__pycache__/ticket_validator.cpython-310.pyc.1970663426864 +0 -0
  27. src/api.py +11 -0
src/__pycache__/api.cpython-310.pyc.1720180710480 ADDED
Binary file (22.9 kB). View file
 
src/__pycache__/api.cpython-310.pyc.1906221088432 ADDED
Binary file (22.9 kB). View file
 
src/__pycache__/api.cpython-310.pyc.1906249464720 ADDED
Binary file (22.9 kB). View file
 
src/__pycache__/api.cpython-310.pyc.1970020760784 ADDED
Binary file (22.9 kB). View file
 
src/__pycache__/clarification_engine.cpython-310.pyc.1721055161040 ADDED
Binary file (11.7 kB). View file
 
src/__pycache__/clarification_engine.cpython-310.pyc.1904926602800 ADDED
Binary file (11.8 kB). View file
 
src/__pycache__/clarification_engine.cpython-310.pyc.1906949946720 ADDED
Binary file (11.7 kB). View file
 
src/__pycache__/clarification_engine.cpython-310.pyc.1970874161216 ADDED
Binary file (11.7 kB). View file
 
src/__pycache__/confidence_router.cpython-310.pyc.1720840646208 ADDED
Binary file (10.5 kB). View file
 
src/__pycache__/confidence_router.cpython-310.pyc.1904930151344 ADDED
Binary file (10.5 kB). View file
 
src/__pycache__/ensemble_router.cpython-310.pyc.1720840608512 ADDED
Binary file (15.5 kB). View file
 
src/__pycache__/ensemble_router.cpython-310.pyc.1904930247008 ADDED
Binary file (15.6 kB). View file
 
src/__pycache__/ensemble_router.cpython-310.pyc.1906893405536 ADDED
Binary file (15.5 kB). View file
 
src/__pycache__/ensemble_router.cpython-310.pyc.1970875488144 ADDED
Binary file (15.5 kB). View file
 
src/__pycache__/feature_extraction.cpython-310.pyc.1721058800224 ADDED
Binary file (11.7 kB). View file
 
src/__pycache__/feature_extraction.cpython-310.pyc.1904930158032 ADDED
Binary file (11.7 kB). View file
 
src/__pycache__/feature_extraction.cpython-310.pyc.1906893394624 ADDED
Binary file (11.7 kB). View file
 
src/__pycache__/feature_extraction.cpython-310.pyc.1970874739056 ADDED
Binary file (11.7 kB). View file
 
src/__pycache__/sla_predictor.cpython-310.pyc.1721057874272 ADDED
Binary file (3.79 kB). View file
 
src/__pycache__/sla_predictor.cpython-310.pyc.1904930256688 ADDED
Binary file (3.8 kB). View file
 
src/__pycache__/sla_predictor.cpython-310.pyc.1906954017536 ADDED
Binary file (3.79 kB). View file
 
src/__pycache__/sla_predictor.cpython-310.pyc.1971093652384 ADDED
Binary file (3.79 kB). View file
 
src/__pycache__/ticket_validator.cpython-310.pyc.1720839795296 ADDED
Binary file (6.27 kB). View file
 
src/__pycache__/ticket_validator.cpython-310.pyc.1906863721264 ADDED
Binary file (6.27 kB). View file
 
src/__pycache__/ticket_validator.cpython-310.pyc.1906891999872 ADDED
Binary file (6.27 kB). View file
 
src/__pycache__/ticket_validator.cpython-310.pyc.1970663426864 ADDED
Binary file (6.27 kB). View file
 
src/api.py CHANGED
@@ -393,6 +393,15 @@ def _apply_direct_signal_overrides(result: Dict, text: str, direct_intents: List
393
  return result
394
 
395
 
 
 
 
 
 
 
 
 
 
396
  def _has_support_intent(text: str, features: Dict, result: Dict) -> bool:
397
  if any(re.search(pattern, text, flags=re.I) for pattern in SUPPORT_INTENT_PATTERNS):
398
  return True
@@ -542,6 +551,8 @@ def route_ticket(req: TicketRequest):
542
  unique_intents = list(dict.fromkeys(segment_intents or direct_intents))
543
  is_multi_intent = len(unique_intents) >= 2
544
  result = _apply_direct_signal_overrides(result, clean_text, unique_intents)
 
 
545
 
546
  # 4. Operational SLA Risk Engine
547
  urg_val = features.get('urgency_score', 0.0)
 
393
  return result
394
 
395
 
396
+ def _order_intents_by_probability(intents: List[str], result: Dict) -> List[str]:
397
+ probs = result.get('all_probs') or {}
398
+ original_rank = {intent: idx for idx, intent in enumerate(intents)}
399
+ return sorted(
400
+ intents,
401
+ key=lambda intent: (-float(probs.get(intent, 0.0)), original_rank[intent]),
402
+ )
403
+
404
+
405
  def _has_support_intent(text: str, features: Dict, result: Dict) -> bool:
406
  if any(re.search(pattern, text, flags=re.I) for pattern in SUPPORT_INTENT_PATTERNS):
407
  return True
 
551
  unique_intents = list(dict.fromkeys(segment_intents or direct_intents))
552
  is_multi_intent = len(unique_intents) >= 2
553
  result = _apply_direct_signal_overrides(result, clean_text, unique_intents)
554
+ if is_multi_intent:
555
+ unique_intents = _order_intents_by_probability(unique_intents, result)
556
 
557
  # 4. Operational SLA Risk Engine
558
  urg_val = features.get('urgency_score', 0.0)