Interval
Rate the context along an ordinal or continuous rubric, and get back a conformalized interval with a coverage guarantee, alongside a point estimate — instead of a single probability-weighted score with no stated error bound.
Request
from cli_sdk import AzureOpenAIBackend, CLIClient, Interval
with CLIClient() as client:
result = client.evaluate(
context={"ticket": "This is the third time this has happened. Fix it."},
backend=AzureOpenAIBackend(model="gpt-4.1", deployment="support-gpt41"),
queries={
"frustration": Interval(
instructions="How frustrated is the customer?",
levels=["Calm", "Frustrated", "Very angry"],
calibration_profile="frustration-rubric-v1",
alpha=0.10,
method="CQR",
),
},
)
frustration = result.answers["frustration"]
print(frustration.interval) # (1, 2)
print(frustration.point_estimate) # 1.6
print(frustration.contains(2)) # True
print(frustration.legend[str(int(frustration.interval[1]))]) # 'Very angry'Response
{
"frustration": {
"type": "interval",
"point_estimate": 1.6,
"interval": [1, 2],
"levels": ["Frustrated", "Very angry"],
"legend": { "0": "Calm", "1": "Frustrated", "2": "Very angry" },
"guarantee": {
"type": "coverage",
"alpha": 0.10,
"method": "CQR",
"statement": "The interval contains the true level with probability at least 90% (conformalized quantile regression over levels, n=640).",
"calibration_profile": "frustration-rubric-v1",
"calibration_n": 640,
"coverage_ci": [0.874, 0.924],
"profile_version": 1,
"stats_version": "cci-sdk/0.1.1+hosted.1"
}
}
}Levels are indexed from 0 in the order you list them; legend maps each
index back to its name, and levels names the two ends of the interval.
How it differs from a plain probability-weighted score
A probability-weighted average across rubric levels can land between
levels with no stated error bound on where the true rating falls.
Interval instead conformalizes the model’s probabilities over the
levels, so intervals produced this way contain the true rating at least
of the time over exchangeable inputs, calibrated on your own
labelled examples. Two methods:
method | How the interval is built | Where |
|---|---|---|
ordinal-aps (default) | An adaptive-prediction-set score over the ordered levels, grown into a contiguous range | Hosted service and local mode |
CQR | Conformalized quantile regression on the model’s distribution over level indices: take its and quantiles and , score each calibration example with true level by , and widen the quantile range by the conformal quantile of those scores: , clipped to the levels | Hosted service |
CQR adapts the width to how spread out the model’s own distribution is, so
confident ratings get narrow intervals and ambiguous ones wide intervals;
ordinal-aps is the default because it needs no assumption about the
shape of that distribution. Both carry the same coverage guarantee. The
offline engine’s
cli_sdk.stats.conformal.cqr
is CQR for continuous predictions.
Answer attributes
| Attribute | Type | Meaning |
|---|---|---|
interval | tuple | The conformalized interval, in level indices |
point_estimate | float | The point estimate |
legend | dict[str, str] | Level index (as a string) to level name |
width | float | interval[1] - interval[0] |
contains(value) | bool | Whether value lies in the closed interval |
guarantee, is_heuristic | The guarantee card, and whether it is heuristic |
Parameters
| Parameter | Type | Description |
|---|---|---|
instructions | str | dict | list | Required. What to rate. |
levels | list[str] | Required. Ordered rubric levels, 2 to 10 entries. |
calibration_profile | str | Required. |
alpha | float, optional | Target miscoverage rate. |
method | "CQR" | "ordinal-aps", optional | Default "ordinal-aps". CQR is available on the hosted service. |