: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
feat(aio): fold the evals overview into one results card (#123317)
Bernat Torres22e6bddb84b2
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex eb7c6f8d1d21..ff89099bb725 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -8993,57 +8993,57 @@ snapshots:scenes-app-ai-observability-evaluations-onboarding--no-online-evaluations--light:hash: v1.k794b7964.1dbea4bbbd7b0731b841cfdf0dc28826e9bba9caf9735cc7257e0fc4e0a67026.ezM9M-EOjWsTZXJk602I44gvDXvOzobiHJq09E0OEacscenes-app-ai-observability-evaluations-overview--directory-open--dark:- hash: v1.k794b7964.cb88d8783a0c7ab63525f13c5aafbdddcb35a5448c12a774c8465122228257d5.vVBMLgF2jQd6tJ_DlQjocyXVoe4XtpNjDKGijdEz8oU+ hash: v1.k794b7964.aa11f061ae0ad10fe341206b1223e0a608df0286d2c5d283b54696d4e21a3f97.jl6VVZGQDVDqUkvv3N-uFqifk4b-MykizHrmyhgG_zcscenes-app-ai-observability-evaluations-overview--directory-open--light:- hash: v1.k794b7964.c9ec46ad37a56b9b6452a26a91c958b57896de6a10f176c7a17bb379068a6b1c.BqQx9mi7aDofnP8isJ9I4NDv5e7N0bXfqDgs0X0g1ZE+ hash: v1.k794b7964.76820f10ccf488b27e0905c7bad9dd2891737b4a4e5fa7cd88121d163cd67080.WVgilucVDuLKEEUvDcyzOPGkFFvzXe40TmaEyVoJJngscenes-app-ai-observability-evaluations-overview--drawer-categories--dark:- hash: v1.k794b7964.4cabff23a255eb480b2552eaed88a2b4246810bcfff9395dfca593acc8fe9edd.sQaiXQclGUKel63G3sDb5trGxWS7mYXJmwP11Zxb_-g+ hash: v1.k794b7964.2751a7dc2b2ecef1a9997c81538fcc0decf3139c34046242d3e2585bd444f63a.9zxXlH-IBm8sauT3BPDaDzMS844pcFQXLWHdn-KKOrYscenes-app-ai-observability-evaluations-overview--drawer-categories--light:- hash: v1.k794b7964.fbf879ba63125470a86901970419cfa3c201288ad3253258c125cf15efd4a40f.U5VPkQF1GmH7Q7fxWkcutAXXaFnlDuwrN9HGi7dCBg8+ hash: v1.k794b7964.e5529a7d9b07832652be4731a9a5d46bd6a85f153818f7b62b7a7cb5c508de24.tCWHn2WgdZeW-MTL9kHgXVzEWzUzAAkocokrLaKaeW8scenes-app-ai-observability-evaluations-overview--drawer-empty-disabled--dark:- hash: v1.k794b7964.447a7751495e5a6bcd17385767bcba2b8bdc81f02d53eecad34d73cacd840580.kbEQMyBlAG71PNTjmErbPj4RwbEn2yk54Fkbii-hw44+ hash: v1.k794b7964.7de3916414d975768f14847157679565558e99c7ac9b75d849ffdf754be78401.VUL4gYDHiOk8Ii6VYTrKxtlsyLBwwPzkaNjLNFKWcdAscenes-app-ai-observability-evaluations-overview--drawer-empty-disabled--light:- hash: v1.k794b7964.6f140231f4a4b29734b368a4e593a74d19f3b1725cd84353c722be4515a616d8.qUumzeREHGY6StfR8u2U_y5amFAOD0Nv9cXA4p7uLGk+ hash: v1.k794b7964.cbf3fc3daeed93e20270ba78e5c2928f8a71db99e19e38be16ca760c07fcd43f.Rbe8TyAOiBinF4WY1zffPcSFXPv5PaSnXMyTTxsRgTAscenes-app-ai-observability-evaluations-overview--drawer-empty-enabled--dark:- hash: v1.k794b7964.73805cdb88f1006a914063e81575b7e6d335833df06a44c60cc060b41953c5f9.JZEVhh4lYjNn81V9Sc_9CAr3V0_n2Jy5XtnF-v2WeXM+ hash: v1.k794b7964.aa7184c72e72454e93eb3913486bdc8c295a5a2a8aabda3cf566af7d5917d08f.R_OIyIubYv5EgQU__8ZV-O0wNqEp3qQBSvBg30AUtwcscenes-app-ai-observability-evaluations-overview--drawer-empty-enabled--light:- hash: v1.k794b7964.f255b69ad63c46b41655c948366d0d64ef44d53f4000342cc58cb8fccd81b91d.H3lcZdE7MgJCvzIVyKBKrViKTx761pOjLJFaPtXVrOI+ hash: v1.k794b7964.c5d3c557c2451f148ecc57ec3cec957f1b7f9f886712ebb174466fd9e4c4bb40.HOpxeq9U5LXpb1QbF3LUC9AYyk5netaRIatrGIUkk2wscenes-app-ai-observability-evaluations-overview--drawer-empty-errored--dark:- hash: v1.k794b7964.6db2d2de62e9a61caab066053e25b39b40965df38585d350c19f4dad835da44d.a82YqeR5UYL40v85fGps9eUhtsW6sfKTa5srO9pk5J4+ hash: v1.k794b7964.3af08d5f476b419f3e8063e8e49e0a7c9ec7e659c0b7a5680e4a37e862d280a4.irbSSkw1Sl-MHvdClZkXAzFms2Hx7vvNASxfQIcoNJkscenes-app-ai-observability-evaluations-overview--drawer-empty-errored--light:- hash: v1.k794b7964.46ebd323b280383d83502730d0693a7637241c7fe071f470983d0d3c341fd41e.ndXSeiqebpcyhHkc5ui4BJMPkUOxC54H3cc29cFcj90+ hash: v1.k794b7964.a0a3b37ec30366fad6ddc1ee8b2341aaef91dd14860e3015805ce50e16c2d687.vsCMotdO-txIgRF6ZOPV1WCd09ltBeMXSyHyxjSaIz8scenes-app-ai-observability-evaluations-overview--drawer-pass-rate--dark:- hash: v1.k794b7964.c59641eacce51ec3bc0f654e544e11b9b734d4c91343ed43cbd529c1c01e6b0f.skJafCWiaK6Ntu5ozzs0KEGD_AMTu1vs-KnRqM2zIb4+ hash: v1.k794b7964.8b6d5eb9a8bdfdb1ea96801c8cd6c15d73cdc84c1620d5a956f8471430a091dd.DU5SjM3utBRWnAbCkcdkXtxyJBxsXkpWHMM6tHa45ugscenes-app-ai-observability-evaluations-overview--drawer-pass-rate--light:- hash: v1.k794b7964.b872bfa48645d18ab2f8b5b32cacc3607b165d47c19352eef6e9b995416412b3.YvpSYQnvFB58Z3r1lXMdmvXwdyF5tvHsZAzoFhANG1o+ hash: v1.k794b7964.3301f8b262ab7ad9c6ffb100af74cd0383074d1575d4c5347bd7074c2f5bd5a3.CSCdA9Kznnr48dmyG7IZUHy8rdOymEDmj0SA0S9pmX8scenes-app-ai-observability-evaluations-overview--drawer-score--dark:- hash: v1.k794b7964.a724067d973d728e4b200a0c48086adacf1f7dc563fd0d22d4538e659f5ab176.av1tQF4dnvpQuyV--VENrB9aGQaI7hAEAZEtcRvlYC8+ hash: v1.k794b7964.f02669bb52503daa7e26735e524990297ddfb3b8507a8df44c31b21d75e1f11b.WQ5dYoXd6e5tJxxsLJ3r7ae2jxWlq71bD2mE_MxTOvcscenes-app-ai-observability-evaluations-overview--drawer-score--light:- hash: v1.k794b7964.62e77593a1b70279196c11f65882695bd9d78ce5eb4f9aa510094b6d36915442.4fO10Nj_BEMedqqz-9w52lt2gISZlv-NOr5kPFDoGWk+ hash: v1.k794b7964.37a2df3849a1db3ee38f14f2feb2fc33549e92d2ab5b6cc7dbcb09319f18ee9e.0AyqfgEssd9KMXrVcITTNuczbwlZ6ztpWZNQX4TtZkQscenes-app-ai-observability-evaluations-overview--drawer-sentiment--dark:- hash: v1.k794b7964.277ece705e647f0f0228dd7b5349fecfee655ac017388cb7598951b69b2af3d0.R855kqaimlHKt0diuffMtmhXH1tpVDlaGQAppq4F0xI+ hash: v1.k794b7964.389f61404f341a657efc13070045bd18f0cec3db034e587aceb96f40b33957b4.5VKTQskn9q06Up3zwAHoejr6qPrS-PfB0uVu6lPoPwkscenes-app-ai-observability-evaluations-overview--drawer-sentiment--light:- hash: v1.k794b7964.14f497fb2a77a4c3a3729471356d3f912b83badaab94679dc6ffcc6343ffac56.RY7t5NdEAfI5m-7NfVTZ1ArAus8L-uDDJtxq8E9SdUc+ hash: v1.k794b7964.c5e5fc37526a1697de0d191dba33ac8689b0dc872b408e7b30b45c0ec744fa39.D_gGiv0LcUzZlevXVCq0re9QCz6c-vEg1Q8E0Pw8DZ8scenes-app-ai-observability-evaluations-overview--many-evaluations--dark:- hash: v1.k794b7964.fbcbaae66d5a2c77d8e77dbdc3e9f7992a2008b2a3864938104978f40e4321eb.ifYIp5Fu1sF7_XEVmb1VDKiooJj5K60HOLWb9MIhL3Y+ hash: v1.k794b7964.217c7fb285b2538e867684455d6a6f47168acc21beb2526dbb7d6ce3676e5801.97AUffXw8nnPAz3QLYb4WWMqVJdCf48Vsd-o2zEp6Xwscenes-app-ai-observability-evaluations-overview--many-evaluations--light:- hash: v1.k794b7964.95c1dd456bde8b6ec7a2f6dfc408bb0f82d3fc5f5bb65c476b8c3750a09e678a.CMP5LgTTvQOCzCsOTs1Y3qzuM_-t2aOW3hVxTCBKt1g+ hash: v1.k794b7964.c11bc3b421ac8269e555f971075f4ca1733baf5ab884b1ea4837d44556c17412.-lOl68J121_CwMPgqZLa8fO2gS_Q4apOSlbehBeG25Qscenes-app-ai-observability-evaluations-overview--many-evaluations-with-directories--dark:- hash: v1.k794b7964.f9d1904e16fbb8b91b95db6da6fc18d0fcc815d90e5424e45da5c7ae0fc5afde.0lSsJ4kSoHKIjCu3DrPW0JQN2osfjyqAFps5ZpK9mNM+ hash: v1.k794b7964.4664f59130c034f4385171bbb5d0ce20cbdbd3f71ecc7cc86065a80a2a146215.MUFt92N2_BcrkvLJUoTFd9AgppmyQWdgqAUgi51PA1sscenes-app-ai-observability-evaluations-overview--many-evaluations-with-directories--light:- hash: v1.k794b7964.c3825d792e81b5625958f0760e3399c490d6ac3350cb19b0362c13d015239c8b.IH6TyFEKE4zDPgKXQ0enT0Yc9iYjeQdokOA9EuOxcxQ+ hash: v1.k794b7964.f910e9853b427b4df365b2d628bec4c7a46c0eca175dc47bf289bc3ae3f70f07.GH2v1WUUh8zqbr8ZXQ05FDa_6R5poKG5WyGAAzf0raIscenes-app-ai-observability-evaluations-overview--nothing-graded--dark:- hash: v1.k794b7964.bd7288f40aa7d8977501f22bcc98d7c01b703f3be982002010f0bca198837aa7.wbuna3fvctXcy8flwdNVoGKD9v6wR7iEb-NUn-Cgn_Q+ hash: v1.k794b7964.cb84e0d16d170ab75fac059bfdaedc4b777ae1af0ca83ebf24e2513b0fa1377e.-JZEVRiCP5z3Wem9gj8rwvs9DohtKICs51RT5d7PcEQscenes-app-ai-observability-evaluations-overview--nothing-graded--light:- hash: v1.k794b7964.2870efedd0db26c0b9ece8d9cce6b927b9ba0cb730478ae13a3b031bec7190b5.-bnKQwjXhvGM60fQxX92vygvdm1Vwbb-luGqFzroNOs+ hash: v1.k794b7964.52f8eacef3006e94ff4447758d2aa81fea1ca24cf995552e04e6fd2c6f18194b.S3E4zPzJfMuCWjiZq67Im7dAQxr2g5qOdKQ8I3YBoKEscenes-app-ai-observability-evaluations-overview--rate-limited--dark:hash: v1.k794b7964.e8aa37a66dc03651a6633b7e997672b8abf80f42a8efe8df7f9a685af6321f4a.iraGLjZfIqSCcP-vxVIYB22Fe31a7f4ScQi6rcGnB3gscenes-app-ai-observability-evaluations-overview--rate-limited--light:hash: v1.k794b7964.db4495726f9c49b37dbe0fc0d388c4de8cc2a807f265554d2d40b22a361a59b5.kcY7HlDaxjApOhHIujs93_5fTT2Gt0VFQYl3PxORgYsscenes-app-ai-observability-evaluations-overview--two-evaluations--dark:- hash: v1.k794b7964.01f4f76c91fed6f85af93311a8efc739f91cacd64bd338810c8e5f16a79414e2.LcTqRRMA_gix5MSAsWEebZ4StIvkzJRfDYPxiCoCLxA+ hash: v1.k794b7964.0610effc7cf8f2c225b1299e5ae680fa6c74f64500eda628afdea1f43107f3f2.DQCrsNJFXpbSKtX_VaYxP5TeYZfRr9TRSsXzCPR9WYgscenes-app-ai-observability-evaluations-overview--two-evaluations--light:- hash: v1.k794b7964.aabf120a9d267deae68e65135f81d73b102c3fc3dcbb1044dab4ce464f07412d.Zrk0PAAQjMkhQJ-GUIXCZa2zGLsYAKTCVqGlVfcikc0+ hash: v1.k794b7964.a76865401cf83c825694b9470b4b992e89fc5ef03d2c2b0b3eceef8537b3b6bc.fyh9_jc67w9X9PzZjtH4_SEgKE4THhWmmRtfjjWDgnEscenes-app-ai-observability-image-preview--failed-image--dark:hash: v1.k794b7964.e4f4b0993222ae8f8a3f0e59e4c0528312f13a1e358df37e53d4331b4dacbae5.oDWA2N3BGPuGJvd9voAvMpM2rCR7tfrLjEwDqJT6MYkscenes-app-ai-observability-image-preview--failed-image--light:diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationAttentionPills.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationAttentionPills.tsxnew file mode 100644index 000000000000..d090c4f05f76--- /dev/null+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationAttentionPills.tsx@@ -0,0 +1,47 @@+import { useActions, useValues } from 'kea'++import { LemonBadge, LemonButton } from '@posthog/lemon-ui'++import { ATTENTION_LABELS } from './evaluationOverviewDisplay'+import { type AttentionFilter, evaluationsOverviewLogic } from './evaluationsOverviewLogic'++const OPTIONS: { value: AttentionFilter; label: string }[] = [+ { value: null, label: 'All' },+ { value: 'any', label: 'Needs attention' },+ ...(['errored', 'silent', 'worse'] as const).map((reason) => ({ value: reason, label: ATTENTION_LABELS[reason] })),+]++export function EvaluationAttentionPills(): JSX.Element {+ const { attentionFilter, attentionCounts } = useValues(evaluationsOverviewLogic)+ const { setAttentionFilter } = useActions(evaluationsOverviewLogic)+ // A reason no evaluation has would only filter the table to nothing, so it stays hidden unless picked.+ const shown = OPTIONS.filter(+ ({ value }) => value === null || value === attentionFilter || (attentionCounts[value] ?? 0) > 0+ )++ return (+ <div className="flex flex-wrap items-center gap-2" role="group" aria-label="Filter evaluations">+ {shown.map(({ value, label }) => (+ <LemonButton+ key={label}+ type="secondary"+ size="small"+ active={value === attentionFilter}+ onClick={() => setAttentionFilter(value)}+ sideIcon={+ <LemonBadge.Number+ count={attentionCounts[value ?? 'all'] ?? 0}+ status={value === 'any' ? 'danger' : 'muted'}+ size="small"+ maxDigits={3}+ showZero+ />+ }+ data-attr={`evaluation-overview-table-filter-${value ?? 'all'}`}+ >+ {label}+ </LemonButton>+ ))}+ </div>+ )+}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationBackfillHint.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationBackfillHint.tsxnew file mode 100644index 000000000000..9b1d18429c5b--- /dev/null+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationBackfillHint.tsx@@ -0,0 +1,36 @@+import { useActions, useValues } from 'kea'++import type { EvaluationResultApi } from '../../generated/api.schemas'+import { type BackfillHintSource, evaluationResultDrawerLogic } from './evaluationResultDrawerLogic'+import { EvaluationRunOnPastDataButton } from './EvaluationRunOnPastDataButton'+import { evaluationsOverviewLogic } from './evaluationsOverviewLogic'++/** Offers a backfill for a chart line broken into single points by buckets without results. */+export function EvaluationBackfillHint({+ row,+ source,+ named = false,+}: {+ row: EvaluationResultApi+ source: BackfillHintSource+ named?: boolean+}): JSX.Element {+ const { interval } = useValues(evaluationsOverviewLogic)+ const { trackBackfillHint } = useActions(evaluationResultDrawerLogic)++ return (+ <div className="flex flex-wrap items-center gap-x-2 text-xs text-secondary">+ <span className="min-w-0 break-words">+ {named ? <strong className="text-primary">{row.name}</strong> : 'This evaluation'}+ {` has ${interval}s with no results, so some points have no line.`}+ </span>+ <EvaluationRunOnPastDataButton+ row={row}+ size="xsmall"+ type="tertiary"+ onClick={() => trackBackfillHint(source)}+ dataAttr="evaluation-overview-backfill-hint"+ />+ </div>+ )+}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationCompareItem.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationCompareItem.tsxindex 384b40f2adae..e31c0858532c 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationCompareItem.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationCompareItem.tsx@@ -1,4 +1,4 @@-import { useValues } from 'kea'+import { useActions, useValues } from 'kea'import { IconArrowRight } from '@posthog/icons'import { LemonButton } from '@posthog/lemon-ui'@@ -7,6 +7,7 @@ import { cn } from 'lib/utils/css-classes'import type { EvaluationResultApi } from '../../generated/api.schemas'import { compactHeadline, describeAttention, isChartable, lastResultDay } from './evaluationOverviewDisplay'+import { evaluationResultDrawerLogic } from './evaluationResultDrawerLogic'import { evaluationsOverviewLogic } from './evaluationsOverviewLogic'const ATTENTION_CLASSES: Record<string, string> = {@@ -39,20 +40,22 @@ export function EvaluationCompareItem({color: string | undefinedonToggle: () => void}): JSX.Element {- const { timezone, evaluationUrl: urlOf } = useValues(evaluationsOverviewLogic)- // Without a line to draw, the row opens the evaluation instead.+ const { timezone } = useValues(evaluationsOverviewLogic)+ const { openDrawer, prefetchDetails } = useActions(evaluationResultDrawerLogic)+ // Without a line to draw, the row opens the results instead.const chartable = isChartable(row)const [reason] = row.attentionReasons- const evaluationUrl = urlOf(row.id)+ const open = (): void => openDrawer(row.id)+ const prefetch = (): void => prefetchDetails(row.id)return (<li className="flex items-center gap-1"><LemonButtonsize="small"className="flex-1 min-w-0"active={!!color}- onClick={chartable ? onToggle : undefined}- to={chartable ? undefined : evaluationUrl}- tooltip={chartable ? (color ? 'Hide from the chart' : 'Show on the chart') : 'Open the evaluation'}+ onClick={chartable ? onToggle : open}+ onMouseEnter={chartable ? undefined : prefetch}+ tooltip={chartable ? (color ? 'Hide from the chart' : 'Show on the chart') : 'Show the results'}data-attr={reason ? `evaluation-overview-compare-${reason}` : 'evaluation-overview-compare'}><span className="flex items-start gap-2 min-w-0 font-normal">@@ -75,8 +78,9 @@ export function EvaluationCompareItem({<LemonButtonsize="xsmall"icon={<IconArrowRight />}- tooltip="Open the evaluation"- to={evaluationUrl}+ tooltip="Show the results"+ onClick={open}+ onMouseEnter={prefetch}data-attr="evaluation-overview-compare-open"/></li>diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationDirectoryTile.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationDirectoryTile.tsxindex 7827b6aece55..5c42e32d7b41 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationDirectoryTile.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationDirectoryTile.tsx@@ -41,7 +41,7 @@ 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 truncate">+ <span className="text-xs text-secondary"><span>{pluralize(evaluationCount, 'evaluation')}</span>{needAttentionCount ? (<span className="text-danger">{` · ${needAttentionCount} need attention`}</span>diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationDrawerEmptyState.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationDrawerEmptyState.tsxindex b99007b14d52..67cf1d163496 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationDrawerEmptyState.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationDrawerEmptyState.tsx@@ -1,7 +1,7 @@import { useActions, useValues } from 'kea'import * as magnifyingGlassPng from '@posthog/brand/hoggies/png/magnifying-glass'-import { IconCalendar, IconGear, IconClockRewind, IconPlay } from '@posthog/icons'+import { IconCalendar, IconGear, IconPlay } from '@posthog/icons'import { LemonButton } from '@posthog/lemon-ui'import { pngHoggie } from 'lib/brand/hoggies'@@ -15,6 +15,7 @@ import { llmEvaluationsLogic } from '../llmEvaluationsLogic'import { statusReasonLabel, statusReasonRecoveryLabel } from '../statusDisplay'import type { EvaluationStatusReason } from '../types'import { evaluationResultDrawerLogic } from './evaluationResultDrawerLogic'+import { EvaluationRunOnPastDataButton } from './EvaluationRunOnPastDataButton'import { evaluationsOverviewLogic } from './evaluationsOverviewLogic'const HedgehogSearching = pngHoggie(magnifyingGlassPng)@@ -48,16 +49,12 @@ export function EvaluationDrawerEmptyState({ row }: { row: EvaluationResultApi }: "It's turned off, so new generations aren't scored."const runOnPastData = (- <LemonButton+ <EvaluationRunOnPastDataButton+ row={row}type="secondary"- icon={<IconClockRewind />}- to={evaluationUrl(row.id, { evaluation_tab: 'backfills' })}onClick={() => trackEmptyStateAction('run_on_past_data', state)}- disabledReason={editorReason}- data-attr="evaluation-overview-drawer-empty-backfill"- >- Run on past data- </LemonButton>+ dataAttr="evaluation-overview-drawer-empty-backfill"+ />)return (diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationMetricTabs.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationMetricTabs.tsxnew file mode 100644index 000000000000..670407f09e0a--- /dev/null+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationMetricTabs.tsx@@ -0,0 +1,121 @@+import { useActions, useValues } from 'kea'++import { LemonTabs, Tooltip } from '@posthog/lemon-ui'++import { IconArrowDown, IconArrowUp } from 'lib/lemon-ui/icons'+import { cn } from 'lib/utils/css-classes'+import { humanFriendlyNumber } from 'lib/utils/numbers'++import { formatPercent, formatPoints } from './evaluationOverviewDisplay'+import { type OverviewMetric, evaluationsOverviewLogic } from './evaluationsOverviewLogic'++interface MetricTab {+ metric: OverviewMetric+ label: string+ value: string+ change: number | null+ formatChange: (value: number) => string+ /** Which direction of change is good. Null for a count, where neither direction is good or bad on its own. */+ goodDirection: 'up' | 'down' | null+ changeTooltip: string+ /** Why the value is missing, shown on the tab when there is no value. */+ emptyMessage: string+}++function percentChange(current: number, previous: number): number | null {+ return previous > 0 ? ((current - previous) / previous) * 100 : null+}++function ChangePill({ tab }: { tab: MetricTab }): JSX.Element | null {+ if (tab.change === null || !Number.isFinite(tab.change)) {+ return null+ }+ const up = tab.change > 0+ const good = tab.goodDirection === null || tab.change === 0 ? null : up === (tab.goodDirection === 'up')+ return (+ <Tooltip title={tab.changeTooltip}>+ <span+ className={cn(+ 'inline-flex items-center gap-0.5 text-xs font-medium tabular-nums',+ good === null ? 'text-secondary' : good ? 'text-success' : 'text-danger'+ )}+ >+ {tab.change !== 0 && (up ? <IconArrowUp /> : <IconArrowDown />)}+ {/* The arrow carries the direction, so the number drops its sign. */}+ {tab.formatChange(Math.abs(tab.change)).replace(/^[+-]/, '')}+ </span>+ </Tooltip>+ )+}++export function EvaluationMetricTabs(): JSX.Element {+ const { overview, metric, sentimentRow } = useValues(evaluationsOverviewLogic)+ const { selectCard } = useActions(evaluationsOverviewLogic)+ const passRates = overview?.passRateOverview+ const totals = overview?.totals+ const sentiment = totals?.sentiment++ const tabs: MetricTab[] = [+ {+ metric: 'pass_rate',+ label: 'Pass rate',+ value: passRates?.median != null ? formatPercent(passRates.median) : '-',+ change: passRates?.medianComparison+ ? passRates.medianComparison.current - passRates.medianComparison.previous+ : null,+ formatChange: formatPoints,+ goodDirection: 'up',+ changeTooltip: 'Change in the median against the previous period, for evaluations with results in both',+ emptyMessage: passRates?.entries.length+ ? 'Too few graded results yet'+ : 'No evaluation with a pass rate has results yet',+ },+ {+ metric: 'graded',+ label: 'Graded results',+ value: totals && totals.graded > 0 ? humanFriendlyNumber(totals.graded) : '-',+ change: totals?.gradedComparison+ ? percentChange(totals.gradedComparison.current, totals.gradedComparison.previous)+ : null,+ formatChange: (value) => `${value.toFixed(1)}%`,+ goodDirection: null,+ changeTooltip: 'Change against the previous period, for evaluations with results in both',+ emptyMessage: 'No graded results in this range',+ },+ ]+ // The chart falls back to pass rates without sentiment results, so the tab would do nothing.+ if (sentiment && sentimentRow) {+ tabs.push({+ metric: 'sentiment',+ label: 'Negative sentiment',+ value: `${Math.round(sentiment.negativeShare)}%`,+ change: sentiment.previousShare !== null ? sentiment.negativeShare - sentiment.previousShare : null,+ formatChange: formatPoints,+ goodDirection: 'down',+ changeTooltip: 'Change in the share of negative user messages against the previous period',+ emptyMessage: 'No messages classified in this range',+ })+ }++ return (+ <LemonTabs+ activeKey={metric}+ onChange={selectCard}+ barClassName="mb-0"+ tabs={tabs.map((tab) => ({+ key: tab.metric,+ label: (+ <span className="flex flex-col items-start">+ <span className="text-xs font-normal">{tab.label}</span>+ <span className="flex items-baseline gap-2 text-primary">+ <span className="text-xl font-semibold tabular-nums">{tab.value}</span>+ <ChangePill tab={tab} />+ </span>+ </span>+ ),+ tooltip: tab.value === '-' ? tab.emptyMessage : undefined,+ 'data-attr': `evaluation-overview-tab-${tab.metric}`,+ }))}+ />+ )+}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationOverviewResults.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationOverviewResults.tsxindex b920101774f7..a46b610f56fa 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationOverviewResults.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationOverviewResults.tsx@@ -4,11 +4,12 @@ import { IconGraph } from '@posthog/icons'import { LemonButton, LemonSegmentedButton, LemonSkeleton } from '@posthog/lemon-ui'import { getColorVar } from 'lib/colors'+import { cn } from 'lib/utils/css-classes'+import { EvaluationMetricTabs } from './EvaluationMetricTabs'import { type BucketInterval, toChartValues } from './evaluationOverviewDisplay'import { EvaluationOverviewMetricChart } from './EvaluationOverviewMetricChart'import { EvaluationPassRateOverview } from './EvaluationPassRateOverview'-import { EvaluationRankedBars } from './EvaluationRankedBars'import { type OverviewMetric, type OverviewView, evaluationsOverviewLogic } from './evaluationsOverviewLogic'import { EvaluationStatusGrid } from './EvaluationStatusGrid'@@ -22,8 +23,6 @@ function viewTitle(view: OverviewView, metric: OverviewMetric, interval: BucketI: 'Negative sentiment over time'case 'by_bucket':return `Each evaluation, ${interval} by ${interval}`- case 'ranked':- return 'Each evaluation, ranked'}}@@ -33,8 +32,6 @@ function viewSubtitle(view: OverviewView, interval: BucketInterval): string {return 'Pick evaluations in the list to compare them.'case 'by_bucket':return `Every evaluation, most unusual ${interval}s first. Hover a${interval === 'hour' ? 'n' : ''} ${interval} for details.`- case 'ranked':- return 'Lowest first, on a scale where higher is better. Click a row to open it.'}}@@ -46,33 +43,15 @@ function viewOptions(interval: BucketInterval): { value: OverviewView; label: stlabel: interval === 'hour' ? 'Hour by hour' : 'Day by day','data-attr': 'evaluation-overview-view-by-bucket',},- { value: 'ranked', label: 'Ranked', 'data-attr': 'evaluation-overview-view-ranked' },]}function ResultsBody(): JSX.Element {- const { view, metric, overview, buckets, sentimentRow, ranked } = useValues(evaluationsOverviewLogic)+ const { view, metric, overview, buckets, sentimentRow } = useValues(evaluationsOverviewLogic)if (view === 'by_bucket') {return <EvaluationStatusGrid />}- if (view === 'ranked') {- return (- <div className="flex flex-col gap-6">- {ranked.results.length > 0 && (- <EvaluationRankedBars labelHeader="Evaluation" valueHeader="Result" items={ranked.results} />- )}- {ranked.labels.length > 0 && (- <EvaluationRankedBars- labelHeader="Labels"- valueHeader="Tracked label"- fullScale- items={ranked.labels}- />- )}- </div>- )- }if (metric === 'graded') {return (<EvaluationOverviewMetricChart@@ -102,40 +81,46 @@ export function EvaluationOverviewResults(): JSX.Element {useValues(evaluationsOverviewLogic)const { setView, clickExplore } = useActions(evaluationsOverviewLogic)const loading = (overviewLoading || !request.ready) && !overview+ const showTabs = view === 'over_time' && !loadingreturn (<div className="border rounded bg-surface-primary flex flex-col min-w-0">- <div className="flex flex-wrap items-center justify-between gap-2 px-4 py-3 border-b">- <div className="flex flex-col min-w-0">- <h3 className="mb-0 text-base font-semibold">{viewTitle(view, metric, interval)}</h3>- {!loading && !nothingGraded && (view !== 'over_time' || metric === 'pass_rate') && (- <span className="text-xs text-secondary">{viewSubtitle(view, interval)}</span>- )}- </div>- {!loading && !nothingGraded && (- <div className="flex flex-wrap items-center justify-end gap-2">- {/* Explore only works on the pass rate chart. It sits left of the view picker, so the picker- keeps its place when Explore comes and goes. */}- {exploreUrl && view === 'over_time' && metric === 'pass_rate' && (- <LemonButton- size="small"- icon={<IconGraph />}- to={exploreUrl}- onClick={clickExplore}- tooltip="Open the pass rates as an insight, with one line per evaluation, to change filters or break them down"- data-attr="evaluation-overview-explore"- >- Explore- </LemonButton>+ <div className={cn('flex flex-col gap-3 px-4 pt-3 border-b', !showTabs && 'pb-3')}>+ <div className="flex flex-wrap items-start justify-between gap-2">+ <div className="flex flex-col min-w-0">+ <h3 className="mb-0 text-base font-semibold">{viewTitle(view, metric, interval)}</h3>+ {!loading && !nothingGraded && (view !== 'over_time' || metric === 'pass_rate') && (+ <span className="text-xs text-secondary">{viewSubtitle(view, interval)}</span>)}- <LemonSegmentedButton- size="small"- value={view}- onChange={setView}- options={viewOptions(interval)}- /></div>- )}+ {/* With nothing graded the picker only matters as the way back to the over time empty state. */}+ {!loading && (!nothingGraded || view !== 'over_time') && (+ <div className="flex flex-wrap items-center justify-end gap-2">+ {/* Explore only works on the pass rate chart. It sits left of the view picker, so the picker+ keeps its place when Explore comes and goes. */}+ {exploreUrl && view === 'over_time' && metric === 'pass_rate' && (+ <LemonButton+ size="small"+ icon={<IconGraph />}+ to={exploreUrl}+ onClick={clickExplore}+ tooltip="Open the pass rates as an insight, with one line per evaluation, to change filters or break them down"+ data-attr="evaluation-overview-explore"+ >+ Explore+ </LemonButton>+ )}+ <LemonSegmentedButton+ size="small"+ value={view}+ onChange={setView}+ options={viewOptions(interval)}+ />+ </div>+ )}+ </div>+ {/* The day by day grid shows every evaluation the same way, so the metric tabs only steer the chart. */}+ {showTabs && <EvaluationMetricTabs />}</div><div className="p-4">{loading ? <LemonSkeleton className="h-96 w-full" /> : <ResultsBody />}</div></div>diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationOverviewTiles.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationOverviewTiles.tsxdeleted file mode 100644index 8c26f4f2884e..000000000000--- a/products/ai_observability/frontend/evaluations/overview/EvaluationOverviewTiles.tsx+++ /dev/null@@ -1,172 +0,0 @@-import { useActions, useValues } from 'kea'-import { useMemo } from 'react'--import { useChartTheme } from 'lib/charts/hooks'-import { getColorVar } from 'lib/colors'-import {- AnalyticsMetricCard,- type AnalyticsMetricCardProps,-} from 'lib/components/AnalyticsMetricCard/AnalyticsMetricCard'-import { cn } from 'lib/utils/css-classes'-import { humanFriendlyNumber } from 'lib/utils/numbers'-import { pluralize } from 'lib/utils/strings'--import { formatBucket, formatPercent, formatPoints, toChartValues } from './evaluationOverviewDisplay'-import { evaluationsOverviewLogic } from './evaluationsOverviewLogic'--/**- * A metric card that keeps its shape when there is nothing to show: a dash, an empty sparkline area and the- * empty message as its caption, so the row of cards reads the same with or without data.- */-function Tile({ buckets, ...props }: AnalyticsMetricCardProps & { buckets: string[] }): JSX.Element {- if (props.value != null && Number.isFinite(props.value)) {- const format = props.formatValue- // Hovering a bucket without results would otherwise print "NaN%".- return (- <AnalyticsMetricCard- {...props}- formatValue={(value) => (Number.isFinite(value) ? (format ? format(value) : String(value)) : '-')}- />- )- }- return (- <AnalyticsMetricCard- {...props}- value={NaN}- formatValue={() => '-'}- data={buckets.map(() => NaN)}- labels={buckets}- subtitle={undefined}- restingSubtitle={props.emptyMessage}- showChange={false}- change={null}- />- )-}--function percentChange(current: number, previous: number): number | null {- return previous > 0 ? ((current - previous) / previous) * 100 : null-}--export function EvaluationOverviewTiles(): JSX.Element {- const theme = useChartTheme()- const {- overview,- overviewLoading,- request,- buckets,- interval,- periodLength,- rows,- metric,- attentionCounts,- sentimentRow,- measuredPassRateRows: counted,- } = useValues(evaluationsOverviewLogic)- const { selectCard } = useActions(evaluationsOverviewLogic)- // Volume going up or down is not good or bad on its own, so its pill stays neutral.- const neutral = useMemo(() => ({ background: 'transparent', foreground: getColorVar('muted') }), [])-- const loading = (overviewLoading || !request.ready) && !overview- const passRates = overview?.passRateOverview- const totals = overview?.totals- const medianChange = passRates?.medianComparison- ? passRates.medianComparison.current - passRates.medianComparison.previous- : null- const gradedChange = totals?.gradedComparison- ? percentChange(totals.gradedComparison.current, totals.gradedComparison.previous)- : null- const sentiment = totals?.sentiment- const hasSentimentEvaluation = rows.some((row) => row.summary.kind === 'sentiment')- const shared = {- theme,- formatLabel: (label: string) => formatBucket(label, interval),- sparklineHeight: 36,- buckets,- labels: buckets,- loading,- }-- return (- <div className={cn('grid gap-3 grid-cols-2', hasSentimentEvaluation ? '@4xl:grid-cols-4' : '@3xl:grid-cols-3')}>- <Tile- {...shared}- title="Needs attention"- value={overview ? attentionCounts.any : undefined}- formatValue={(value) => String(Math.round(value))}- showChange={false}- restingSubtitle={`of ${pluralize(rows.length, 'evaluation')}`}- // Clicking scrolls to the list instead of selecting a chart, so the card is never shown as selected.- selected={false}- // The shared card grows its header to push a sparkline down. Without one, that would push the count- // to the bottom, out of line with the cards next to it.- className="[&>button>div>div:first-child]:flex-none"- onClick={() => selectCard('attention')}- ariaLabel="Show the evaluations list"- dataAttr="evaluation-overview-card-attention"- />- <Tile- {...shared}- title="Pass rate"- value={passRates?.median ?? undefined}- formatValue={formatPercent}- data={toChartValues(passRates?.medianTrend ?? [])}- change={medianChange !== null ? { value: medianChange } : null}- formatChange={formatPoints}- goodDirection="up"- changeTooltip="Change in the median against the previous period, for evaluations with results in both"- restingSubtitle={counted.length === 1 ? counted[0].name : `Median of ${counted.length} evaluations`}- // Entries without a median all have too few graded results to count.- emptyMessage={- passRates?.entries.length- ? 'Too few graded results yet'- : 'No evaluation with a pass rate has results yet'- }- selected={metric === 'pass_rate'}- onClick={() => selectCard('pass_rate')}- ariaLabel="Show pass rate over time"- dataAttr="evaluation-overview-card-pass-rate"- />- <Tile- {...shared}- title="Graded results"- value={totals && totals.graded > 0 ? totals.graded : undefined}- formatValue={humanFriendlyNumber}- emptyMessage="No graded results in this range"- data={totals?.gradedTrend ?? []}- change={gradedChange !== null ? { value: gradedChange } : null}- positiveColor={neutral}- negativeColor={neutral}- changeTooltip="Change against the previous period, for evaluations with results in both"- restingSubtitle={`In ${pluralize(periodLength, interval)}`}- selected={metric === 'graded'}- onClick={() => selectCard('graded')}- ariaLabel="Show graded results over time"- dataAttr="evaluation-overview-card-graded"- />- {hasSentimentEvaluation && (- <Tile- {...shared}- title="Negative sentiment"- value={sentiment?.negativeShare}- formatValue={(value) => `${Math.round(value)}%`}- data={toChartValues(sentimentRow?.trend.values ?? [])}- change={- sentiment && sentiment.previousShare !== null- ? { value: sentiment.negativeShare - sentiment.previousShare }- : null- }- formatChange={formatPoints}- goodDirection="down"- changeTooltip="Change in the share of negative user messages against the previous period"- restingSubtitle="of last user messages"- emptyMessage="No messages classified in this range"- selected={metric === 'sentiment'}- onClick={() => selectCard('sentiment')}- ariaLabel="Show negative sentiment over time"- dataAttr="evaluation-overview-card-sentiment"- />- )}- </div>- )-}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationPassRateCompareChart.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationPassRateCompareChart.tsxindex 3550b35783c1..d9c117a7f488 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationPassRateCompareChart.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationPassRateCompareChart.tsx@@ -8,7 +8,15 @@ import { useChartTheme } from 'lib/charts/hooks'import { getColorVar } from 'lib/colors'import { humanFriendlyNumber } from 'lib/utils/numbers'-import { bucketHeadline, formatBucket, hourTick, percentTrend, toChartValues } from './evaluationOverviewDisplay'+import { EvaluationBackfillHint } from './EvaluationBackfillHint'+import {+ bucketHeadline,+ formatBucket,+ hasIsolatedPoints,+ hourTick,+ percentTrend,+ toChartValues,+} from './evaluationOverviewDisplay'import { evaluationsOverviewLogic } from './evaluationsOverviewLogic'const MEDIAN_KEY = '__median'@@ -103,9 +111,15 @@ export function EvaluationPassRateCompareChart({ colors }: { colors: Map<string,)}+ const sparse = drawn.picked.filter(hasIsolatedPoints)return (- <div className="h-96 min-w-0 flex flex-col">- <TimeSeriesLineChart series={series} labels={buckets} theme={theme} config={config} tooltip={tooltip} />- </div>+ <>+ <div className="h-96 min-w-0 flex flex-col">+ <TimeSeriesLineChart series={series} labels={buckets} theme={theme} config={config} tooltip={tooltip} />+ </div>+ {sparse.map((row) => (+ <EvaluationBackfillHint key={row.id} row={row} source="compare_chart" named />+ ))}+ </>)}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationRankedBars.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationRankedBars.tsxdeleted file mode 100644index 00b33c824607..000000000000--- a/products/ai_observability/frontend/evaluations/overview/EvaluationRankedBars.tsx+++ /dev/null@@ -1,100 +0,0 @@-import { useValues } from 'kea'--import { Link, Tooltip } from '@posthog/lemon-ui'--import { cn } from 'lib/utils/css-classes'-import { humanFriendlyNumber } from 'lib/utils/numbers'--import type { ResultChangeApi } from '../../generated/api.schemas'-import { compactHeadline, formatPercent, formatPoints, resultHeadline } from './evaluationOverviewDisplay'-import { type RankedRow, evaluationsOverviewLogic } from './evaluationsOverviewLogic'--function formatChange(change: ResultChangeApi): string {- return change.unit === 'pp'- ? formatPoints(change.value)- : `${change.value > 0 ? '+' : ''}${change.value.toFixed(2)} points`-}--export function EvaluationRankedBars({- items,- labelHeader,- valueHeader = 'Pass rate',- fullScale = false,-}: {- items: RankedRow[]- labelHeader: string- valueHeader?: string- /** Draw on 0-100% instead of zooming in, for results with no shared meaning to compare closely. */- fullScale?: boolean-}): JSX.Element {- const { evaluationUrl } = useValues(evaluationsOverviewLogic)- // Worst first, with results too sparse to rely on kept at the bottom and out of the scale.- const sorted = [...items].sort((a, b) => Number(a.row.lowEvidence) - Number(b.row.lowEvidence) || a.rate - b.rate)- const lowest = Math.min(100, ...sorted.filter((item) => !item.row.lowEvidence).map((item) => item.rate))- // Start the scale just under the lowest value, so differences between high rates stay visible.- const start = fullScale ? 0 : Math.max(0, Math.floor((lowest - 5) / 10) * 10)- const position = (rate: number): string => `${Math.max(0, ((rate - start) / (100 - start)) * 100)}%`-- return (- <div className="flex flex-col text-sm">- <div className="flex items-center gap-3 text-xs text-secondary pb-1 border-b">- <span className="w-28 @2xl:w-44 shrink-0">{labelHeader}</span>- <span className="flex-1 flex justify-between">- <span>{`${start}%`}</span>- <span>100%</span>- </span>- <span className="w-28 @2xl:w-60 shrink-0 text-right">{valueHeader}</span>- </div>- {sorted.map(({ row, rate }) => {- // The bar sits on the shared scale, and the label says the result in its own terms.- const valueLabel =- row.summary.kind === 'pass_rate'- ? formatPercent(rate)- : row.summary.kind === 'score'- ? resultHeadline(row)- : compactHeadline(row)- const change = row.change ? formatChange(row.change) : null- return (- <Tooltip- key={row.id}- title={- <>- <div className="font-semibold">{row.name}</div>- <div>{`${row.summary.kind === 'pass_rate' ? `${valueLabel} passed` : valueLabel}, ${humanFriendlyNumber(row.gradedCount)} graded`}</div>- {change !== null && <div>{`${change} against the previous period`}</div>}- {row.lowEvidence && <div>Too few results to rely on</div>}- </>- }- >- <Link- to={evaluationUrl(row.id)}- subtle- className="flex items-center gap-3 py-1 rounded text-primary hover:bg-surface-secondary"- data-attr="evaluation-overview-ranked-bar"- >- <span className="w-28 @2xl:w-44 shrink-0 truncate text-left">{row.name}</span>- <span className="relative flex-1 min-w-8 h-2.5 rounded-sm bg-surface-secondary">- <span- className={cn(- 'absolute inset-y-0 left-0 rounded-sm bg-muted',- row.lowEvidence && 'opacity-40'- )}- // eslint-disable-next-line react/forbid-dom-props- style={{ width: position(rate) }}- />- </span>- <span className="w-28 @2xl:w-60 shrink-0 text-right tabular-nums whitespace-nowrap truncate">- <span className={cn('font-semibold', row.lowEvidence && 'text-secondary')}>- {valueLabel}- </span>- <span className="hidden @2xl:inline text-xs text-secondary ml-1">- {change ?? `${humanFriendlyNumber(row.gradedCount)} graded`}- </span>- </span>- </Link>- </Tooltip>- )- })}- </div>- )-}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsxindex e0e647e8b7b9..5283bb66743f 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsx@@ -9,13 +9,23 @@ import { getColorVar } from 'lib/colors'import { humanFriendlyNumber } from 'lib/utils/numbers'import type { EvaluationResultApi } from '../../generated/api.schemas'-import { formatBucket, hourTick, toChartValues, trackedCategory } from './evaluationOverviewDisplay'+import { EvaluationBackfillHint } from './EvaluationBackfillHint'+import {+ formatBucket,+ hasIsolatedPoints,+ hourTick,+ passFailCounts,+ toChartValues,+ trackedCategory,+} from './evaluationOverviewDisplay'import { evaluationsOverviewLogic } from './evaluationsOverviewLogic'const VOLUME_KEY = 'volume'+const PASSED_KEY = 'passed'+const FAILED_KEY = 'failed'const VOLUME_CEILING_KEY = 'volume-ceiling'/** Volume bars use at most this share of the plot height, so they read as context behind the line. */-const VOLUME_HEIGHT_SHARE = 1 / 4+const VOLUME_HEIGHT_SHARE = 1 / 3const HEADLINE_LABELS: Record<EvaluationResultApi['summary']['kind'], string> = {pass_rate: 'Pass rate',@@ -41,17 +51,41 @@ export function EvaluationResultTrendChart({ row }: { row: EvaluationResultApi }const isScore = summary.kind === 'score'const label = trackedCategory(row)?.label ?? HEADLINE_LABELS[summary.kind]const values = useMemo(() => toChartValues(trend.values), [trend])+ const counts = useMemo(() => passFailCounts(row), [row])const series = useMemo<Series[]>(() => {+ // Pass rates split the bars into passed and failed, because a rate can drop while failures stay flat.+ const volumeBars: Series[] = counts+ ? [+ {+ key: PASSED_KEY,+ label: 'Passed',+ data: counts.passed,+ type: 'bar',+ yAxisId: VOLUME_KEY,+ color: withAlpha(getColorVar('success'), 0.35),+ },+ {+ key: FAILED_KEY,+ label: 'Failed',+ data: counts.failed,+ type: 'bar',+ yAxisId: VOLUME_KEY,+ color: withAlpha(getColorVar('danger'), 0.35),+ },+ ]+ : [+ {+ key: VOLUME_KEY,+ label: 'Graded',+ data: trend.volume,+ type: 'bar',+ yAxisId: VOLUME_KEY,+ color: withAlpha(getColorVar('muted'), 0.3),+ },+ ]return [- {- key: VOLUME_KEY,- label: 'Graded',- data: trend.volume,- type: 'bar',- yAxisId: VOLUME_KEY,- color: withAlpha(getColorVar('muted'), 0.3),- },+ ...volumeBars,// The combo chart ignores axis bounds, so an invisible line at the ceiling stretches the volume axis// and keeps the real bars in the bottom part of the plot.{@@ -73,7 +107,7 @@ export function EvaluationResultTrendChart({ row }: { row: EvaluationResultApi }points: { radius: 3 },},]- }, [trend, values, label, theme])+ }, [trend, values, counts, label, theme])const config = useMemo<TimeSeriesComboChartConfig>(() => {const finite = values.filter(Number.isFinite)@@ -111,12 +145,29 @@ export function EvaluationResultTrendChart({ row }: { row: EvaluationResultApi }) : (<div className="mt-1 opacity-70">No graded results</div>)}- <div className="flex items-center gap-2 opacity-70">- <span>Graded results</span>- <span className="ml-auto tabular-nums">- {humanFriendlyNumber(trend.volume[ctx.dataIndex] ?? 0)}- </span>- </div>+ {counts ? (+ <>+ <div className="flex items-center gap-2 opacity-70">+ <span>Passed</span>+ <span className="ml-auto tabular-nums">+ {humanFriendlyNumber(counts.passed[ctx.dataIndex] ?? 0)}+ </span>+ </div>+ <div className="flex items-center gap-2 opacity-70">+ <span>Failed</span>+ <span className="ml-auto tabular-nums">+ {humanFriendlyNumber(counts.failed[ctx.dataIndex] ?? 0)}+ </span>+ </div>+ </>+ ) : (+ <div className="flex items-center gap-2 opacity-70">+ <span>Graded results</span>+ <span className="ml-auto tabular-nums">+ {humanFriendlyNumber(trend.volume[ctx.dataIndex] ?? 0)}+ </span>+ </div>+ )}</TooltipSurface>)}@@ -132,7 +183,12 @@ export function EvaluationResultTrendChart({ row }: { row: EvaluationResultApi }tooltip={tooltip}/></div>- <div className="text-xs text-secondary">{`Shaded bars show how many results were graded each ${interval}.`}</div>+ <div className="text-xs text-secondary">+ {counts+ ? `Bars show how many results passed and failed each ${interval}.`+ : `Shaded bars show how many results were graded each ${interval}.`}+ </div>+ {hasIsolatedPoints(row) && <EvaluationBackfillHint row={row} source="drawer" />}</div>)}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationResultsTable.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationResultsTable.tsxindex ee7ff886c864..742fd78640c5 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationResultsTable.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationResultsTable.tsx@@ -1,7 +1,7 @@import { useActions, useValues } from 'kea'import { IconPlus, IconSearch } from '@posthog/icons'-import { LemonButton, LemonInput, LemonSelect, LemonTable } from '@posthog/lemon-ui'+import { LemonButton, LemonInput, LemonTable } from '@posthog/lemon-ui'import { AccessControlAction } from 'lib/components/AccessControlAction'import { LemonTableColumns } from 'lib/lemon-ui/LemonTable'@@ -11,21 +11,15 @@ import { AccessControlLevel, AccessControlResourceType } from '~/types'import type { EvaluationResultApi } from '../../generated/api.schemas'import { llmEvaluationsLogic } from '../llmEvaluationsLogic'+import { EvaluationAttentionPills } from './EvaluationAttentionPills'import { EvaluationCreateSlot } from './EvaluationCreateSlot'import { EvaluationDirectoryTiles } from './EvaluationDirectoryTiles'-import { ATTENTION_LABELS } from './evaluationOverviewDisplay'import { EvaluationResultActions } from './EvaluationResultActions'import { EvaluationResultCell } from './EvaluationResultCell'import { EvaluationResultDrawer } from './EvaluationResultDrawer'import { EvaluationResultNameCell } from './EvaluationResultNameCell'import { EvaluationResultTrendCell } from './EvaluationResultTrendCell'-import { type AttentionFilter, OVERVIEW_LIST_ANCHOR_ID, evaluationsOverviewLogic } from './evaluationsOverviewLogic'--const FILTER_OPTIONS: { value: AttentionFilter; label: string }[] = [- { value: null, label: 'All' },- { value: 'any', label: 'Needs attention' },- ...(['errored', 'silent', 'worse'] as const).map((reason) => ({ value: reason, label: ATTENTION_LABELS[reason] })),-]+import { evaluationsOverviewLogic } from './evaluationsOverviewLogic'export function EvaluationResultsTable(): JSX.Element {const {@@ -34,14 +28,13 @@ export function EvaluationResultsTable(): JSX.Element {buckets,search,attentionFilter,- attentionCounts,configById,few,overviewLoading,overviewFailure,directoryTiles,} = useValues(evaluationsOverviewLogic)- const { setSearch, setAttentionFilter } = useActions(evaluationsOverviewLogic)+ const { setSearch } = useActions(evaluationsOverviewLogic)const { openCreateDirectory } = useActions(llmEvaluationsLogic)const columns: LemonTableColumns<EvaluationResultApi> = [@@ -95,7 +88,7 @@ export function EvaluationResultsTable(): JSX.Element {]return (- <div id={OVERVIEW_LIST_ANCHOR_ID} className="@container flex flex-col gap-3 scroll-mt-4">+ <div className="@container flex flex-col gap-3"><EvaluationDirectoryTiles /><div className="flex flex-wrap items-center gap-2"><LemonInput@@ -123,16 +116,7 @@ export function EvaluationResultsTable(): JSX.Element {</LemonButton></AccessControlAction>)}- <LemonSelect- size="small"- value={attentionFilter}- onChange={setAttentionFilter}- options={FILTER_OPTIONS.map(({ value, label }) => ({- value,- label: `${label} (${attentionCounts[value ?? 'all'] ?? 0})`,- }))}- data-attr="evaluation-overview-table-filter"- />+ <EvaluationAttentionPills /></div><LemonTablecolumns={columns}@@ -157,7 +141,7 @@ export function EvaluationResultsTable(): JSX.Element {: 'No evaluations in this scope yet.'}/>- <div className="text-xs text-secondary">{`Showing ${tableRows.length} of ${rows.length} evaluations`}</div>+ <div className="text-xs text-secondary pb-4">{`Showing ${tableRows.length} of ${rows.length} evaluations`}</div><EvaluationResultDrawer /></div>)diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationRunOnPastDataButton.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationRunOnPastDataButton.tsxnew file mode 100644index 000000000000..bcedb7856ea5--- /dev/null+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationRunOnPastDataButton.tsx@@ -0,0 +1,45 @@+import { useValues } from 'kea'++import { IconClockRewind } from '@posthog/icons'+import { LemonButton, type LemonButtonProps } from '@posthog/lemon-ui'++import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'++import { AccessControlLevel, AccessControlResourceType } from '~/types'++import type { EvaluationResultApi } from '../../generated/api.schemas'+import { evaluationsOverviewLogic } from './evaluationsOverviewLogic'++/** Opens the evaluation's backfills tab. Starting a backfill needs edit access, so the button checks it here. */+export function EvaluationRunOnPastDataButton({+ row,+ onClick,+ size,+ type,+ dataAttr,+}: {+ row: EvaluationResultApi+ onClick: () => void+ size?: LemonButtonProps['size']+ type: LemonButtonProps['type']+ dataAttr: string+}): JSX.Element {+ const { configById, evaluationUrl } = useValues(evaluationsOverviewLogic)+ return (+ <LemonButton+ size={size}+ type={type}+ icon={<IconClockRewind />}+ to={evaluationUrl(row.id, { evaluation_tab: 'backfills' })}+ onClick={onClick}+ disabledReason={getAccessControlDisabledReason(+ AccessControlResourceType.Evaluation,+ AccessControlLevel.Editor,+ configById.get(row.id)?.user_access_level ?? undefined+ )}+ data-attr={dataAttr}+ >+ Run on past data+ </LemonButton>+ )+}diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationStatusGrid.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationStatusGrid.tsxindex 25678636472f..2a6ab32875d0 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationStatusGrid.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationStatusGrid.tsx@@ -1,4 +1,4 @@-import { useValues } from 'kea'+import { useActions, useValues } from 'kea'import { type MouseEvent, useEffect, useMemo, useRef, useState } from 'react'import { Link, Tooltip } from '@posthog/lemon-ui'@@ -7,6 +7,7 @@ import { cn } from 'lib/utils/css-classes'import type { BucketStatusEnumApi, EvaluationResultApi } from '../../generated/api.schemas'import { compactHeadline, describeBucket, formatBucket } from './evaluationOverviewDisplay'+import { evaluationResultDrawerLogic } from './evaluationResultDrawerLogic'import { evaluationsOverviewLogic } from './evaluationsOverviewLogic'/** Below this many graded results the backend never marks a bucket unusual, so the cell is greyed as unreliable. */@@ -40,7 +41,8 @@ function isLowEvidence(row: EvaluationResultApi, index: number): boolean {}export function EvaluationStatusGrid(): JSX.Element {- const { statusGridRows, buckets, interval, evaluationUrl } = useValues(evaluationsOverviewLogic)+ const { statusGridRows, buckets, interval } = useValues(evaluationsOverviewLogic)+ const { openDrawer, prefetchDetails } = useActions(evaluationResultDrawerLogic)// One tooltip follows the pointer, because a tooltip per cell makes a large grid slow to render.const [hovered, setHovered] = useState<HoveredCell | null>(null)const gridRef = useRef<HTMLDivElement>(null)@@ -72,9 +74,10 @@ export function EvaluationStatusGrid(): JSX.Element {statusGridRows.map((row, rowIndex) => (<div key={row.id} className={cn('flex items-center gap-3', row.lowEvidence && 'opacity-60')}><Link- to={evaluationUrl(row.id)}+ onClick={() => openDrawer(row.id)}+ onMouseEnter={() => prefetchDetails(row.id)}subtle- className="w-28 @2xl:w-48 shrink-0 truncate text-primary"+ className="w-28 @2xl:w-48 shrink-0 truncate text-left text-primary"data-attr="evaluation-overview-status-grid-name">{row.name}@@ -98,7 +101,7 @@ export function EvaluationStatusGrid(): JSX.Element {</span></div>)),- [statusGridRows, buckets, labels, evaluationUrl]+ [statusGridRows, buckets, labels, openDrawer, prefetchDetails])const hover = (event: MouseEvent<HTMLDivElement>): void => {diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.stories.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.stories.tsxindex 3b02a1798c85..ef2ada77701a 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.stories.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.stories.tsx@@ -198,7 +198,7 @@ function previousRateOf(row: EvaluationResultApi): number | null {return previous ? (previous.passed / (previous.passed + previous.failed)) * 100 : null}-/** Totals built from the rows, the way the backend builds them, so the cards agree with the chart. */+/** Totals built from the rows, the way the backend builds them, so the tabs agree with the chart. */function overview(evaluations: EvaluationResultApi[]): EvaluationsOverviewApi {const active = evaluations.filter((row) => row.enabled)const passRates = active.filter((row) => row.summary.kind === 'pass_rate' && row.gradedCount > 0)diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.tsxindex 546848886890..174172e491f1 100644--- a/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.tsx+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.tsx@@ -7,7 +7,6 @@ import { DateFilter } from 'lib/components/DateFilter/DateFilter'import { RATE_LIMITED_MESSAGE } from './evaluationOverviewDisplay'import { EvaluationOverviewResults } from './EvaluationOverviewResults'-import { EvaluationOverviewTiles } from './EvaluationOverviewTiles'import { EvaluationScopePicker } from './EvaluationScopePicker'import { OVERVIEW_DATE_OPTIONS, evaluationsOverviewLogic } from './evaluationsOverviewLogic'@@ -68,7 +67,6 @@ export function EvaluationsOverview(): JSX.Element {Couldn't load the evaluation list, so editing evaluations and picking them is unavailable.</LemonBanner>)}- <EvaluationOverviewTiles /><EvaluationOverviewResults /></>)}diff --git a/products/ai_observability/frontend/evaluations/overview/evaluationOverviewDisplay.ts b/products/ai_observability/frontend/evaluations/overview/evaluationOverviewDisplay.tsindex efb20a2278b8..589605e2c5a4 100644--- a/products/ai_observability/frontend/evaluations/overview/evaluationOverviewDisplay.ts+++ b/products/ai_observability/frontend/evaluations/overview/evaluationOverviewDisplay.ts@@ -218,6 +218,28 @@ export function resultEvidence(row: EvaluationResultApi): string {return parts.join(' · ')}+/** True when a bucket has results but neither neighbor does, so the chart draws it as a dot with no line. */+export function hasIsolatedPoints(row: EvaluationResultApi): boolean {+ const { values } = row.trend+ return (+ values.length > 1 &&+ values.some((value, index) => value !== null && values[index - 1] == null && values[index + 1] == null)+ )+}++/**+ * Passed and failed runs per bucket for a pass rate. The rate is passed / (passed + failed) and the volume is+ * passed + failed, so both counts come back exactly.+ */+export function passFailCounts(row: EvaluationResultApi): { passed: number[]; failed: number[] } | null {+ if (row.summary.kind !== 'pass_rate') {+ return null+ }+ const { values, volume } = row.trend+ const passed = volume.map((graded, index) => Math.round((graded * (values[index] ?? 0)) / 100))+ return { passed, failed: volume.map((graded, index) => graded - passed[index]) }+}+/** Whether the row has at least one day the compare chart can draw. */export function isChartable(row: EvaluationResultApi): boolean {return row.gradedCount > 0 && percentTrend(row).some(Number.isFinite)diff --git a/products/ai_observability/frontend/evaluations/overview/evaluationResultDrawerLogic.ts b/products/ai_observability/frontend/evaluations/overview/evaluationResultDrawerLogic.tsindex d6ea3a3ecf2e..705c5fdf4c30 100644--- a/products/ai_observability/frontend/evaluations/overview/evaluationResultDrawerLogic.ts+++ b/products/ai_observability/frontend/evaluations/overview/evaluationResultDrawerLogic.ts@@ -26,6 +26,7 @@ export interface EvaluationDetails {}export type DetailsTrigger = 'open' | 'prefetch'+export type BackfillHintSource = 'drawer' | 'compare_chart'export type DetailsLoad =| { status: 'loading' }| { status: 'ready'; details: EvaluationDetails }@@ -91,6 +92,9 @@ export interface evaluationResultDrawerLogicActions {resetDetails: () => {value: true}+ trackBackfillHint: (source: BackfillHintSource) => {+ source: BackfillHintSource+ }trackEmptyStateAction: (action: string,state: string@@ -132,6 +136,7 @@ export const evaluationResultDrawerLogic = kea<evaluationResultDrawerLogicType>(openDrawer: (evaluationId: string) => ({ evaluationId }),closeDrawer: true,trackEmptyStateAction: (action: string, state: string) => ({ action, state }),+ trackBackfillHint: (source: BackfillHintSource) => ({ source }),prefetchDetails: (evaluationId: string) => ({ evaluationId }),loadDetails: (evaluationId: string, trigger: DetailsTrigger) => ({ evaluationId, trigger }),detailsRequested: (key: string, evaluationId: string) => ({ key, evaluationId }),@@ -192,6 +197,9 @@ export const evaluationResultDrawerLogic = kea<evaluationResultDrawerLogicType>(trackEmptyStateAction: ({ action, state }) => {posthog.capture('llma evaluation overview drawer empty action', { action, state })},+ trackBackfillHint: ({ source }) => {+ posthog.capture('llma evaluation overview backfill hint clicked', { source })+ },openDrawer: ({ evaluationId }) => {const row = values.rowsById.get(evaluationId)posthog.capture('llma evaluation overview drawer opened', {diff --git a/products/ai_observability/frontend/evaluations/overview/evaluationsOverviewLogic.test.ts b/products/ai_observability/frontend/evaluations/overview/evaluationsOverviewLogic.test.tsindex a2306a5dbcb0..f5a68d9a0017 100644--- a/products/ai_observability/frontend/evaluations/overview/evaluationsOverviewLogic.test.ts+++ b/products/ai_observability/frontend/evaluations/overview/evaluationsOverviewLogic.test.ts@@ -10,6 +10,7 @@ import { initKeaTests } from '~/test/init'import type { EvaluationApi, EvaluationResultApi } from '../../generated/api.schemas'import { llmEvaluationsLogic } from '../llmEvaluationsLogic'+import { hasIsolatedPoints, passFailCounts } from './evaluationOverviewDisplay'import { evaluationResultDrawerLogic } from './evaluationResultDrawerLogic'import {evaluationsOverviewLogic,@@ -137,6 +138,21 @@ function detailRequest(endpoint: string, id: string, url: string): string {const FAILURES_QUERY = 'outcome=failed&limit=5'describe('evaluationsOverviewLogic', () => {+ test.each([+ ['a point between two empty buckets', [null, 50, null, 60, 70], true],+ ['a point at the edge next to an empty bucket', [40, null, 60, 70], true],+ ['a connected line with a gap', [40, 50, null, 60, 70], false],+ ['a single bucket', [40], false],+ ])('finds isolated points in %s', (_, values, expected) => {+ const sparse = { ...ROWS[0], trend: { values, volume: values.map((value) => (value === null ? 0 : 10)) } }+ expect(hasIsolatedPoints(sparse)).toBe(expected)+ })++ it('splits pass rate volume into exact passed and failed counts, with empty buckets as zero', () => {+ const row = { ...ROWS[0], trend: { values: [(2 / 3) * 100, null, 100], volume: [3, 0, 7] } }+ expect(passFailCounts(row)).toEqual({ passed: [2, 0, 7], failed: [1, 0, 0] })+ })+let requests: URLSearchParams[]/** Statuses the next overview reads fail with, one per read. */let overviewFailures: number[]diff --git a/products/ai_observability/frontend/evaluations/overview/evaluationsOverviewLogic.ts b/products/ai_observability/frontend/evaluations/overview/evaluationsOverviewLogic.tsindex 20a436d11038..8b48a2b4954e 100644--- a/products/ai_observability/frontend/evaluations/overview/evaluationsOverviewLogic.ts+++ b/products/ai_observability/frontend/evaluations/overview/evaluationsOverviewLogic.ts@@ -28,9 +28,8 @@ import type { EvaluationDirectoryEditor } from '../llmEvaluationsLogic'import type { EvaluationConfig } from '../types'import { type BucketInterval, isChartable, percentValue } from './evaluationOverviewDisplay'-export type OverviewView = 'over_time' | 'by_bucket' | 'ranked'+export type OverviewView = 'over_time' | 'by_bucket'export type OverviewMetric = 'pass_rate' | 'graded' | 'sentiment'-export type OverviewCard = OverviewMetric | 'attention'export type AttentionFilter = 'any' | AttentionReasonsEnumApi | nullexport type OverviewFailure = 'rate_limited' | 'failed'export type TableAction = 'edit' | 'enable' | 'disable' | 'move' | 'delete'@@ -54,8 +53,6 @@ const FEW_EVALUATIONS_MAX = 3const OVERVIEW_MAX_DAYS = 90/** How many evaluations the chart picks on its first render. People can pick more. */const DEFAULT_COMPARED = 3-/** The anchor the "Needs attention" card scrolls to, right above the evaluations table. */-export const OVERVIEW_LIST_ANCHOR_ID = 'evaluations-overview-list'/** A rolling relative start such as "-24h", "-14d" or "-3w", without a Start or End clip. */const ROLLING_RANGE = /^-(\d+)([hdwmqy])$/@@ -249,11 +246,6 @@ export interface OverviewRequest {notice: string | null}-export interface RankedRow {- row: EvaluationResultApi- rate: number-}-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface evaluationsOverviewLogicValues {dateFilter: {@@ -295,10 +287,6 @@ export interface evaluationsOverviewLogicValues {periodLength: numberperiodNow: numberpickedIds: string[]- ranked: {- labels: RankedRow[]- results: RankedRow[]- }request: OverviewRequestrows: EvaluationResultApi[]rowsById: Map<string, EvaluationResultApi>@@ -435,8 +423,8 @@ export interface evaluationsOverviewLogicActions {retryOverview: () => {value: true}- selectCard: (card: OverviewCard) => {- card: OverviewCard+ selectCard: (card: OverviewMetric) => {+ card: OverviewMetric}setAttentionFilter: (filter: AttentionFilter) => {filter: AttentionFilter@@ -508,14 +496,6 @@ export interface evaluationsOverviewLogicMeta {) => EvaluationResultApi[]chartedIds: (comparedIds: string[] | null, compareListRows: EvaluationResultApi[]) => string[]statusGridRows: (rows: EvaluationResultApi[]) => EvaluationResultApi[]- ranked: (- overview: EvaluationsOverviewApi | null,- rows: EvaluationResultApi[],- rowsById: Map<string, EvaluationResultApi>- ) => {- labels: RankedRow[]- results: RankedRow[]- }configById: (evaluations: EvaluationConfig[]) => Map<string, EvaluationConfig>attentionCounts: (rows: EvaluationResultApi[]) => Record<string, number>directoryTiles: (@@ -601,7 +581,7 @@ export const evaluationsOverviewLogic = kea<evaluationsOverviewLogicType>([actions({setPickedIds: (ids: string[]) => ({ ids }),setView: (view: OverviewView) => ({ view }),- selectCard: (card: OverviewCard) => ({ card }),+ selectCard: (card: OverviewMetric) => ({ card }),toggleCompared: (id: string) => ({ id }),setComparedIds: (ids: string[]) => ({ ids }),clickExplore: true,@@ -693,14 +673,11 @@ export const evaluationsOverviewLogic = kea<evaluationsOverviewLogicType>(['over_time' as OverviewView,{setView: (_, { view }) => view,- // A charted card swaps the over time chart, so it shows that view.- selectCard: (state, { card }) => (card === 'attention' ? state : 'over_time'),+ // A metric swaps the over time chart, so it shows that view.+ selectCard: () => 'over_time',},],- chosenMetric: [- 'pass_rate' as OverviewMetric,- { selectCard: (state, { card }) => (card === 'attention' ? state : card) },- ],+ chosenMetric: ['pass_rate' as OverviewMetric, { selectCard: (_, { card }) => card }],// Null keeps the default picks, so they follow the data until someone picks by hand.comparedIds: [null as string[] | null,@@ -740,7 +717,6 @@ export const evaluationsOverviewLogic = kea<evaluationsOverviewLogicType>([null as AttentionFilter,{setAttentionFilter: (_, { filter }) => filter,- selectCard: (state, { card }) => (card === 'attention' ? 'any' : state),},],// The enable switch has no in-flight state of its own, so the table tracks it to block a second click.@@ -935,35 +911,6 @@ export const evaluationsOverviewLogic = kea<evaluationsOverviewLogicType>([gridSortRate(a) - gridSortRate(b)),],- ranked: [- (s) => [s.overview, s.rows, s.rowsById],- (- overview: EvaluationsOverviewApi | null,- rows: EvaluationResultApi[],- rowsById: Map<string, EvaluationResultApi>- ): { results: RankedRow[]; labels: RankedRow[] } => {- const rank = (kinds: string[], rate: (row: EvaluationResultApi) => number): RankedRow[] =>- rows- .filter((row) => row.enabled && row.gradedCount > 0 && kinds.includes(row.summary.kind))- .map((row) => ({ row, rate: rate(row) }))- .filter((item) => Number.isFinite(item.rate))- return {- // Results with a better and a worse direction, on one scale where higher is better: pass rates as- // they are, sentiment as the share that is not negative, and scores as their position on the scale.- results: [- ...(overview?.passRateOverview.entries ?? []).flatMap((entry) => {- const row = rowsById.get(entry.evaluationId)- return row ? [{ row, rate: entry.rate }] : []- }),- ...rank(['sentiment', 'score'], (row) =>- row.summary.kind === 'sentiment' ? 100 - percentValue(row) : percentValue(row)- ),- ],- // Labels without a passing rule have no better or worse, so they rank on their own.- labels: rank(['categories'], percentValue),- }- },- ],configById: [(s) => [s.evaluations],(evaluations: EvaluationConfig[]): Map<string, EvaluationConfig> =>@@ -1111,15 +1058,6 @@ export const evaluationsOverviewLogic = kea<evaluationsOverviewLogicType>([},selectCard: ({ card }) => {posthog.capture('llma evaluation overview card clicked', { card })- if (card === 'attention') {- posthog.capture('llma evaluation overview attention filter changed', {- filter: 'any',- trigger: 'card',- })- document- .getElementById(OVERVIEW_LIST_ANCHOR_ID)- ?.scrollIntoView({ behavior: 'smooth', block: 'start' })- }},toggleCompared: ({ id }) => {const current = values.chartedIds