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

Method record_routing

uncommon_route/observability.py:48–67  ·  view source on GitHub ↗
(
        self,
        tier: int,
        model: str,
        method: str,
        confidence: float,
        signals_agreed: bool = True,
    )

Source from the content-addressed store, hash-verified

46 self._signal_agreement_count = 0
47
48 def record_routing(
49 self,
50 tier: int,
51 model: str,
52 method: str,
53 confidence: float,
54 signals_agreed: bool = True,
55 ) -> None:
56 self.total_requests += 1
57 self.requests_by_tier[tier] += 1
58 self.requests_by_model[model] += 1
59 self._confidence_sum += confidence
60 if method == "cascaded":
61 self.cascade_count += 1
62 elif method == "conservative":
63 self.conservative_count += 1
64 elif method == "escalated":
65 self.escalated_count += 1
66 if signals_agreed:
67 self._signal_agreement_count += 1
68
69 def snapshot(self) -> dict[str, Any]:
70 avg_conf = self._confidence_sum / self.total_requests if self.total_requests else 0.0

Callers 4

test_metrics_incrementFunction · 0.95
test_metrics_snapshotFunction · 0.95
test_metrics_resetFunction · 0.95
on_route_completeFunction · 0.80

Calls

no outgoing calls

Tested by 3

test_metrics_incrementFunction · 0.76
test_metrics_snapshotFunction · 0.76
test_metrics_resetFunction · 0.76