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

Function extract_features

uncommon_route/router/classifier.py:77–94  ·  view source on GitHub ↗

Extract the feature vector for a prompt. Features are extracted from the user prompt plus the request-scoped system prompt when present. Context features (tools present, conversation depth, etc.) are passed separately and encoded as numerical signals — no keyword matching.

(
    prompt: str,
    system_prompt: str | None = None,
    context_features: dict[str, float] | None = None,
)

Source from the content-addressed store, hash-verified

75
76
77def extract_features(
78 prompt: str,
79 system_prompt: str | None = None,
80 context_features: dict[str, float] | None = None,
81) -> dict[str, float]:
82 """Extract the feature vector for a prompt.
83
84 Features are extracted from the user prompt plus the request-scoped
85 system prompt when present. Context features (tools present,
86 conversation depth, etc.) are passed separately and encoded as
87 numerical signals — no keyword matching.
88 """
89 _ensure_model_loaded()
90 return _extract_all_features(
91 prompt,
92 system_prompt=system_prompt,
93 context_features=context_features,
94 )
95
96
97def update_model(features: dict[str, float], correct_tier: str) -> bool:

Callers 5

_dummy_featuresFunction · 0.90
_cmd_routeFunction · 0.90
_handle_chat_coreFunction · 0.90

Calls 2

_ensure_model_loadedFunction · 0.85
_extract_all_featuresFunction · 0.85