: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
fix(aio): tidy the evals overview and evaluation page (#123719)
Bernat Torres8108e537c395
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex d79d3e56987f..cce6e2c3c29d 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -9037,9 +9037,9 @@ snapshots:scenes-app-ai-observability-evaluations-overview--directory-open--light:hash: v1.k794b7964.76820f10ccf488b27e0905c7bad9dd2891737b4a4e5fa7cd88121d163cd67080.WVgilucVDuLKEEUvDcyzOPGkFFvzXe40TmaEyVoJJngscenes-app-ai-observability-evaluations-overview--drawer-categories--dark:- hash: v1.k794b7964.2751a7dc2b2ecef1a9997c81538fcc0decf3139c34046242d3e2585bd444f63a.9zxXlH-IBm8sauT3BPDaDzMS844pcFQXLWHdn-KKOrY+ hash: v1.k794b7964.833c9ec088f5ced0b6349de96401cea531c80532b1ccab3e0ede6280075fd177.g5BobVDmlWFirkzQXWggOgdaGlZTyzgXsFSsl3wXnNUscenes-app-ai-observability-evaluations-overview--drawer-categories--light:- hash: v1.k794b7964.e5529a7d9b07832652be4731a9a5d46bd6a85f153818f7b62b7a7cb5c508de24.tCWHn2WgdZeW-MTL9kHgXVzEWzUzAAkocokrLaKaeW8+ hash: v1.k794b7964.bc7f0d4f7a4eaef7ecf8f8b62cfb879294d2844e856de264ba499a995d638bcb._YBpi1OPAd5HQqHxeTkTxBuCr3090LVXixCm3cMTVGQscenes-app-ai-observability-evaluations-overview--drawer-empty-disabled--dark:hash: v1.k794b7964.7de3916414d975768f14847157679565558e99c7ac9b75d849ffdf754be78401.VUL4gYDHiOk8Ii6VYTrKxtlsyLBwwPzkaNjLNFKWcdAscenes-app-ai-observability-evaluations-overview--drawer-empty-disabled--light:@@ -9053,17 +9053,17 @@ snapshots:scenes-app-ai-observability-evaluations-overview--drawer-empty-errored--light:hash: v1.k794b7964.a0a3b37ec30366fad6ddc1ee8b2341aaef91dd14860e3015805ce50e16c2d687.vsCMotdO-txIgRF6ZOPV1WCd09ltBeMXSyHyxjSaIz8scenes-app-ai-observability-evaluations-overview--drawer-pass-rate--dark:- hash: v1.k794b7964.8b6d5eb9a8bdfdb1ea96801c8cd6c15d73cdc84c1620d5a956f8471430a091dd.DU5SjM3utBRWnAbCkcdkXtxyJBxsXkpWHMM6tHa45ug+ hash: v1.k794b7964.338a65fdf80c494f4c0bb14cbb394493accab1ead6d57f4334419ff70e312166.LsHX79e2LcxsjZepYXH0dROrSlc28Y214VvdTum_zkIscenes-app-ai-observability-evaluations-overview--drawer-pass-rate--light:- hash: v1.k794b7964.3301f8b262ab7ad9c6ffb100af74cd0383074d1575d4c5347bd7074c2f5bd5a3.CSCdA9Kznnr48dmyG7IZUHy8rdOymEDmj0SA0S9pmX8+ hash: v1.k794b7964.8629ca843e0589c5dd4b1457baea907511013f39a2ed42fa97a678d493710d9f.1e6I8pl3FgbYIPgEqzYpmZkW96r7y6N5ii0uKo0sf7gscenes-app-ai-observability-evaluations-overview--drawer-score--dark:- hash: v1.k794b7964.f02669bb52503daa7e26735e524990297ddfb3b8507a8df44c31b21d75e1f11b.WQ5dYoXd6e5tJxxsLJ3r7ae2jxWlq71bD2mE_MxTOvc+ hash: v1.k794b7964.053969fd2ca12903073c6e72757051c7ba95a1f7f7975f837e8d485339fc47fb.HBvwpYIW0D7hayu-EIhuw_x1Zwgksif80XFrt7MNExAscenes-app-ai-observability-evaluations-overview--drawer-score--light:- hash: v1.k794b7964.37a2df3849a1db3ee38f14f2feb2fc33549e92d2ab5b6cc7dbcb09319f18ee9e.0AyqfgEssd9KMXrVcITTNuczbwlZ6ztpWZNQX4TtZkQ+ hash: v1.k794b7964.1054c1259b718c56fc952efb7c05566d8e6a6b8276fdccb55039ea2f10c55183.X7d7tz6c6mo07nN9hKgFnB4HvCEmQ8-2v2PpZ1McI4Escenes-app-ai-observability-evaluations-overview--drawer-sentiment--dark:- hash: v1.k794b7964.389f61404f341a657efc13070045bd18f0cec3db034e587aceb96f40b33957b4.5VKTQskn9q06Up3zwAHoejr6qPrS-PfB0uVu6lPoPwk+ hash: v1.k794b7964.e5172bf8b3bc693e71512452904fcf3cd26431ac11312a63c42b85181bebe4b1.wjR_IxYD_1S6XDEz3mgEajeCYSje3TnIPS7hCh0D_tsscenes-app-ai-observability-evaluations-overview--drawer-sentiment--light:- hash: v1.k794b7964.c5e5fc37526a1697de0d191dba33ac8689b0dc872b408e7b30b45c0ec744fa39.D_gGiv0LcUzZlevXVCq0re9QCz6c-vEg1Q8E0Pw8DZ8+ hash: v1.k794b7964.1dcd8c708d2896cf51abdefb8e953869986df3c3c329e204d860d3cf4296c0e7.lELtcnQIt5ZqwXeqMXNm7Rd-iexljTfywGkRz0jT96oscenes-app-ai-observability-evaluations-overview--many-evaluations--dark:hash: v1.k794b7964.217c7fb285b2538e867684455d6a6f47168acc21beb2526dbb7d6ce3676e5801.97AUffXw8nnPAz3QLYb4WWMqVJdCf48Vsd-o2zEp6Xwscenes-app-ai-observability-evaluations-overview--many-evaluations--light:diff --git a/products/ai_observability/frontend/components/EvaluationExplanation.tsx b/products/ai_observability/frontend/components/EvaluationExplanation.tsxindex 9cebc004cd3c..aefd58d763a5 100644--- a/products/ai_observability/frontend/components/EvaluationExplanation.tsx+++ b/products/ai_observability/frontend/components/EvaluationExplanation.tsx@@ -1,3 +1,5 @@+import { useState } from 'react'+import { Tooltip } from '@posthog/lemon-ui'export function EvaluationExplanation({@@ -7,6 +9,7 @@ export function EvaluationExplanation({reasoning?: stringprobability?: number | null}): JSX.Element {+ const [expanded, setExpanded] = useState(false)if (probability != null) {return (<Tooltip title="The judge's estimated probability that the evaluation criteria are true. This result has no written reasoning.">@@ -14,11 +17,19 @@ export function EvaluationExplanation({</Tooltip>)}+ if (!reasoning) {+ return <div className="text-sm text-secondary">No reasoning provided</div>+ }return (- <Tooltip title={reasoning}>- <div className="max-w-md cursor-default">- <div className="text-sm text-default line-clamp-2">{reasoning || 'No reasoning provided'}</div>- </div>- </Tooltip>+ <button+ type="button"+ className="block max-w-2xl text-left text-sm text-default cursor-pointer"+ aria-expanded={expanded}+ title={expanded ? 'Click to collapse' : 'Click to read all'}+ onClick={() => setExpanded(!expanded)}+ data-attr="llma-evaluation-explanation-toggle"+ >+ <span className={expanded ? 'whitespace-pre-wrap' : 'line-clamp-2'}>{reasoning}</span>+ </button>)}diff --git a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsxindex 1d248a5f9ab7..2fb64bc8b812 100644--- a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx+++ b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx@@ -250,7 +250,7 @@ export function AIObservabilityEvaluation(): JSX.Element {]return (- <div className="@container/evaluation min-w-0 space-y-6">+ <div className="@container/evaluation min-w-0 space-y-6 pb-8"><SceneBreadcrumbBackButton />{/* Header */}<SceneStickyBar@@ -370,12 +370,8 @@ export function AIObservabilityEvaluation(): JSX.Element {'data-attr': 'llma-evaluation-runs-tab',content: (<div className="max-w-6xl">- <div className="flex flex-wrap gap-4 justify-between items-center mb-4">+ <div className="flex flex-wrap gap-4 justify-between items-start mb-4"><div className="min-w-0">- <p className="text-muted text-sm m-0">- History of when this evaluation has been executed.- </p>-{isReportableEvaluation && (<EvaluationReportsCalloutevaluationId={evaluation.id}diff --git a/products/ai_observability/frontend/evaluations/components/EvaluationReportsCallout.tsx b/products/ai_observability/frontend/evaluations/components/EvaluationReportsCallout.tsxindex 61d45b498e94..b216768264d9 100644--- a/products/ai_observability/frontend/evaluations/components/EvaluationReportsCallout.tsx+++ b/products/ai_observability/frontend/evaluations/components/EvaluationReportsCallout.tsx@@ -21,7 +21,7 @@ export function EvaluationReportsCallout({}return (- <div className="mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm">+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm"><span className="text-muted">Evaluation reports analyze these runs and send results by email or Slack.</span>diff --git a/products/ai_observability/frontend/evaluations/components/EvaluationRunsTable.tsx b/products/ai_observability/frontend/evaluations/components/EvaluationRunsTable.tsxindex 00025325db83..7d4f52f8cf3a 100644--- a/products/ai_observability/frontend/evaluations/components/EvaluationRunsTable.tsx+++ b/products/ai_observability/frontend/evaluations/components/EvaluationRunsTable.tsx@@ -10,7 +10,7 @@ import { EvaluationExplanation } from '../../components/EvaluationExplanation'import { EvaluationResultTag, compareEvaluationResults } from '../../components/EvaluationResultTag'import { EvaluationRunTargetCell } from '../../components/EvaluationRunTargetCell'import { EvaluationRunTimestampCell } from '../../components/EvaluationRunTimestampCell'-import { EVALUATION_RUNS_QUERY_LIMIT, evaluationIsDetector } from '../constants'+import { evaluationIsDetector } from '../constants'import { evaluationSupportsRunOutcomes } from '../evaluationCapabilities'import { llmEvaluationLogic } from '../llmEvaluationLogic'import { EvaluationRun, EvaluationRunsFilter, SentimentEvaluationRunsFilter } from '../types'@@ -169,29 +169,30 @@ export function EvaluationRunsTable(): JSX.Element {) : null}</div><div className="flex flex-wrap items-center gap-2">- {(evaluationRunsHasMore || evaluationRuns.length > EVALUATION_RUNS_QUERY_LIMIT) &&- !evaluationRunsError && (- <>- <span className="text-muted text-sm">- {!evaluationRunsHasMore- ? `Showing all ${evaluationRuns.length.toLocaleString()} runs.`- : matchingRunsTotal && matchingRunsTotal > evaluationRuns.length- ? `Showing the latest ${evaluationRuns.length.toLocaleString()} of ${matchingRunsTotal.toLocaleString()} runs.`- : `Showing the latest ${evaluationRuns.length.toLocaleString()} runs.`}- </span>- {evaluationRunsHasMore && (- <LemonButton- type="secondary"- size="small"- onClick={() => loadOlderEvaluationRuns()}- loading={evaluationRunsLoading}- data-attr="llma-evaluation-runs-load-older"- >- Load older runs- </LemonButton>- )}- </>- )}+ {evaluationRuns.length > 0 && !evaluationRunsError && (+ <>+ <span className="text-muted text-sm">+ {!evaluationRunsHasMore+ ? evaluationRuns.length === 1+ ? 'Showing 1 run.'+ : `Showing all ${evaluationRuns.length.toLocaleString()} runs.`+ : matchingRunsTotal && matchingRunsTotal > evaluationRuns.length+ ? `Showing the latest ${evaluationRuns.length.toLocaleString()} of ${matchingRunsTotal.toLocaleString()} runs.`+ : `Showing the latest ${evaluationRuns.length.toLocaleString()} runs.`}+ </span>+ {evaluationRunsHasMore && (+ <LemonButton+ type="secondary"+ size="small"+ onClick={() => loadOlderEvaluationRuns()}+ loading={evaluationRunsLoading}+ data-attr="llma-evaluation-runs-load-older"+ >+ Load older runs+ </LemonButton>+ )}+ </>+ )}<LemonButtontype="secondary"icon={<IconRefresh />}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationDirectoryTile.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationDirectoryTile.tsxindex 5c42e32d7b41..86e59e3bdc92 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationDirectoryTile.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationDirectoryTile.tsx@@ -41,12 +41,10 @@ export function EvaluationDirectoryTile({ tile, selected }: { tile: DirectoryTil</span><span className="flex flex-col min-w-0"><span className="font-semibold truncate">{directory.name}</span>- <span className="text-xs text-secondary">- <span>{pluralize(evaluationCount, 'evaluation')}</span>- {needAttentionCount ? (- <span className="text-danger">{` · ${needAttentionCount} need attention`}</span>- ) : null}- </span>+ <span className="text-xs text-secondary">{pluralize(evaluationCount, 'evaluation')}</span>+ {needAttentionCount ? (+ <span className="text-xs text-danger">{`${needAttentionCount} need attention`}</span>+ ) : null}</span></button><div className="absolute right-1 top-1/2 -translate-y-1/2">diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationResultCards.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationResultCards.tsxindex 3cd57c65b1d1..9db14367ef9d 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationResultCards.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationResultCards.tsx@@ -65,7 +65,7 @@ export function EvaluationResultCards({return (<div className="@container">- <div className="grid gap-3 grid-cols-1 @2xl:grid-cols-2">+ <div className="grid gap-3 grid-cols-1 @2xl:grid-cols-2 items-start"><Card title="Over time" action={chartAction} className="@2xl:col-span-2"><EvaluationResultTrendChartrow={row}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationResultCell.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationResultCell.tsxindex a1f278bf1246..cfcdf0e9345d 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationResultCell.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationResultCell.tsx@@ -20,9 +20,11 @@ export function EvaluationResultCell({ row }: { row: EvaluationResultApi }): JSX<div className="text-sm @3xl:text-base font-semibold">{resultHeadline(row)}</div><div className="text-xs text-secondary">{resultEvidence(row)}</div>{/* The trend column hides on a narrow table, so the change shows here instead. */}- <div className="text-xs mt-0.5 @min-[32.5rem]:hidden">- <EvaluationResultChange row={row} />- </div>+ {row.change && (+ <div className="text-xs mt-0.5 @min-[32.5rem]:hidden">+ <EvaluationResultChange row={row} />+ </div>+ )}</div>)return row.lowEvidence ? (diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationResultChange.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationResultChange.tsxindex 55455becc3f7..208e20e5db64 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationResultChange.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationResultChange.tsx@@ -3,22 +3,21 @@ import { Tooltip } from '@posthog/lemon-ui'import type { EvaluationResultApi } from '../../generated/api.schemas'-export function EvaluationResultChange({ row }: { row: EvaluationResultApi }): JSX.Element {+/** Why a row shows no change against the previous period. */+export function noChangeReason(row: EvaluationResultApi): string {+ return row.gradedCount === 0+ ? 'No graded results in this range.'+ : row.lowEvidence+ ? 'Too few graded results to compare.'+ : row.previousGradedCount+ ? 'Too few graded results in the previous period to compare.'+ : 'No results in the previous period.'+}++export function EvaluationResultChange({ row }: { row: EvaluationResultApi }): JSX.Element | null {const { change } = rowif (!change) {- const reason =- row.gradedCount === 0- ? 'No graded results in this range.'- : row.lowEvidence- ? 'Too few graded results to compare.'- : row.previousGradedCount- ? 'Too few graded results in the previous period to compare.'- : 'No results in the previous period.'- return (- <Tooltip title={reason}>- <span className="text-secondary">-</span>- </Tooltip>- )+ return null}// A change is not good or bad on its own, so it stays neutral. The attention tags say when it is worse.const Icon = change.value > 0 ? IconArrowUpRight : change.value < 0 ? IconArrowRightDown : nulldiff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationResultOutcomes.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationResultOutcomes.tsxindex 3963e99a944b..2abea8681c67 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationResultOutcomes.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationResultOutcomes.tsx@@ -56,11 +56,11 @@ export function EvaluationResultOutcomes({</span>))}</div>- <div className="text-xs text-secondary">- {outside.length > 0- ? `Not in the rate: ${outside.map(([label, count]) => `${humanFriendlyNumber(count)} ${label}`).join(' · ')}`- : 'Every graded run counts toward the rate.'}- </div>+ {outside.length > 0 && (+ <div className="text-xs text-secondary">+ {`Not in the rate: ${outside.map(([label, count]) => `${humanFriendlyNumber(count)} ${label}`).join(' · ')}`}+ </div>+ )}</>)}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendCell.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendCell.tsxindex 241a0204660e..0238424dba33 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendCell.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendCell.tsx@@ -1,5 +1,7 @@+import { Tooltip } from '@posthog/lemon-ui'+import type { EvaluationResultApi } from '../../generated/api.schemas'-import { EvaluationResultChange } from './EvaluationResultChange'+import { EvaluationResultChange, noChangeReason } from './EvaluationResultChange'import { EvaluationResultMiniChart } from './EvaluationResultMiniChart'export function EvaluationResultTrendCell({@@ -14,10 +16,17 @@ export function EvaluationResultTrendCell({}return (<div className="w-32 @3xl:w-44 flex flex-col gap-1">- <div className="text-xs">- <EvaluationResultChange row={row} />- </div>- <EvaluationResultMiniChart row={row} buckets={buckets} />+ {row.change && (+ <div className="text-xs">+ <EvaluationResultChange row={row} />+ </div>+ )}+ {/* Without a change line, the chart carries the reason there is none. */}+ <Tooltip title={row.change ? undefined : noChangeReason(row)}>+ <div>+ <EvaluationResultMiniChart row={row} buckets={buckets} />+ </div>+ </Tooltip></div>)}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsxindex 3f19d4588efe..ccbad613e8a5 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsx@@ -17,6 +17,8 @@ import {trackedCategory,} from './evaluationOverviewDisplay'+// The volume axis is hidden, so the chart needs no room for labels on the right.+const CHART_MARGINS = { right: 16 }const VOLUME_KEY = 'volume'const PASSED_KEY = 'passed'const FAILED_KEY = 'failed'@@ -164,6 +166,7 @@ export function EvaluationResultTrendChart({{ id: VOLUME_KEY, position: 'right', hide: true },],valueDomain: isScore ? (scale ? { min: scale.min, max: scale.max } : undefined) : { min: floor, max: 100 },+ margins: CHART_MARGINS,}}, [isScore, summary, values, timezone, interval, breakdown])diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationScopePicker.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationScopePicker.tsxindex 51f0bf2ec220..f3968d092cbf 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationScopePicker.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationScopePicker.tsx@@ -1,8 +1,7 @@import { useActions, useValues } from 'kea'import { useState } from 'react'-import { IconSearch } from '@posthog/icons'-import { LemonButton, LemonCheckbox, LemonDropdown, LemonInput } from '@posthog/lemon-ui'+import { LemonButton, LemonCheckbox, LemonDivider, LemonDropdown, LemonInput } from '@posthog/lemon-ui'import { pluralize } from 'lib/utils/strings'@@ -23,17 +22,17 @@ export function EvaluationScopePicker(): JSX.Element {<LemonDropdowncloseOnClickInside={false}overlay={- <div className="flex flex-col gap-1 w-72 max-h-96">+ <div className="flex flex-col w-72 max-h-96"><LemonInputtype="search"size="small"+ fullWidthautoFocus- prefix={<IconSearch />}placeholder="Search evaluations"value={search}onChange={setSearch}/>- <div className="flex flex-col overflow-y-auto">+ <div className="flex flex-col overflow-y-auto mt-1">{matching.length === 0 ? (<div className="px-2 py-1 text-secondary">No evaluations match this search</div>) : (@@ -51,15 +50,17 @@ export function EvaluationScopePicker(): JSX.Element {)}</div>{pickedIds.length > 0 && (- <LemonButton- size="small"- fullWidth- center- onClick={() => setPickedIds([])}- data-attr="evaluation-overview-scope-clear"- >- Show all evaluations- </LemonButton>+ <>+ <LemonDivider className="my-1" />+ <LemonButton+ size="small"+ fullWidth+ onClick={() => setPickedIds([])}+ data-attr="evaluation-overview-scope-clear"+ >+ Show all evaluations+ </LemonButton>+ </>)}</div>}