router::state_machine
More...
Classes
Functions
Attributes
Detailed Description
GQHSM-compatible JSON state machine runtime for the router classification pipeline.
Consumes a GQHSM-compatible JSON state machine definition (derived from the
GQHSM XML format used in ``Valve.xml`` and ``Air.xml``) and builds a
``transitions``-based runtime. The JSON format is the compatibility
contract — when the C++ parent integrates GQHSM directly, the same JSON
feeds into it.
Usage::
sm = RouterStateMachine.load_definition("config/router_state_machine.json")
sm.trigger("keyword_hit", specialist="code", confidence=0.85)
print(sm.state) # 'select_specialist'
Dependency on ``transitions`` is deferred — the module loads and works
without it, but ``RouterStateMachine`` raises ``ImportError`` with a
helpful message when ``transitions`` is not installed.
Functions Documentation
function create_router_state_machine
RouterStateMachine create_router_state_machine(
Optional]] rule_handlers[Dict[str, Callable[..., Any] =None
)
Create a pre-configured router classification state machine.
Uses the built-in ``_ROUTER_CLASSIFIER_DEFINITION`` (7 states,
10 transitions) matching the GQHSM-compatible JSON schema.
Args:
rule_handlers: Optional dict mapping callback names to callables.
Returns:
A ``RouterStateMachine`` configured for query classification.
Attributes Documentation
variable logger
logger = logging.getLogger(__name__);
variable GQHSM_JSON_SCHEMA
Updated on 2026-10-09 at 03:59:43 +0000