feat: publish unblended AI-plan effectiveness series

Report booked cost, entitlement, token coverage, and work as three
series: work per measured token, work per measured+estimated token,
and work per euro. Months below 50% coverage are unfit for token
trends. There is no blended efficiency number.
This commit is contained in:
tegwick 2026-08-15 19:53:28 +02:00
parent ee90ba2873
commit 033ad3f41f
12 changed files with 512 additions and 6 deletions

View file

@ -0,0 +1,34 @@
"""Read schema for the AI-plan effectiveness surface."""
from __future__ import annotations
from pydantic import BaseModel, ConfigDict
class EffectivenessRead(BaseModel):
model_config = ConfigDict(extra="forbid")
period_month: str
provider: str
provider_account: str | None
plan: str
currency: str | None
booked_amount: str | None
entitled_quantity: str | None
entitled_unknown: bool
plan_label: str | None
tokens_measured: int | None
tokens_estimated: int | None
tokens_unknown: bool
coverage: str | None
coverage_threshold: str
trend_fit: str
implied_eur_per_measured_token: str | None
implied_eur_per_measured_estimated_token: str | None
implied_basis: str
work_count: int | None
work_unit: str | None
work_per_measured_token: str | None
work_per_measured_estimated_token: str | None
work_per_euro: str | None
token_join: str

View file

@ -36,6 +36,14 @@ class SessionTokenSlice(BaseModel):
return value
class SessionTokenWork(BaseModel):
model_config = ConfigDict(extra="forbid")
unit: Literal["task", "outcome"] = "task"
count: int = Field(ge=0)
source: str = Field(min_length=1)
class SessionTokenAssociation(BaseModel):
model_config = ConfigDict(extra="forbid")
@ -64,6 +72,7 @@ class SessionTokenEvidence(BaseModel):
source_evidence: list[str] = Field(min_length=1)
totals: dict[str, SessionTokenSlice] = Field(default_factory=dict)
associations: list[SessionTokenAssociation] = Field(default_factory=list)
work: SessionTokenWork | None = None
@field_validator("totals")
@classmethod