: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(aio): remove numeric and categorical evaluation flags (#117001)
Bernat Torresb9a97e54adbf
diff --git a/docs/internal/ai-observability-judge-inputs.md b/docs/internal/ai-observability-judge-inputs.mdindex 54bf6e394ab8..2e65a4f83674 100644--- a/docs/internal/ai-observability-judge-inputs.md+++ b/docs/internal/ai-observability-judge-inputs.md@@ -170,13 +170,11 @@ N/A and skipped numeric runs omit the score, while zero remains a graded result.Separate properties preserve the existing boolean property's type and saved queries.The numeric property uses normal numeric inference and can be aggregated in Insights.Numeric queries use `toFloat(properties.$ai_evaluation_numeric_result)` to also handle properties whose metadata has not been registered yet.-No property-definition migration is required before enabling `llm-analytics-numeric-evaluations`.+No property-definition migration is required for numeric evaluations.## Categorical outputsHog and LLM judge evaluations support categorical output for generation, trace, and session targets.-Creation is gated by `llm-analytics-categorical-evaluations`, disabled by default, in the API and frontend.-Existing evaluations remain editable and continue running when the flag is off.The output configuration defines `options` as `{key, label}` pairs, `selection_mode` as `single` or `multiple`, and optional `allows_na`.Each evaluation supports 1 to 100 categories, enforced by the API and editor.diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex e091db53ea9c..9e76c4a43abf 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -386,12 +386,10 @@ export const FEATURE_FLAGS = {LEGACY_OAUTH_RECONNECT_WARNING: 'legacy-oauth-reconnect-warning', // owner: @jabahamondes #team-web-analytics — kill-switch for the retiring-OAuth-app reconnect bannerLIVE_EVENTS_RICH_FILTERS: 'live-events-rich-filters', // owner: @jordanm-posthog #team-web-analyticsLIVESTREAM_HOGQL: 'livestream-hogql', // owner: @benjackwhite #team-replay, swaps livestream service calls for HogQL queries- LLM_ANALYTICS_CATEGORICAL_EVALS: 'llm-analytics-categorical-evaluations', // owner: #team-ai-observabilityLLM_ANALYTICS_CLUSTERING_ADMIN: 'llm-analytics-clustering-admin', // owner: #team-ai-observabilityLLM_ANALYTICS_COMMUNITY_SKILLS: 'llm-analytics-community-skills', // owner: #team-ai-observabilityLLM_ANALYTICS_DATASETS: 'llm-analytics-datasets', // owner: #team-ai-observability #team-posthog-aiLLM_ANALYTICS_EVAL_SETTLING_STRATEGY: 'llm-analytics-eval-settling-strategy', // owner: #team-ai-observability- LLM_ANALYTICS_NUMERIC_EVALS: 'llm-analytics-numeric-evaluations', // owner: #team-ai-observabilityLLM_ANALYTICS_SYSTEM_ONE_EVALUATIONS: 'llm-analytics-system-one-evaluations', // owner: #team-ai-observabilityLLM_ANALYTICS_TAGS: 'llm-analytics-tags', // owner: #team-ai-observabilityLLM_ANALYTICS_TRACE_NAVIGATION: 'llm-analytics-trace-navigation', // owner: #team-ai-observabilitydiff --git a/products/ai_observability/backend/api/evaluations.py b/products/ai_observability/backend/api/evaluations.pyindex 251209b65afe..3f60f94a6646 100644--- a/products/ai_observability/backend/api/evaluations.py+++ b/products/ai_observability/backend/api/evaluations.py@@ -30,7 +30,7 @@ from posthog.event_usage import report_user_actionfrom posthog.hogql_queries.ai.ai_table_resolver import AIEventsUnavailableError, query_ai_eventsfrom posthog.hogql_queries.ai.utils import HEAVY_COLUMN_NAMES, merge_heavy_propertiesfrom posthog.models.team import Team-from posthog.permissions import AccessControlPermission, posthog_feature_flag_enabled+from posthog.permissions import AccessControlPermissionfrom posthog.temporal.ai_observability.eval_reports.output_types import get_outcome_definitionfrom posthog.temporal.ai_observability.message_utils import extract_text_from_messagesfrom posthog.temporal.ai_observability.model_resolution import active_key_fallback@@ -89,28 +89,6 @@ if TYPE_CHECKING:logger = structlog.get_logger(__name__)-NUMERIC_EVALUATIONS_FEATURE_FLAG = "llm-analytics-numeric-evaluations"-CATEGORICAL_EVALUATIONS_FEATURE_FLAG = "llm-analytics-categorical-evaluations"---def _evaluation_output_enabled(serializer: serializers.BaseSerializer, flag_key: str) -> bool:- request = serializer.context.get("request")- get_team = serializer.context.get("get_team")- user = getattr(request, "user", None)- if user is None or not getattr(user, "is_authenticated", False) or not callable(get_team):- return False-- team = get_team()- try:- return posthog_feature_flag_enabled(- flag_key,- str(user.distinct_id),- organization_id=team.organization_id,- team_id=team.id,- )- except Exception:- return False-@extend_schema_field({@@ -568,18 +546,6 @@ class EvaluationSerializer(UserAccessControlSerializerMixin, serializers.ModelSedef validate(self, data):evaluation_type = data.get("evaluation_type") or getattr(self.instance, "evaluation_type", None)output_type = data.get("output_type") or getattr(self.instance, "output_type", None)- flag_key = {- "numeric": NUMERIC_EVALUATIONS_FEATURE_FLAG,- "categorical": CATEGORICAL_EVALUATIONS_FEATURE_FLAG,- }.get(str(output_type))- if (- flag_key- and (self.instance is None or self.instance.output_type != output_type)- and not _evaluation_output_enabled(self, flag_key)- ):- raise serializers.ValidationError(- {"output_type": f"{str(output_type).capitalize()} evaluations are not enabled for this project."}- )if (self.instanceand output_type != self.instance.output_typediff --git a/products/ai_observability/backend/api/test/test_evaluations.py b/products/ai_observability/backend/api/test/test_evaluations.pyindex 743da16ea3cf..fd6ed8e977fa 100644--- a/products/ai_observability/backend/api/test/test_evaluations.py+++ b/products/ai_observability/backend/api/test/test_evaluations.py@@ -272,54 +272,6 @@ class TestTargetConfigFieldSchema(SimpleTestCase):class TestEvaluationConfigsApi(APIBaseTest):- @parameterized.expand(- [("numeric", {"min": 0, "max": 10}), ("categorical", {"options": [{"key": "resolved", "label": "Resolved"}]})]- )- @patch("products.ai_observability.backend.api.evaluations.posthog_feature_flag_enabled", return_value=False)- def test_creation_requires_feature_flag(- self, output_type: str, output_config: dict, _mock_numeric_flag: Mock- ) -> None:- response = self.client.post(- f"/api/environments/{self.team.id}/evaluations/",- {- "name": "Gated score",- "evaluation_type": "hog",- "evaluation_config": {"source": "return 0;"},- "output_type": output_type,- "output_config": output_config,- },- format="json",- )-- self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)- self.assertIn(f"{output_type.capitalize()} evaluations are not enabled", str(response.data))-- @parameterized.expand(- [("numeric", {"min": 0, "max": 10}), ("categorical", {"options": [{"key": "resolved", "label": "Resolved"}]})]- )- @patch("products.ai_observability.backend.api.evaluations.posthog_feature_flag_enabled", return_value=False)- def test_existing_evaluation_remains_editable_when_flag_is_off(- self, output_type: str, output_config: dict, _mock_numeric_flag: Mock- ) -> None:- evaluation = Evaluation.objects.create(- team=self.team,- name="Existing score",- evaluation_type="hog",- evaluation_config={"source": "return 0;"},- output_type=output_type,- output_config=output_config,- )-- response = self.client.patch(- f"/api/environments/{self.team.id}/evaluations/{evaluation.id}/",- {"name": "Renamed score"},- format="json",- )-- self.assertEqual(response.status_code, status.HTTP_200_OK, response.json())- evaluation.refresh_from_db()- self.assertEqual(evaluation.name, "Renamed score")-@parameterized.expand([(output_type, enabled, frequency)@@ -327,9 +279,8 @@ class TestEvaluationConfigsApi(APIBaseTest):for enabled, frequency in [(True, "scheduled"), (False, "scheduled"), (True, "every_n")]])- @patch("products.ai_observability.backend.api.evaluations.posthog_feature_flag_enabled", return_value=True)def test_passing_rule_controls_report_creation_and_scheduling(- self, output_type: str, enabled: bool, frequency: str, _mock_numeric_flag: Mock+ self, output_type: str, enabled: bool, frequency: str) -> None:output_config = ({"min": 0, "max": 10}diff --git a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsxindex d9127bfa7721..1c1a3c0196ca 100644--- a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx+++ b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx@@ -102,7 +102,6 @@ export function AIObservabilityEvaluation(): JSX.Element {} = useValues(llmEvaluationLogic)const { searchParams } = useValues(router)const { featureFlags } = useValues(featureFlagLogic)- const numericEvaluationsEnabled = !!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_NUMERIC_EVALS]const settlingStrategyEnabled = !!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_EVAL_SETTLING_STRATEGY]const {setEvaluationName,@@ -120,7 +119,6 @@ export function AIObservabilityEvaluation(): JSX.Element {patchTargetConfig,setActiveTab,} = useActions(llmEvaluationLogic)- const categoricalEvaluationsEnabled = !!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_CATEGORICAL_EVALS]const { push } = useActions(router)const triggersRef = useRef<HTMLDivElement>(null)const settingsUrl = combineUrl(urls.aiObservabilityEvaluations(), { ...searchParams, tab: 'settings' }).url@@ -713,22 +711,8 @@ export function AIObservabilityEvaluation(): JSX.Element {value={evaluation.output_type}options={[{ value: 'boolean', label: 'Boolean' },- {- value: 'categorical',- label: 'Categorical',- disabledReason:- isNewEvaluation && !categoricalEvaluationsEnabled- ? 'Categorical evaluations are not enabled for this project.'- : undefined,- },- {- value: 'numeric',- label: 'Numeric score',- disabledReason:- isNewEvaluation && !numericEvaluationsEnabled- ? 'Numeric evaluations are not enabled for this project.'- : undefined,- },+ { value: 'categorical', label: 'Categorical' },+ { value: 'numeric', label: 'Numeric score' },]}onChange={(value) =>setOutputType(diff --git a/products/ai_observability/skills/creating-online-evaluations/references/evaluation-payload.md.j2 b/products/ai_observability/skills/creating-online-evaluations/references/evaluation-payload.md.j2index 554fe8585936..9fdb5a602fcd 100644--- a/products/ai_observability/skills/creating-online-evaluations/references/evaluation-payload.md.j2+++ b/products/ai_observability/skills/creating-online-evaluations/references/evaluation-payload.md.j2@@ -22,7 +22,6 @@ schemas below are rendered from the backend Pydantic models at build time, so thValid `(evaluation_type, output_type)` pairs: `(hog, boolean)`, `(llm_judge, boolean)`,`(hog, numeric)`, `(llm_judge, numeric)`, `(sentiment, sentiment)`.The output type cannot change after creation.-Numeric evaluations require the `llm-analytics-numeric-evaluations` rollout flag for the project. Existing numeric evaluations remain editable when it is off.## `target` and `target_config`