Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

768 B
Raw Blame
from pydantic import BaseModel, Field

from products.alerts.backend.judge.contract import AnomalyKind


class LLMDetectionVerdict(BaseModel):
    """The structured output the model must return about the current point of one series."""

    is_anomaly: bool = Field(
        description="True only if the current point genuinely warrants a person's attention, given its history."
    )
    kind: AnomalyKind = Field(
        description="The shape of what the current point shows. Use 'none' when is_anomaly is false."
    )
    rationale: str = Field(
        description=(
            "One or two plain sentences about the current point: what you saw and why it is or isn't unusual. "
            "This is shown to the person who receives the alert."
        )
    )