Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(evals): streamline v4 evaluator upgrade UX (#15951)

marliessophie75b7a5aa1f5c
diff --git a/web/src/components/table/peek/peek-evaluator-config-detail.tsx b/web/src/components/table/peek/peek-evaluator-config-detail.tsx
index 53a577691b..8f7a109614 100644
--- a/web/src/components/table/peek/peek-evaluator-config-detail.tsx
+++ b/web/src/components/table/peek/peek-evaluator-config-detail.tsx
@@ -9,7 +9,6 @@ import {
TooltipContent,
TooltipTrigger,
} from "@/src/components/ui/tooltip";
-import { V4MigrationEvaluatorUpdateRequiredBadge } from "@/src/features/v4-migration/V4MigrationDelayBadge";
import { UserCircle2Icon } from "lucide-react";
import { StatusBadge } from "@/src/components/ui/StatusBadge/StatusBadge";
import { DeleteEvalConfigButton } from "@/src/components/deleteButton";
@@ -118,13 +117,6 @@ const PeekViewEvaluatorConfigDetail = ({
</div>
</div>
- {evaluatorRequiresMigration && evalConfig.evalTemplate && (
- <V4MigrationEvaluatorUpdateRequiredBadge
- projectId={projectId}
- evaluatorId={evalConfig.id}
- />
- )}
-
<EvaluatorPausedCallout projectId={projectId} evalConfig={evalConfig} />
<CardDescription className="flex items-center text-sm">
diff --git a/web/src/features/evals/components/eval-form-descriptions.tsx b/web/src/features/evals/components/eval-form-descriptions.tsx
index 976604de23..1aaf834b5d 100644
--- a/web/src/features/evals/components/eval-form-descriptions.tsx
+++ b/web/src/features/evals/components/eval-form-descriptions.tsx
@@ -7,7 +7,7 @@ export function VariableMappingDescription(p: {
href: string;
}) {
return (
- <div className="flex h-8 w-1/2 items-center">
+ <div className="flex h-8 min-w-0 flex-1 items-center">
<Label className="text-sm font-normal">{p.title}</Label>
<DocPopup description={p.description} href={p.href} />
</div>
diff --git a/web/src/features/evals/components/evaluation-prompt-preview.tsx b/web/src/features/evals/components/evaluation-prompt-preview.tsx
index f697c91483..e8349b7ca7 100644
--- a/web/src/features/evals/components/evaluation-prompt-preview.tsx
+++ b/web/src/features/evals/components/evaluation-prompt-preview.tsx
@@ -120,6 +120,7 @@ export const EvaluationPromptPreview = ({
variableMapping,
isLoading,
showControls = true,
+ showTargetBadge = true,
className,
controlButtons,
}: {
@@ -129,6 +130,7 @@ export const EvaluationPromptPreview = ({
variableMapping: VariableMapping[];
isLoading: boolean;
showControls?: boolean;
+ showTargetBadge?: boolean;
className?: string;
controlButtons?: React.ReactNode;
}) => {
@@ -236,7 +238,7 @@ export const EvaluationPromptPreview = ({
<span className="mb-1 flex flex-row items-center justify-between py-0 text-sm font-bold capitalize">
<div className="flex flex-row items-center gap-2">
Evaluation Prompt Preview
- {targetLink && (
+ {showTargetBadge && targetLink && (
<Link
href={targetLink.href}
className="hover:cursor-pointer"
diff --git a/web/src/features/evals/components/evaluator-table.tsx b/web/src/features/evals/components/evaluator-table.tsx
index 0a75c429ce..4dc7e22768 100644
--- a/web/src/features/evals/components/evaluator-table.tsx
+++ b/web/src/features/evals/components/evaluator-table.tsx
@@ -1,4 +1,5 @@
import { StatusBadge } from "@/src/components/ui/StatusBadge/StatusBadge";
+import { encodeFiltersGeneric } from "@langfuse/shared";
import { LevelCountsDisplay } from "@/src/components/level-counts-display";
import { DataTable } from "@/src/components/table/data-table";
import { DataTableToolbar } from "@/src/components/table/data-table-toolbar";
@@ -15,7 +16,7 @@ import { useSidebarFilterState } from "@/src/features/filters/hooks/useSidebarFi
import { evaluatorFilterConfig } from "@/src/features/filters/config/evaluators-config";
import { api } from "@/src/utils/api";
import { createColumnHelper } from "@tanstack/react-table";
-import { useEffect, useState, useMemo } from "react";
+import { useCallback, useEffect, useState, useMemo } from "react";
import { useQueryParam, StringParam, withDefault } from "use-query-params";
import { usePaginationState } from "@/src/hooks/usePaginationState";
import { isEventTarget } from "@/src/features/evals/utils/typeHelpers";
@@ -52,6 +53,10 @@ import {
TableIconButtonLoadingCell,
TableTextLoadingCell,
} from "@/src/components/table/loading-cells";
+import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
+import { useV4UpgradeUiEnabled } from "@/src/features/v4-migration/useV4UpgradeUiEnabled";
+import { V4MigrationBadgeContent } from "@/src/features/v4-migration/V4MigrationBadgeContent";
+import { buildEvaluatorUpgradeUrl } from "@/src/features/v4-migration/evaluatorMigrationUrls";
function DeprecatedChipCell() {
return (
@@ -65,6 +70,8 @@ function DeprecatedChipCell() {
export default function EvaluatorTable({ projectId }: { projectId: string }) {
const router = useRouter();
+ const capture = usePostHogClientCapture();
+ const v4UpgradeUiEnabled = useV4UpgradeUiEnabled();
const { setDetailPageList } = useDetailPageLists();
const [paginationState, setPaginationState] = usePaginationState(0, 50, {
page: "pageIndex",
@@ -123,6 +130,38 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
const datasets = api.datasets.allDatasetMeta.useQuery({ projectId });
+ const openEvaluatorUpgrade = useCallback(
+ (evaluatorId: string) => {
+ if (!v4UpgradeUiEnabled) return;
+
+ capture("v4_migration:update_required_badge_clicked", {
+ scope: "single",
+ });
+ window.open(
+ buildEvaluatorUpgradeUrl(
+ projectId,
+ evaluatorId,
+ encodeFiltersGeneric(queryFilter.filterState),
+ ),
+ "_blank",
+ "noopener,noreferrer",
+ );
+ },
+ [capture, projectId, queryFilter.filterState, v4UpgradeUiEnabled],
+ );
+
+ const handleRowClick = useCallback(
+ (row: EvaluatorDataRow, event?: React.MouseEvent) => {
+ if (!v4UpgradeUiEnabled || !row.isLegacy) return;
+
+ // DataTable opens the peek only when the row click has not been
+ // prevented. Deprecated evaluators should go directly to upgrade.
+ event?.preventDefault();
+ openEvaluatorUpgrade(row.id);
+ },
+ [openEvaluatorUpgrade, v4UpgradeUiEnabled],
+ );
+
useEffect(() => {
if (evaluators.isSuccess) {
const { configs: configList = [] } = evaluators.data ?? {};
@@ -139,10 +178,26 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
columnHelper.accessor("scoreName", {
id: "scoreName",
header: "Generated Score Name",
- size: 200,
+ size: v4UpgradeUiEnabled ? 320 : 200,
cell: (row) => {
const scoreName = row.getValue();
- return scoreName ? <TableIdOrName value={scoreName} /> : undefined;
+ if (!scoreName) return undefined;
+
+ return (
+ <div className="flex w-[calc(var(--col-scoreName-size)*1px-0.75rem)] items-center gap-2">
+ <TableIdOrName value={scoreName} className="min-w-[4px] flex-1" />
+ {v4UpgradeUiEnabled && row.row.original.isLegacy ? (
+ <span className="ml-auto justify-self-end">
+ <V4MigrationBadgeContent
+ onClick={() => openEvaluatorUpgrade(row.row.original.id)}
+ title="Upgrade now"
+ showChevron={false}
+ compact
+ />
+ </span>
+ ) : null}
+ </div>
+ );
},
}),
columnHelper.accessor("status", {
@@ -159,6 +214,20 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
);
},
}),
+ columnHelper.accessor("isLegacy", {
+ id: "isLegacy",
+ header: "Eval Version",
+ size: 180,
+ enableHiding: true,
+ loadingCell: <TableBadgeLoadingCell />,
+ cell: (row) => {
+ // Set by useEvaluatorTableData only for active legacy evaluators with
+ // a NEW time scope — the ones that actually require migration.
+ if (!row.row.original.isLegacy) return null;
+
+ return <DeprecatedChipCell />;
+ },
+ }),
columnHelper.accessor("totalCost", {
header: "Total Cost (7d)",
id: "totalCost",
@@ -249,20 +318,6 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
enableSorting: true,
size: 150,
}),
- columnHelper.accessor("isLegacy", {
- id: "isLegacy",
- header: "Eval Version",
- size: 180,
- enableHiding: true,
- loadingCell: <TableBadgeLoadingCell />,
- cell: (row) => {
- // Set by useEvaluatorTableData only for active legacy evaluators with
- // a NEW time scope — the ones that actually require migration.
- if (!row.row.original.isLegacy) return null;
-
- return <DeprecatedChipCell />;
- },
- }),
columnHelper.accessor("target", {
id: "target",
header: "Runs on",
@@ -434,6 +489,7 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
}}
orderBy={orderByState}
setOrderBy={setOrderByState}
+ onRowClick={handleRowClick}
columnVisibility={columnVisibility}
onColumnVisibilityChange={setColumnVisibility}
/>
diff --git a/web/src/features/evals/components/inner-evaluator-form.tsx b/web/src/features/evals/components/inner-evaluator-form.tsx
index 34da270e29..3082a1db69 100644
--- a/web/src/features/evals/components/inner-evaluator-form.tsx
+++ b/web/src/features/evals/components/inner-evaluator-form.tsx
@@ -336,6 +336,8 @@ export const InnerEvaluatorForm = (props: {
hideAdvancedSettings?: boolean;
hideTargetSelection?: boolean;
hidePreviewTable?: boolean;
+ hideRootObservationFilter?: boolean;
+ showPreviewTargetBadge?: boolean;
evalCapabilities: EvalCapabilities;
defaultRunOnLive?: boolean;
defaultTarget?: EvalTargetObject;
@@ -1156,6 +1158,12 @@ export const InnerEvaluatorForm = (props: {
// Event evaluators - use observation columns
return observationEvalFilterColsWithOptions(
observationEvalFilterOptions,
+ ).filter(
+ (column) =>
+ !(
+ props.hideRootObservationFilter &&
+ column.id === "isRootObservation"
+ ),
);
} else if (isTraceTarget(target)) {
return tracesTableColsWithOptions(
@@ -1348,6 +1356,7 @@ export const InnerEvaluatorForm = (props: {
compatibilityCheckWasPerformed={
props.evalCapabilities.compatibilityCheckWasPerformed
}
+ showPreviewTargetBadge={props.showPreviewTargetBadge}
/>
)}
</div>
diff --git a/web/src/features/evals/components/variable-mapping-card.tsx b/web/src/features/evals/components/variable-mapping-card.tsx
index 24d5dbf61e..439fb473e4 100644
--- a/web/src/features/evals/components/variable-mapping-card.tsx
+++ b/web/src/features/evals/components/variable-mapping-card.tsx
@@ -73,6 +73,7 @@ export const VariableMappingCard = ({
hideAdvancedSettings = false,
isNewCompatible = true,
compatibilityCheckWasPerformed = false,
+ showPreviewTargetBadge = true,
}: {
projectId: string;
availableVariables:
@@ -86,6 +87,7 @@ export const VariableMappingCard = ({
hideAdvancedSettings?: boolean;
isNewCompatible?: boolean;
compatibilityCheckWasPerformed?: boolean;
+ showPreviewTargetBadge?: boolean;
}) => {
const [showPreview, setShowPreview] = useState(false);
const [selectedPreviewPointer, setSelectedPreviewPointer] =
@@ -270,6 +272,7 @@ export const VariableMappingCard = ({
!shouldWrapVariables && "lg:w-2/3",
)}
controlButtons={mappingControlButtons}
+ showTargetBadge={showPreviewTargetBadge}
/>
) : (
<div className="bg-muted/50 flex max-h-full min-h-48 w-full flex-col gap-1 lg:w-2/3">
@@ -344,13 +347,13 @@ export const VariableMappingCard = ({
key={`${mappingField.id}-langfuseObject`}
name={`mapping.${index}.langfuseObject`}
render={({ field }) => (
- <div className="flex items-start gap-2">
+ <div className="flex min-w-0 items-start gap-2">
<VariableMappingDescription
title="Object"
description="Langfuse object to retrieve the data from."
href="https://langfuse.com/docs/evaluation/evaluation-methods/llm-as-a-judge"
/>
- <FormItem className="w-2/3">
+ <FormItem className="min-w-0 flex-1">
<FormControl>
<Select
disabled={disabled}
@@ -405,13 +408,13 @@ export const VariableMappingCard = ({
(field.value &&
!nameOptions.includes(field.value));
return (
- <div className="flex items-start gap-2">
+ <div className="flex min-w-0 items-start gap-2">
<VariableMappingDescription
title="Object Name"
description="Name of the Langfuse object to retrieve the data from."
href="https://langfuse.com/docs/evaluation/evaluation-methods/llm-as-a-judge"
/>
- <FormItem className="w-2/3">
+ <FormItem className="min-w-0 flex-1">
<FormControl>
{isCustomOption ? (
<div className="flex flex-col gap-2">
@@ -501,13 +504,13 @@ export const VariableMappingCard = ({
key={`${mappingField.id}-selectedColumnId`}
name={`mapping.${index}.selectedColumnId`}
render={({ field }) => (
- <div className="flex items-start gap-2">
+ <div className="flex min-w-0 items-start gap-2">
<VariableMappingDescription
title="Object Field"
description="Field on the Langfuse object to insert into the template."
href="https://langfuse.com/docs/evaluation/evaluation-methods/llm-as-a-judge"
/>
- <FormItem className="w-2/3">
+ <FormItem className="min-w-0 flex-1">
<FormControl>
<Select
disabled={disabled}
@@ -569,13 +572,13 @@ export const VariableMappingCard = ({
getJsonPathCompatibilityWarning(field.value);
return (
- <div className="flex items-start gap-2">
+ <div className="flex min-w-0 items-start gap-2">
<VariableMappingDescription
title="JsonPath"
description="Optional selection: Use JsonPath syntax to select from a JSON object stored on a trace. If not selected, we will pass the entire object into the prompt."
href="https://langfuse.com/docs/evaluation/evaluation-methods/llm-as-a-judge"
/>
- <FormItem className="w-2/3">
+ <FormItem className="min-w-0 flex-1">
<FormControl>
<Input
{...field}
@@ -613,13 +616,13 @@ export const VariableMappingCard = ({
/>
</div>
{hideAdvancedSettings && (
- <div className="flex items-start gap-2">
+ <div className="flex min-w-0 items-start gap-2">
<VariableMappingDescription
title="Object"
description="Type of object to retrieve the data from."
href="https://langfuse.com/docs/evaluation/evaluation-methods/llm-as-a-judge"
/>
- <div className="w-2/3">
+ <div className="min-w-0 flex-1">
<Input
value={
isEventTarget(form.watch("target"))
@@ -644,13 +647,13 @@ export const VariableMappingCard = ({
: experimentTargetEvalVariableColumns;
return (
- <div className="flex items-start gap-2">
+ <div className="flex min-w-0 items-start gap-2">
<VariableMappingDescription
title="Object Field"
description="Observation field to insert into the template."
href="https://langfuse.com/docs/evaluation/evaluation-methods/llm-as-a-judge"
/>
- <FormItem className="w-2/3">
+ <FormItem className="min-w-0 flex-1">
<FormControl>
<Select
disabled={disabled}
@@ -690,13 +693,13 @@ export const VariableMappingCard = ({
getJsonPathCompatibilityWarning(field.value);
return (
- <div className="flex items-start gap-2">
+ <div className="flex min-w-0 items-start gap-2">
<VariableMappingDescription
title="JsonPath"
description="Optional selection: Use JsonPath syntax to select from a JSON object. If not selected, we will pass the entire object into the prompt."
href="https://langfuse.com/docs/evaluation/evaluation-methods/llm-as-a-judge"
/>
- <FormItem className="w-2/3">
+ <FormItem className="min-w-0 flex-1">
<FormControl>
<Input
{...field}
diff --git a/web/src/features/evals/hooks/useEvalCapabilities.ts b/web/src/features/evals/hooks/useEvalCapabilities.ts
index 3945a051d8..7a0ff2697c 100644
--- a/web/src/features/evals/hooks/useEvalCapabilities.ts
+++ b/web/src/features/evals/hooks/useEvalCapabilities.ts
@@ -42,7 +42,12 @@ export function useEvalCapabilities(
const isOtel = sdkVersionInfo.data?.isOtel ?? false;
// Get eval counts including legacy eval count
- const evalCounts = api.evals.counts.useQuery({ projectId });
+ const evalCounts = api.evals.counts.useQuery(
+ { projectId },
+ {
+ enabled: !!projectId,
+ },
+ );
const hasLegacyEvals = (evalCounts.data?.legacyConfigCount ?? 0) > 0;
// The legacy eval experience depends on whether the deployment still writes
diff --git a/web/src/features/evals/pages/remap-evaluator.tsx b/web/src/features/evals/pages/remap-evaluator.tsx
index 573106ab21..5bd48043d3 100644
--- a/web/src/features/evals/pages/remap-evaluator.tsx
+++ b/web/src/features/evals/pages/remap-evaluator.tsx
@@ -6,12 +6,12 @@ import { InnerEvaluatorForm } from "@/src/features/evals/components/inner-evalua
import {
mapLegacyToModernTarget,
isTraceTarget,
- isEventTarget,
} from "@/src/features/evals/utils/typeHelpers";
import { type PartialConfig } from "@/src/features/evals/types";
import { Alert, AlertDescription } from "@/src/components/ui/alert";
import { Skeleton } from "@/src/components/ui/skeleton";
import { Button } from "@/src/components/ui/button";
+import { Callout } from "@/src/components/ui/callout";
import { Separator } from "@/src/components/ui/separator";
import {
DropdownMenu,
@@ -19,9 +19,27 @@ import {
DropdownMenuContent,
DropdownMenuItem,
} from "@/src/components/ui/dropdown-menu";
-import { ChevronDown } from "lucide-react";
+import { BotMessageSquare, ChevronDown, Zap } from "lucide-react";
import { useEvalCapabilities } from "@/src/features/evals/hooks/useEvalCapabilities";
-import { DEFAULT_OBSERVATION_FILTER_WHEN_REMAPPING } from "@/src/features/evals/utils/evaluator-constants";
+import { useQueryProject } from "@/src/features/projects/hooks";
+import {
+ useCanUseInAppAgent,
+ useInAppAiAgent,
+} from "@/src/features/in-app-agent/components/InAppAiAgentProvider";
+import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
+import { useEvalUpgradeAssistantPlan } from "@/src/features/v4-migration/useV4UpgradeAssistantSupport";
+import { useV4UpgradeUiEnabled } from "@/src/features/v4-migration/useV4UpgradeUiEnabled";
+import { useProjectV4SdkData } from "@/src/features/v4-migration/hooks/useV4MigrationData";
+import {
+ DEFAULT_OBSERVATION_FILTER_WHEN_REMAPPING_V3,
+ DEFAULT_OBSERVATION_FILTER_WHEN_REMAPPING,
+} from "@/src/features/evals/utils/evaluator-constants";
+import { buildModernEvaluatorsUrl } from "@/src/features/v4-migration/evaluatorMigrationUrls";
+import { useV4Beta } from "@/src/features/events/hooks/useV4Beta";
+
+const V4_DOCS_URL = "https://langfuse.com/docs/v4";
+const EVAL_MIGRATION_DOCS_URL =
+ "https://langfuse.com/faq/all/llm-as-a-judge-migration";
type LegacyEvalAction = "keep-active" | "mark-inactive" | "delete";
@@ -29,13 +47,33 @@ export default function RemapEvaluatorPage() {
const router = useRouter();
const projectId = router.query.projectId as string;
const evalConfigId = router.query.evaluator as string;
+ const v4UpgradeUiEnabled = useV4UpgradeUiEnabled();
+ const capture = usePostHogClientCapture();
+ const { organization } = useQueryProject();
+ const canUseAssistant = useCanUseInAppAgent();
+ const { openAssistant, submit } = useInAppAiAgent();
+ const sdk = useProjectV4SdkData({
+ projectId,
+ orgId: organization?.id,
+ enabled: v4UpgradeUiEnabled && Boolean(projectId),
+ });
const evalCapabilities = useEvalCapabilities(projectId);
+ const upgradePlan = useEvalUpgradeAssistantPlan({
+ projectId,
+ orgId: organization?.id,
+ enabled: v4UpgradeUiEnabled && Boolean(projectId),
+ });
const [error, setError] = useState<string | null>(null);
const [legacyAction, setLegacyAction] =
useState<LegacyEvalAction>("mark-inactive");
+ const returnFilter =
+ typeof router.query.returnFilter === "string"
+ ? router.query.returnFilter
+ : undefined;
+
// Fetch old eval config
const { data: oldConfig, isLoading: isLoadingConfig } =
api.evals.configById.useQuery(
@@ -55,11 +93,34 @@ export default function RemapEvaluatorPage() {
const utils = api.useUtils();
+ const traceLevelEvalSummary = api.v4Transition.traceLevelEvalSummary.useQuery(
+ { projectId },
+ {
+ enabled: v4UpgradeUiEnabled && Boolean(projectId),
+ refetchOnWindowFocus: false,
+ },
+ );
+
+ const redirectAfterSave = async () => {
+ utils.evals.invalidate();
+ const { data } = await traceLevelEvalSummary.refetch();
+ const remainingCount = data?.traceLevelEvalCount;
+
+ if (remainingCount === 0) {
+ await router.push(buildModernEvaluatorsUrl(projectId));
+ return;
+ }
+
+ const filterQuery = returnFilter
+ ? `?filter=${encodeURIComponent(returnFilter)}`
+ : "";
+ await router.push(`/project/${projectId}/evals${filterQuery}`);
+ };
+
// Update mutation to set old eval to INACTIVE
const updateJobMutation = api.evals.updateEvalJob.useMutation({
onSuccess: () => {
utils.evals.invalidate();
- router.push(`/project/${projectId}/evals`);
},
onError: (err) => {
setError(err.message ?? "Failed to update old eval configuration");
@@ -70,13 +131,14 @@ export default function RemapEvaluatorPage() {
const deleteJobMutation = api.evals.deleteEvalJob.useMutation({
onSuccess: () => {
utils.evals.invalidate();
- router.push(`/project/${projectId}/evals`);
},
onError: (err) => {
setError(err.message ?? "Failed to delete old eval configuration");
},
});
+ const { isBetaEnabled: isV4BetaEnabled } = useV4Beta();
+
// Map old config to new config with modern target
// Only copy scoreName - filters and variable mapping will be initialized fresh
const mappedConfig: PartialConfig | null = useMemo(() => {
@@ -90,7 +152,9 @@ export default function RemapEvaluatorPage() {
jobType: oldConfig.jobType,
filter:
oldConfig.targetObject === "trace"
- ? DEFAULT_OBSERVATION_FILTER_WHEN_REMAPPING
+ ? isV4BetaEnabled
+ ? DEFAULT_OBSERVATION_FILTER_WHEN_REMAPPING
+ : DEFAULT_OBSERVATION_FILTER_WHEN_REMAPPING_V3
: [],
variableMapping: [],
sampling: oldConfig.sampling,
@@ -99,7 +163,7 @@ export default function RemapEvaluatorPage() {
// Always set to NEW for remapped evals - new eval types cannot run on existing data
timeScope: ["NEW"],
};
- }, [oldConfig]);
+ }, [oldConfig, isV4BetaEnabled]);
const handleFormSuccess = async () => {
if (!oldConfig) return;
@@ -108,8 +172,7 @@ export default function RemapEvaluatorPage() {
switch (legacyAction) {
case "keep-active":
// Do nothing - both old and new evals will be active
- utils.evals.invalidate();
- router.push(`/project/${projectId}/evals`);
+ await redirectAfterSave();
break;
case "mark-inactive":
// Set old eval to INACTIVE
@@ -120,6 +183,7 @@ export default function RemapEvaluatorPage() {
status: "INACTIVE",
},
});
+ await redirectAfterSave();
break;
case "delete":
// Delete old eval
@@ -127,6 +191,7 @@ export default function RemapEvaluatorPage() {
projectId,
evalConfigId,
});
+ await redirectAfterSave();
break;
}
} catch (err) {
@@ -135,7 +200,17 @@ export default function RemapEvaluatorPage() {
}
};
- const isLoading = isLoadingConfig || isLoadingTemplate;
+ const handleUseAssistant = async () => {
+ capture("v4_migration:migrate_evals_with_agent_clicked");
+ const opened = openAssistant("v4_migration");
+ if (!opened) return;
+ await submit(upgradePlan.assistantPrompt, { newConversation: true });
+ };
+
+ const isLoading =
+ isLoadingConfig ||
+ isLoadingTemplate ||
+ (v4UpgradeUiEnabled && sdk.status === "checking");
return (
<Page
@@ -152,7 +227,58 @@ export default function RemapEvaluatorPage() {
}}
>
<div className="space-y-4">
- <div>
+ {v4UpgradeUiEnabled ? (
+ <Callout
+ id={"v4-evaluator-upgrade:" + evalConfigId}
+ ttlMs={7 * 24 * 60 * 60 * 1000}
+ variant="info"
+ align="top"
+ actions={() => (
+ <>
+ {canUseAssistant ? (
+ <Button
+ size="sm"
+ variant="secondary"
+ onClick={handleUseAssistant}
+ >
+ <BotMessageSquare className="mr-1.5 h-4 w-4" />
+ Use Assistant to help with upgrade
+ </Button>
+ ) : null}
+ <Button asChild size="sm" variant="secondary">
+ <a
+ href={V4_DOCS_URL}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ Docs
+ </a>
+ </Button>
+ </>
+ )}
+ >
+ <div className="flex items-start gap-2">
+ <Zap className="mt-0.5 h-4 w-4 shrink-0" />
+ <span>
+ <span className="font-bold">
+ This evaluator needs an upgrade for Langfuse v4.
+ </span>{" "}
+ Evaluators are moving to observation-level. Upgrade this
+ configuration to keep its scores aligned with the v4 data model.{" "}
+ <a
+ href={EVAL_MIGRATION_DOCS_URL}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline"
+ >
+ Learn more about evaluator upgrades
+ </a>
+ .
+ </span>
+ </div>
+ </Callout>
+ ) : null}
+ <div className="min-w-0">
<p className="text-muted-foreground text-sm">
Review your legacy evaluator on the left and configure the new eval
settings on the right.{" "}
@@ -166,20 +292,6 @@ export default function RemapEvaluatorPage() {
</a>{" "}
to upgrade successfully.
</p>
- {mappedConfig ? (
- <Alert
- variant="default"
- className="border-light-yellow bg-light-yellow mt-2"
- >
- <AlertDescription>
- <div className="flex flex-col gap-2">
- {isEventTarget(mappedConfig.targetObject ?? "event")
- ? "Running observation-targeting evaluators requires JS SDK ≥ 4.0.0 or Python SDK ≥ 3.0.0."
- : "Running observation-targeting evaluators requires JS SDK ≥ 4.4.0 or Python SDK ≥ 3.9.0."}
- </div>
- </AlertDescription>
- </Alert>
- ) : null}
</div>
<div>
@@ -195,9 +307,9 @@ export default function RemapEvaluatorPage() {
</AlertDescription>
</Alert>
) : (
- <div className="grid grid-cols-[1fr_2px_1fr] items-start">
+ <div className="grid min-w-0 grid-cols-[minmax(0,1fr)_2px_minmax(0,1fr)] items-start">
{/* LEFT: Read-only old config */}
- <div className="space-y-4 p-3">
+ <div className="min-w-0 space-y-4 p-3">
<div className="flex items-center gap-2 pb-2">
<h3 className="text-lg font-bold">
Legacy Configuration{" "}
@@ -222,13 +334,14 @@ export default function RemapEvaluatorPage() {
preventRedirect={true}
renderFooter={() => null}
evalCapabilities={evalCapabilities}
+ showPreviewTargetBadge={false}
/>
</div>
<Separator orientation="vertical" className="self-stretch" />
{/* RIGHT: Editable new config form */}
- <div className="space-y-4 p-3">
+ <div className="min-w-0 space-y-4 p-3">
<h3 className="pb-2 text-lg font-bold">
New Configuration{" "}
{isTraceTarget(oldConfig.targetObject)
@@ -247,7 +360,9 @@ export default function RemapEvaluatorPage() {
preventRedirect={true}
hideAdvancedSettings={true}
evalCapabilities={evalCapabilities}
+ showPreviewTargetBadge={false}
oldConfigId={evalConfigId}
+ hideRootObservationFilter={sdk.status === "legacy"}
renderFooter={({ isLoading, isSaveDisabled }) => (
<div className="flex w-full flex-col items-end gap-4">
<div className="flex items-center">
diff --git a/web/src/features/evals/utils/evaluator-constants.ts b/web/src/features/evals/utils/evaluator-constants.ts
index afb6e82ba1..cc9f25f1fe 100644
--- a/web/src/features/evals/utils/evaluator-constants.ts
+++ b/web/src/features/evals/utils/evaluator-constants.ts
@@ -75,3 +75,14 @@ export const DEFAULT_OBSERVATION_FILTER_WHEN_REMAPPING = [
type: "boolean" as const,
},
];
+
+// v3 SDKs do not set the app-root marker. Their top-level observations are
+// identified by having no parent observation.
+export const DEFAULT_OBSERVATION_FILTER_WHEN_REMAPPING_V3 = [
+ {
+ column: "parentObservationId",
+ operator: "is null" as const,
+ value: "" as const,
+ type: "null" as const,
+ },
+];
diff --git a/web/src/features/v4-migration/V4MigrationBadgeContent.tsx b/web/src/features/v4-migration/V4MigrationBadgeContent.tsx
index 776e7bf2db..8e1aefcc9a 100644
--- a/web/src/features/v4-migration/V4MigrationBadgeContent.tsx
+++ b/web/src/features/v4-migration/V4MigrationBadgeContent.tsx
@@ -26,14 +26,34 @@ export function V4MigrationStatusDot({
type V4MigrationBadgeContentProps = {
onClick: () => void;
title: string;
- description: string;
+ description?: string;
+ showChevron?: boolean;
+ compact?: boolean;
};
export function V4MigrationBadgeContent({
onClick,
title,
description,
+ showChevron = true,
+ compact = false,
}: V4MigrationBadgeContentProps) {
+ if (compact) {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ className="hover:bg-muted/50 hover:text-foreground inline-flex w-fit shrink-0 items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-bold whitespace-nowrap"
+ >
+ <span
+ aria-hidden
+ className="size-1.75 shrink-0 rounded-full bg-orange-400 dark:bg-orange-400"
+ />
+ {title}
+ </button>
+ );
+ }
+
return (
<span className="inline-grid flex-none shrink-0">
<span
@@ -42,8 +62,11 @@ export function V4MigrationBadgeContent({
>
<span className="size-1.75 shrink-0 rounded-full" />
<span className="flex items-center">
- {title}.&nbsp;{description}.
- <ChevronRight className="ml-1 h-3 w-3 shrink-0" />
+ {title}
+ {description ? <>&nbsp;{description}.</> : null}
+ {showChevron ? (
+ <ChevronRight className="ml-1 h-3 w-3 shrink-0" />
+ ) : null}
</span>
</span>
@@ -55,10 +78,14 @@ export function V4MigrationBadgeContent({
<V4MigrationStatusDot variant="action" />
<span className="flex items-center">
{title}
- <span className="flex max-w-0 items-center overflow-hidden transition-[max-width] duration-300 ease-out group-hover:max-w-96 group-focus-visible:max-w-96">
- <span className="whitespace-nowrap">.&nbsp;{description}.</span>
- </span>
- <ChevronRight className="ml-1 h-3 w-3 shrink-0" />
+ {description ? (
+ <span className="flex max-w-0 items-center overflow-hidden transition-[max-width] duration-300 ease-out group-hover:max-w-96 group-focus-visible:max-w-96">
+ <span className="whitespace-nowrap">.&nbsp;{description}.</span>
+ </span>
+ ) : null}
+ {showChevron ? (
+ <ChevronRight className="ml-1 h-3 w-3 shrink-0" />
+ ) : null}
</span>
</button>
</span>
diff --git a/web/src/features/v4-migration/V4MigrationDelayBadge.tsx b/web/src/features/v4-migration/V4MigrationDelayBadge.tsx
index 019920a6aa..5928879467 100644
--- a/web/src/features/v4-migration/V4MigrationDelayBadge.tsx
+++ b/web/src/features/v4-migration/V4MigrationDelayBadge.tsx
@@ -1,5 +1,4 @@
import { useState } from "react";
-import { useRouter } from "next/router";
import { useV4UpgradeUiEnabled } from "@/src/features/v4-migration/useV4UpgradeUiEnabled";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import { useQueryProject } from "@/src/features/projects/hooks";
@@ -9,17 +8,14 @@ import {
useProjectV4SdkData,
} from "@/src/features/v4-migration/hooks/useV4MigrationData";
import { useEvalUpgradeAssistantPlan } from "@/src/features/v4-migration/useV4UpgradeAssistantSupport";
-import { useCanUseInAppAgent } from "@/src/features/in-app-agent/components/InAppAiAgentProvider";
import { V4MigrationBadgeContent } from "@/src/features/v4-migration/V4MigrationBadgeContent";
import {
getCustomInstrumentationSectionState,
getOtelSectionState,
} from "@/src/features/v4-migration/sdkVersionStatus";
import { EvaluatorMigrationDialog } from "@/src/features/v4-migration/EvaluatorMigrationDialog";
-import {
- buildDeprecatedEvaluatorsUrl,
- buildEvaluatorUpgradeUrl,
-} from "@/src/features/v4-migration/evaluatorMigrationUrls";
+import { buildDeprecatedEvaluatorsUrl } from "@/src/features/v4-migration/evaluatorMigrationUrls";
+import { useRouter } from "next/router";
export function V4MigrationDelayBadge() {
const v4UpgradeUiEnabled = useV4UpgradeUiEnabled();
@@ -145,62 +141,3 @@ export function V4MigrationUpdateRequiredBadge() {
</>
);
}
-
-/** Opens the evaluator migration choices from an individual evaluator peek. */
-export function V4MigrationEvaluatorUpdateRequiredBadge({
- projectId,
- evaluatorId,
-}: {
- projectId: string;
- evaluatorId: string;
-}) {
- const router = useRouter();
- const [dialogOpen, setDialogOpen] = useState(false);
- const capture = usePostHogClientCapture();
- const canUseAssistant = useCanUseInAppAgent();
- const { organization } = useQueryProject();
- const upgradePlan = useEvalUpgradeAssistantPlan({
- projectId,
- orgId: organization?.id,
- enabled: true,
- });
- const v4UpgradeUiEnabled = useV4UpgradeUiEnabled();
-
- if (!v4UpgradeUiEnabled) return null;
-
- const handleManualUpgrade = () => {
- setDialogOpen(false);
- router.push(buildEvaluatorUpgradeUrl(projectId, evaluatorId));
- };
-
- const handleClick = () => {
- capture("v4_migration:update_required_badge_clicked", {
- scope: "single",
- });
- if (!canUseAssistant) {
- handleManualUpgrade();
- return;
- }
- setDialogOpen(true);
- };
-
- return (
- <>
- <V4MigrationBadgeContent
- onClick={handleClick}
- title="Action required"
- description={
- canUseAssistant ? "Choose how to upgrade" : "Start upgrade now"
- }
- />
- <EvaluatorMigrationDialog
- open={dialogOpen}
- onOpenChange={setDialogOpen}
- scope={{ type: "single" }}
- assistantPrompt={upgradePlan.assistantPrompt}
- onManualUpgrade={handleManualUpgrade}
- onAssistantStarted={() => undefined}
- />
- </>
- );
-}
diff --git a/web/src/features/v4-migration/evaluatorMigrationUrls.ts b/web/src/features/v4-migration/evaluatorMigrationUrls.ts
index a60a2ea38f..5ceb64e131 100644
--- a/web/src/features/v4-migration/evaluatorMigrationUrls.ts
+++ b/web/src/features/v4-migration/evaluatorMigrationUrls.ts
@@ -1,6 +1,12 @@
import { encodeFiltersGeneric, type FilterState } from "@langfuse/shared";
const DEPRECATED_EVALUATOR_FILTERS: FilterState = [
+ {
+ column: "status",
+ type: "stringOptions",
+ operator: "any of",
+ value: ["ACTIVE"],
+ },
{
column: "target",
type: "stringOptions",
@@ -9,18 +15,45 @@ const DEPRECATED_EVALUATOR_FILTERS: FilterState = [
},
];
+const MODERN_EVALUATOR_FILTERS: FilterState = [
+ {
+ column: "status",
+ type: "stringOptions",
+ operator: "any of",
+ value: ["ACTIVE"],
+ },
+ {
+ column: "target",
+ type: "stringOptions",
+ operator: "any of",
+ // The UI calls `event` evaluators observations.
+ value: ["event", "experiment"],
+ },
+];
+
+function buildEvaluatorListUrl(projectId: string, filter: FilterState) {
+ return `/project/${projectId}/evals?filter=${encodeURIComponent(
+ encodeFiltersGeneric(filter),
+ )}`;
+}
+
/** Opens the evaluator list with only the deprecated target types visible. */
export function buildDeprecatedEvaluatorsUrl(projectId: string) {
- const filter = encodeURIComponent(
- encodeFiltersGeneric(DEPRECATED_EVALUATOR_FILTERS),
- );
+ return buildEvaluatorListUrl(projectId, DEPRECATED_EVALUATOR_FILTERS);
+}
- return `/project/${projectId}/evals?filter=${filter}`;
+/** Opens the evaluator list with only active observation and experiment targets visible. */
+export function buildModernEvaluatorsUrl(projectId: string) {
+ return buildEvaluatorListUrl(projectId, MODERN_EVALUATOR_FILTERS);
}
export function buildEvaluatorUpgradeUrl(
projectId: string,
evaluatorId: string,
+ returnFilter?: string,
) {
- return `/project/${projectId}/evals/remap?evaluator=${encodeURIComponent(evaluatorId)}`;
+ const filterQuery = returnFilter
+ ? `&returnFilter=${encodeURIComponent(returnFilter)}`
+ : "";
+ return `/project/${projectId}/evals/remap?evaluator=${encodeURIComponent(evaluatorId)}${filterQuery}`;
}