crp.clr¶
Auto-generated reference for the crp.clr subpackage.
clr¶
crp.clr ¶
Clarification Protocol (CRP-SPEC-053).
ClarificationSession dataclass ¶
Holds a pending clarification and re-enters the resolved turn.
ClarificationRequired dataclass ¶
Typed CRP-Clarification-Required response.
Interpretation dataclass ¶
One candidate reading of an ambiguous turn.
ClarificationPolicy dataclass ¶
Policy knobs for the clarification protocol.
from_obj(obj) classmethod ¶
Coerce a policy object or dict into a ClarificationPolicy.
header_value(clarification) ¶
Build the X-CRP-Clarification header value.
build_clarification(candidates, reason='ambiguous-target') ¶
Sort candidates and choose a safe default (or none).
A default is only offered when the top reading clearly dominates the next, so HIGH-risk actions are not executed on a guessed default.
should_clarify(intent_confidence, parse_divergence, risk, policy=None) ¶
Decide whether to ask rather than guess.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intent_confidence | float | Classifier confidence in [0, 1]. | required |
parse_divergence | float | Divergence among candidate interpretations in [0, 1]. | required |
risk | str | Risk tier (LOW, MEDIUM, HIGH, CRITICAL). | required |
policy | ClarificationPolicy | Any | None | Policy with | None |
Returns:
| Type | Description |
|---|---|
bool | True when the protocol should emit a clarification response. |
clr.handler¶
crp.clr.handler ¶
clr.response¶
crp.clr.response ¶
Structured clarification response (CRP-SPEC-053 §5.3.2).
Interpretation dataclass ¶
One candidate reading of an ambiguous turn.
ClarificationRequired dataclass ¶
Typed CRP-Clarification-Required response.
build_clarification(candidates, reason='ambiguous-target') ¶
Sort candidates and choose a safe default (or none).
A default is only offered when the top reading clearly dominates the next, so HIGH-risk actions are not executed on a guessed default.
clr.trigger¶
crp.clr.trigger ¶
Clarification trigger (CRP-SPEC-053 §5.3.1).
ClarificationPolicy dataclass ¶
Policy knobs for the clarification protocol.
from_obj(obj) classmethod ¶
Coerce a policy object or dict into a ClarificationPolicy.
should_clarify(intent_confidence, parse_divergence, risk, policy=None) ¶
Decide whether to ask rather than guess.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intent_confidence | float | Classifier confidence in [0, 1]. | required |
parse_divergence | float | Divergence among candidate interpretations in [0, 1]. | required |
risk | str | Risk tier (LOW, MEDIUM, HIGH, CRITICAL). | required |
policy | ClarificationPolicy | Any | None | Policy with | None |
Returns:
| Type | Description |
|---|---|
bool | True when the protocol should emit a clarification response. |