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

Function _apply_feedback

uncommon_route/cli.py:400–417  ·  view source on GitHub ↗

Apply one online learning update from CLI feedback. Returns the target tier or None.

(features: dict[str, float], current_tier: str, signal: str)

Source from the content-addressed store, hash-verified

398
399
400def _apply_feedback(features: dict[str, float], current_tier: str, signal: str) -> str | None:
401 """Apply one online learning update from CLI feedback. Returns the target tier or None."""
402 from uncommon_route.router.classifier import save_online_model, update_model
403
404 idx = _TIER_ORDER.index(current_tier) if current_tier in _TIER_ORDER else 1
405 if signal == "u":
406 target = _TIER_ORDER[min(idx + 1, len(_TIER_ORDER) - 1)]
407 elif signal == "d":
408 target = _TIER_ORDER[max(idx - 1, 0)]
409 elif signal == "ok":
410 target = current_tier
411 else:
412 return None
413
414 if not update_model(features, target):
415 return None
416 save_online_model()
417 return target
418
419
420def _cmd_route(args: list[str]) -> None:

Callers 1

_cmd_routeFunction · 0.85

Calls 2

update_modelFunction · 0.90
save_online_modelFunction · 0.90

Tested by

no test coverage detected