Skip to content

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

feat(evals): restyle the evaluator gallery with score previews (#18709)

Trang Nguyena1a9c0c13ec6
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryDialog/EvaluatorGalleryDialog.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryDialog/EvaluatorGalleryDialog.tsx
index 01aaddf4dc..d8e2bd4a43 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryDialog/EvaluatorGalleryDialog.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryDialog/EvaluatorGalleryDialog.tsx
@@ -15,7 +15,6 @@ import {
EVALUATOR_GALLERY_ALL_SECTION_KEY,
EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY,
} from "@/src/features/evals/v2/constants/evaluatorGallery";
-import useLocalStorage from "@/src/components/useLocalStorage";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics";
import { getEvaluatorCreationAnalyticsProperties } from "@/src/features/evals/v2/fns/evaluators/getEvaluatorCreationAnalyticsProperties";
import { getTemplateSelectionAnalyticsProperties } from "@/src/features/evals/v2/fns/templateGallery/getTemplateSelectionAnalyticsProperties";
@@ -45,16 +44,11 @@ export function EvaluatorGalleryDialog({
const [expandedSections, setExpandedSections] = useState<Set<string>>(
new Set(),
);
- const searchInputRef = useRef<HTMLInputElement | null>(null);
const pendingSearchCapture = useRef<{
timeout: ReturnType<typeof setTimeout>;
queryLength: number;
} | null>(null);
const scrollContainerRef = useRef<HTMLDivElement | null>(null);
- const [bannerDismissed, setBannerDismissed] = useLocalStorage(
- "evaluatorGallery:decisionModelBannerDismissed:v1",
- false,
- );
const projectEvaluators = api.evalsV2.listGallery.useInfiniteQuery(
{
projectId,
@@ -67,6 +61,14 @@ export function EvaluatorGalleryDialog({
placeholderData: (previous) => previous,
},
);
+ // One unfiltered row: whether the project has any saved evaluators at all.
+ const anyProjectEvaluator = api.evalsV2.listGallery.useInfiniteQuery(
+ { projectId, limit: 1 },
+ {
+ enabled: open && Boolean(projectId),
+ getNextPageParam: (lastPage) => lastPage.nextCursor,
+ },
+ );
const customTemplates = (
projectEvaluators.data?.pages.flatMap((page) => page.evaluators) ?? []
).flatMap((evaluator) => {
@@ -90,6 +92,8 @@ export function EvaluatorGalleryDialog({
customTemplates,
customTemplateCount:
projectEvaluators.data?.pages[0]?.totalItems ?? customTemplates.length,
+ hasCustomTemplates:
+ (anyProjectEvaluator.data?.pages[0]?.totalItems ?? 0) > 0,
search,
});
const flushSearchCapture = () => {
@@ -188,24 +192,23 @@ export function EvaluatorGalleryDialog({
<DialogContent
className="flex h-[calc(100dvh-1rem)] max-h-[calc(100dvh-1rem)] w-[calc(100vw-1rem)] max-w-none flex-col gap-0 rounded-lg p-0 sm:h-[80dvh] sm:max-h-[85vh] sm:w-[70vw]"
closeOnInteractionOutside
- onOpenAutoFocus={(event) => {
- event.preventDefault();
- searchInputRef.current?.focus();
- }}
+ onOpenAutoFocus={(event) => event.preventDefault()}
>
<DialogHeader className="p-3 sm:p-4 [&>div]:items-start [&>div]:text-left [&>div>button]:-mt-1 [&>div>button]:-mr-2 [&>div>button]:flex [&>div>button]:size-8 [&>div>button]:items-center [&>div>button]:justify-center">
- <DialogTitle className="text-lg sm:text-xl">
- Add an evaluator
- </DialogTitle>
- <DialogDescription>
- Pick a template to start from or create a new evaluator from
- scratch.
- </DialogDescription>
+ <div className="flex items-start justify-between gap-3">
+ <div className="min-w-0">
+ <DialogTitle className="text-lg sm:text-xl">
+ Add an evaluator
+ </DialogTitle>
+ <DialogDescription>
+ Pick a template or start from scratch.
+ </DialogDescription>
+ </div>
+ </div>
</DialogHeader>
<EvaluatorGalleryView
search={search}
onSearchChange={handleSearchChange}
- searchInputRef={searchInputRef}
navigationItems={navigationItems}
activeSection={activeSection}
onSelectSection={selectSection}
@@ -224,8 +227,6 @@ export function EvaluatorGalleryDialog({
? projectEvaluators.error.message
: undefined
}
- decisionModelBannerDismissed={bannerDismissed}
- onDismissDecisionModelBanner={() => setBannerDismissed(true)}
/>
</DialogContent>
</Dialog>
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.stories.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.stories.tsx
similarity index 81%
rename from web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.stories.tsx
rename to web/src/features/evals/v2/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.stories.tsx
index 15860d25d2..20d6ea070b 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.stories.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.stories.tsx
@@ -1,4 +1,4 @@
-import preview from "../../../../../../../../.storybook/preview";
+import preview from "../../../../../../.storybook/preview";
import { EvaluatorGalleryMethodBadge } from "./EvaluatorGalleryMethodBadge";
const meta = preview.meta({ component: EvaluatorGalleryMethodBadge });
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.tsx
new file mode 100644
index 0000000000..5975d0fe0e
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.tsx
@@ -0,0 +1,21 @@
+import type { EvalTemplateType } from "@langfuse/shared";
+
+import { EVALUATOR_METHOD_PRESENTATION } from "@/src/features/evals/v2/fns/templateGallery/evaluatorMethodPresentation";
+
+type EvaluatorGalleryMethodBadgeProps = {
+ type: EvalTemplateType;
+};
+
+/** Grey type icon with the type's name. */
+export function EvaluatorGalleryMethodBadge({
+ type,
+}: EvaluatorGalleryMethodBadgeProps) {
+ const { Icon, label } = EVALUATOR_METHOD_PRESENTATION[type];
+
+ return (
+ <span className="text-muted-foreground inline-flex shrink-0 items-center gap-1.5 text-xs whitespace-nowrap">
+ <Icon className="icon-sm" aria-hidden="true" />
+ {label}
+ </span>
+ );
+}
diff --git a/web/src/features/evals/v2/components/EvaluatorGallerySectionHeader/EvaluatorGallerySectionHeader.tsx b/web/src/features/evals/v2/components/EvaluatorGallerySectionHeader/EvaluatorGallerySectionHeader.tsx
new file mode 100644
index 0000000000..0602d28393
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorGallerySectionHeader/EvaluatorGallerySectionHeader.tsx
@@ -0,0 +1,19 @@
+import type { ReactNode } from "react";
+
+/** Section title for the gallery. */
+type EvaluatorGallerySectionHeaderProps = {
+ label: string;
+ children?: ReactNode;
+};
+
+export function EvaluatorGallerySectionHeader({
+ label,
+ children,
+}: EvaluatorGallerySectionHeaderProps) {
+ return (
+ <div className="flex items-center gap-2">
+ <h4 className="text-foreground text-base font-bold">{label}</h4>
+ {children}
+ </div>
+ );
+}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.stories.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.stories.tsx
index 90c4c9ed81..f4d2db7c90 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.stories.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.stories.tsx
@@ -1,5 +1,4 @@
import { useState } from "react";
-import { User } from "lucide-react";
import { expect, fn, userEvent, waitFor } from "storybook/test";
import { EvalTemplateTypeEnum } from "@langfuse/shared";
import preview from "../../../../../../.storybook/preview";
@@ -54,6 +53,7 @@ const managedTemplate = {
icon: "gauge",
description: "Assess whether the answer directly addresses the question.",
maintainer: "langfuse",
+ previewScores: [{ name: "answer_relevance", value: "Relevant" }],
evaluator: {
type: EvalTemplateTypeEnum.LLM_AS_JUDGE,
promptMessages: [
@@ -182,7 +182,7 @@ const defaultArgs = {
search: "",
onSearchChange: fn(),
navigationItems: [
- { key: "custom", label: "Your templates", icon: User, count: 2 },
+ { key: "custom", label: "Your templates", count: 2 },
{ key: "recommended", label: "Recommended starting points", count: 3 },
{ key: "conversation", label: "Conversational / Chatbots", count: 2 },
{ key: "quality", label: "Quality", count: 7 },
@@ -195,8 +195,6 @@ const defaultArgs = {
onSelectTemplate: fn(),
onCreateFromScratch: fn(),
isLoading: false,
- decisionModelBannerDismissed: true,
- onDismissDecisionModelBanner: fn(),
};
export const Default = meta.story({
@@ -213,6 +211,7 @@ const topicDecisionModel = {
description:
"Assigns the input to one of your topics with a calibrated probability for each option, in one fast decision-model call.",
maintainer: "langfuse",
+ previewScores: [{ name: "topic", value: "billing" }],
evaluator: {
type: EvalTemplateTypeEnum.DECISION_MODEL,
questions: [
@@ -246,7 +245,6 @@ export const DecisionModels = meta.story({
args: {
...defaultArgs,
sections: sectionsWithDecisionModelCard,
- decisionModelBannerDismissed: false,
},
render: StatefulEvaluatorGalleryView,
});
@@ -263,15 +261,6 @@ export const DecisionModelsNarrow = meta.story({
},
},
},
- args: {
- ...defaultArgs,
- sections: sectionsWithDecisionModelCard,
- decisionModelBannerDismissed: false,
- },
- render: StatefulEvaluatorGalleryView,
-});
-
-export const DecisionModelsBannerDismissed = meta.story({
args: {
...defaultArgs,
sections: sectionsWithDecisionModelCard,
@@ -333,12 +322,14 @@ export const EmptySearch = meta.story({
await expect(
canvas.getByText("No templates match your search."),
).toBeInTheDocument();
- await expect(canvas.getByText("Browse")).toBeInTheDocument();
+ await expect(
+ canvas.getAllByRole("navigation", { name: "Browse categories" })[0],
+ ).toBeInTheDocument();
await expect(
canvas.getByRole("button", { name: "Quality 0" }),
).toBeInTheDocument();
await expect(
- canvas.getByRole("button", { name: "New LLM-as-a-judge" }),
+ canvas.getByRole("button", { name: /^LLM-as-a-judge/ }),
).toBeInTheDocument();
},
});
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.tsx
index 93674274ac..471041b698 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.tsx
@@ -1,12 +1,9 @@
/* eslint-disable no-nested-ternary */
import { useCallback, type RefObject } from "react";
-import { Code2, Scale, Search, Sparkles } from "lucide-react";
-import { EvalTemplateTypeEnum, type EvalTemplateType } from "@langfuse/shared";
+import type { EvalTemplateType } from "@langfuse/shared";
-import { Button } from "@/src/components/ui/button";
-import { Input } from "@/src/components/ui/input";
import { Skeleton } from "@/src/components/ui/skeleton";
-import { EvaluatorGalleryDecisionModelBanner } from "./components/EvaluatorGalleryDecisionModelBanner/EvaluatorGalleryDecisionModelBanner";
+import { EvaluatorGalleryStartRow } from "./components/EvaluatorGalleryStartRow/EvaluatorGalleryStartRow";
import { EvaluatorGallerySection } from "./components/EvaluatorGallerySection/EvaluatorGallerySection";
import { EvaluatorGallerySidebar } from "./components/EvaluatorGallerySidebar/EvaluatorGallerySidebar";
import type {
@@ -39,7 +36,6 @@ function GallerySkeleton() {
export function EvaluatorGalleryView({
search,
onSearchChange,
- searchInputRef,
navigationItems,
activeSection,
onSelectSection,
@@ -54,12 +50,9 @@ export function EvaluatorGalleryView({
isLoadingMoreProjectTemplates = false,
onLoadMoreProjectTemplates,
errorMessage,
- decisionModelBannerDismissed,
- onDismissDecisionModelBanner,
}: {
search: string;
onSearchChange: (search: string) => void;
- searchInputRef?: RefObject<HTMLInputElement | null>;
navigationItems: GalleryNavigationItem[];
activeSection: string | null;
onSelectSection: (key: string) => void;
@@ -74,8 +67,6 @@ export function EvaluatorGalleryView({
isLoadingMoreProjectTemplates?: boolean;
onLoadMoreProjectTemplates?: () => void;
errorMessage?: string;
- decisionModelBannerDismissed: boolean;
- onDismissDecisionModelBanner: () => void;
}) {
const sidebarItems = gallerySidebarItems(navigationItems, sections);
const resolvedSection =
@@ -84,7 +75,9 @@ export function EvaluatorGalleryView({
? activeSection
: EVALUATOR_GALLERY_ALL_SECTION_KEY;
const displayedSections = visibleGallerySections(sections, resolvedSection);
- const hasTemplates = displayedSections.length > 0;
+ const hasTemplates = displayedSections.some(
+ (section) => section.templates.length > 0,
+ );
const isSingleSection = resolvedSection !== EVALUATOR_GALLERY_ALL_SECTION_KEY;
const selectSection = (key: string) => {
if (key !== resolvedSection) onSearchChange("");
@@ -132,70 +125,22 @@ export function EvaluatorGalleryView({
items={sidebarItems}
activeSection={resolvedSection}
onSelectSection={selectSection}
+ search={search}
+ onSearchChange={onSearchChange}
/>
) : (
<div aria-hidden="true" className="w-56 shrink-0 border-r" />
)}
- <div className="@container flex min-w-0 flex-1 flex-col overflow-hidden">
+ <div className="bg-surface-sunken @container flex min-w-0 flex-1 flex-col overflow-hidden">
<div
ref={scrollContainerRef}
className="min-h-0 flex-1 overflow-y-auto"
>
- <div className="bg-modal sticky top-0 z-10 flex flex-col items-stretch gap-2 border-b px-4 py-3 @2xl:flex-row @2xl:items-center">
- <div className="relative min-w-0 flex-1">
- <Search className="text-muted-foreground icon-base absolute top-1/2 left-2 -translate-y-1/2" />
- <Input
- ref={searchInputRef}
- value={search}
- onChange={(event) => onSearchChange(event.target.value)}
- placeholder="Search what you want to measure."
- className="pl-8"
- />
- </div>
- <div className="flex flex-col gap-2 @sm:flex-row">
- <Button
- type="button"
- variant="secondary"
- className="flex-1 shrink-0 gap-1.5 @2xl:flex-none"
- onClick={() =>
- onCreateFromScratch(EvalTemplateTypeEnum.LLM_AS_JUDGE)
- }
- >
- <Sparkles className="icon-base" aria-hidden="true" />
- New LLM-as-a-judge
- </Button>
- <Button
- type="button"
- variant="secondary"
- className="flex-1 shrink-0 gap-1.5 @2xl:flex-none"
- onClick={() => onCreateFromScratch(EvalTemplateTypeEnum.CODE)}
- >
- <Code2 className="icon-base" aria-hidden="true" />
- New code evaluator
- </Button>
- <Button
- type="button"
- variant="secondary"
- className="flex-1 shrink-0 gap-1.5 @2xl:flex-none"
- title="Ask Jev or the OpenAI Decisions API typed questions in one call."
- onClick={() =>
- onCreateFromScratch(EvalTemplateTypeEnum.DECISION_MODEL)
- }
- >
- <Scale className="icon-base" aria-hidden="true" />
- New decision model evaluator
- </Button>
- </div>
- </div>
-
- <div className="flex flex-col gap-10 px-4 py-4">
- {!decisionModelBannerDismissed ? (
- <EvaluatorGalleryDecisionModelBanner
- onTry={() =>
- onCreateFromScratch(EvalTemplateTypeEnum.DECISION_MODEL)
- }
- onDismiss={onDismissDecisionModelBanner}
+ <div className="flex flex-col gap-12 px-4 py-4">
+ {!isSingleSection && (!search.trim() || !hasTemplates) ? (
+ <EvaluatorGalleryStartRow
+ onCreateFromScratch={onCreateFromScratch}
/>
) : null}
{isLoading ? <GallerySkeleton /> : null}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryDecisionModelBanner/EvaluatorGalleryDecisionModelBanner.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryDecisionModelBanner/EvaluatorGalleryDecisionModelBanner.tsx
deleted file mode 100644
index 69281634e0..0000000000
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryDecisionModelBanner/EvaluatorGalleryDecisionModelBanner.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { Scale, X } from "lucide-react";
-
-import { Button } from "@/src/components/ui/button";
-
-export function EvaluatorGalleryDecisionModelBanner({
- onTry,
- onDismiss,
-}: {
- onTry: () => void;
- onDismiss: () => void;
-}) {
- return (
- <div className="border-primary-accent/30 bg-primary-accent/5 relative flex flex-col gap-3 rounded-md border px-4 py-3 pr-10 text-sm @3xl:flex-row @3xl:items-center">
- <div className="flex min-w-0 items-start gap-3">
- <Scale
- className="text-primary-accent icon-base mt-0.5 shrink-0"
- aria-hidden="true"
- />
- <div className="min-w-0 flex-1">
- <span className="font-bold">New: decision-model evaluators.</span>{" "}
- <span className="text-muted-foreground">
- Ask Jev or the OpenAI Decisions API typed questions about each
- observation in one call.
- </span>
- </div>
- </div>
- <Button
- type="button"
- size="sm"
- className="shrink-0 @sm:self-start @3xl:self-auto"
- onClick={onTry}
- >
- Try a decision model
- </Button>
- <Button
- type="button"
- variant="ghost"
- size="icon-xs"
- className="absolute top-2 right-2"
- aria-label="Dismiss"
- onClick={onDismiss}
- >
- <X className="icon-sm text-icon-foreground" />
- </Button>
- </div>
- );
-}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.tsx
deleted file mode 100644
index acad9e2db1..0000000000
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { Code2, Scale, Sparkles, Tags } from "lucide-react";
-import { EvalTemplateTypeEnum, type EvalTemplateType } from "@langfuse/shared";
-
-const METHOD_BADGES = {
- [EvalTemplateTypeEnum.CODE]: { Icon: Code2, label: "Code" },
- [EvalTemplateTypeEnum.LLM_AS_JUDGE]: {
- Icon: Sparkles,
- label: "LLM judge",
- },
- [EvalTemplateTypeEnum.DECISION_MODEL]: {
- Icon: Scale,
- label: "Decision model",
- },
- [EvalTemplateTypeEnum.FACET]: { Icon: Tags, label: "Facet" },
-} as const satisfies Record<EvalTemplateType, { Icon: unknown; label: string }>;
-
-export function EvaluatorGalleryMethodBadge({
- type,
-}: {
- type: EvalTemplateType;
-}) {
- const { Icon, label } = METHOD_BADGES[type];
-
- return (
- <span className="bg-muted text-muted-foreground inline-flex h-5 shrink-0 items-center gap-1 rounded-full px-2 text-xs leading-none whitespace-nowrap">
- <Icon className="icon-sm" />
- {label}
- </span>
- );
-}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsx
index 41811bbca6..c11c8856fe 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsx
@@ -36,6 +36,7 @@ const template = {
icon: "gauge",
description: "Assess whether the answer directly addresses the question.",
maintainer: "langfuse",
+ previewScores: [{ name: "answer_relevance", value: "Relevant" }],
evaluator: {
type: EvalTemplateTypeEnum.LLM_AS_JUDGE,
promptMessages: [
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsx
index 3e44a4ee2e..8f277a2194 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsx
@@ -1,8 +1,9 @@
import { DropdownIndicator } from "@/src/components/design-system/DropdownIndicator/DropdownIndicator";
import { InfoTooltip } from "@/src/components/ui/InfoTooltip/InfoTooltip";
-import { EvaluatorRecommendedCard } from "./components/EvaluatorRecommendedCard/EvaluatorRecommendedCard";
-import { EvaluatorRecommendedCards } from "./components/EvaluatorRecommendedCards/EvaluatorRecommendedCards";
+import { EvaluatorGallerySectionHeader } from "@/src/features/evals/v2/components/EvaluatorGallerySectionHeader/EvaluatorGallerySectionHeader";
+import { EvaluatorRecommendedCard } from "@/src/features/evals/v2/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard";
+import { EvaluatorRecommendedCards } from "@/src/features/evals/v2/components/EvaluatorRecommendedCards/EvaluatorRecommendedCards";
import { EvaluatorTemplateRow } from "./components/EvaluatorTemplateRow/EvaluatorTemplateRow";
import type {
GalleryTemplate,
@@ -10,91 +11,126 @@ import type {
} from "@/src/features/evals/v2/types/templateGallery";
import {
EVALUATOR_GALLERY_PREVIEW_SIZE,
+ EVALUATOR_GALLERY_PROJECT_SECTION_KEY,
EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY,
EVALUATOR_GALLERY_SAFETY_CALLOUT,
EVALUATOR_GALLERY_SAFETY_SECTION_KEY,
} from "@/src/features/evals/v2/constants/evaluatorGallery";
-import { getGalleryCategoryPresentation } from "@/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation";
import { getGalleryTemplateId } from "@/src/features/evals/v2/fns/templateGallery/galleryTemplatePresentation";
-import { cn } from "@/src/utils/tailwind";
+
+type EvaluatorGallerySectionProps = {
+ section: GallerySection;
+ expanded: boolean;
+ onExpandedChange?: (expanded: boolean) => void;
+ onSelectTemplate: (template: GalleryTemplate, sectionKey: string) => void;
+};
+
+type ManagedGalleryTemplate = Extract<GalleryTemplate, { source: "managed" }>;
export function EvaluatorGallerySection({
section,
expanded,
onExpandedChange,
onSelectTemplate,
-}: {
- section: GallerySection;
- expanded: boolean;
- onExpandedChange?: (expanded: boolean) => void;
- onSelectTemplate: (template: GalleryTemplate, sectionKey: string) => void;
-}) {
+}: EvaluatorGallerySectionProps) {
const isRecommended =
section.key === EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY;
- const isSafety = section.key === EVALUATOR_GALLERY_SAFETY_SECTION_KEY;
const selectTemplate = (template: GalleryTemplate) =>
onSelectTemplate(template, section.key);
const shownTemplates = expanded
? section.templates
: section.templates.slice(0, EVALUATOR_GALLERY_PREVIEW_SIZE);
- const totalCount = section.totalCount ?? section.templates.length;
- const { icon: Icon, iconClassName } = getGalleryCategoryPresentation(
- section.key,
+ // Only catalog templates carry preview scores; project templates stay rows.
+ const shownManagedTemplates = shownTemplates.filter(
+ (template): template is ManagedGalleryTemplate =>
+ template.source === "managed",
);
+ const totalCount = section.totalCount ?? section.templates.length;
+ const canToggle =
+ totalCount > EVALUATOR_GALLERY_PREVIEW_SIZE && onExpandedChange;
+ const handleToggleExpanded = () => onExpandedChange?.(!expanded);
return (
<section className="flex scroll-mt-1 flex-col gap-3">
{isRecommended ? (
<EvaluatorRecommendedCards label={section.label}>
- {shownTemplates.map((template) => (
+ {shownManagedTemplates.map((template) => (
<EvaluatorRecommendedCard
- key={getGalleryTemplateId(template)}
+ key={template.key}
template={template}
onSelect={selectTemplate}
/>
))}
</EvaluatorRecommendedCards>
) : (
- <>
- <div className="flex flex-col gap-2">
- <div className="flex items-center gap-2">
- <Icon className={cn("icon-base shrink-0", iconClassName)} />
- <h4 className="text-muted-foreground text-xs font-bold tracking-wide uppercase">
- {section.label}
- </h4>
- {isSafety ? (
- <InfoTooltip label={`About ${section.label}`}>
- {EVALUATOR_GALLERY_SAFETY_CALLOUT}
- </InfoTooltip>
- ) : null}
- </div>
- <div className="border-t" />
- </div>
- <div className="flex flex-col">
- {shownTemplates.map((template) => (
- <EvaluatorTemplateRow
- key={getGalleryTemplateId(template)}
- template={template}
- onSelect={selectTemplate}
- />
- ))}
- </div>
- </>
+ <GalleryCategoryBlock
+ section={section}
+ templates={shownTemplates}
+ managedTemplates={shownManagedTemplates}
+ onSelectTemplate={selectTemplate}
+ />
)}
- {totalCount > EVALUATOR_GALLERY_PREVIEW_SIZE && onExpandedChange ? (
+ {canToggle ? (
<button
type="button"
className="text-muted-foreground hover:text-foreground flex w-fit items-center gap-1.5 px-1 text-sm"
- onClick={() => onExpandedChange(!expanded)}
+ onClick={handleToggleExpanded}
>
- {expanded ? (
- <DropdownIndicator direction="up" nudge />
- ) : (
- <DropdownIndicator nudge />
- )}
+ <DropdownIndicator direction={expanded ? "up" : "down"} nudge />
{expanded ? "Show fewer" : `Show all ${totalCount} templates`}
</button>
) : null}
</section>
);
}
+
+type GalleryCategoryBlockProps = {
+ section: GallerySection;
+ templates: GalleryTemplate[];
+ managedTemplates: ManagedGalleryTemplate[];
+ onSelectTemplate: (template: GalleryTemplate) => void;
+};
+
+/** A non-recommended section: project templates as rows, catalog ones as cards. */
+function GalleryCategoryBlock({
+ section,
+ templates,
+ managedTemplates,
+ onSelectTemplate,
+}: GalleryCategoryBlockProps) {
+ const isSafety = section.key === EVALUATOR_GALLERY_SAFETY_SECTION_KEY;
+ const isProject = section.key === EVALUATOR_GALLERY_PROJECT_SECTION_KEY;
+
+ return (
+ <>
+ <EvaluatorGallerySectionHeader label={section.label}>
+ {isSafety ? (
+ <InfoTooltip label={`About ${section.label}`}>
+ {EVALUATOR_GALLERY_SAFETY_CALLOUT}
+ </InfoTooltip>
+ ) : null}
+ </EvaluatorGallerySectionHeader>
+ {isProject ? (
+ <div className="flex flex-col">
+ {templates.map((template) => (
+ <EvaluatorTemplateRow
+ key={getGalleryTemplateId(template)}
+ template={template}
+ onSelect={onSelectTemplate}
+ />
+ ))}
+ </div>
+ ) : (
+ <div className="grid grid-cols-1 gap-3 @2xl:grid-cols-3">
+ {managedTemplates.map((template) => (
+ <EvaluatorRecommendedCard
+ key={template.key}
+ template={template}
+ onSelect={onSelectTemplate}
+ />
+ ))}
+ </div>
+ )}
+ </>
+ );
+}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.tsx
deleted file mode 100644
index 639ae9ac05..0000000000
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.tsx
+++ /dev/null
@@ -1,107 +0,0 @@
-import type { ReactNode } from "react";
-import type { EvalTemplateType } from "@langfuse/shared";
-
-import { EvaluatorGalleryMethodBadge } from "@/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge";
-import { EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY } from "@/src/features/evals/v2/constants/evaluatorGallery";
-import { getGalleryCategoryPresentation } from "@/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation";
-import {
- getGalleryTemplateCategoryKey,
- getGalleryTemplatePresentation,
-} from "@/src/features/evals/v2/fns/templateGallery/galleryTemplatePresentation";
-import type { GalleryTemplate } from "@/src/features/evals/v2/types/templateGallery";
-import { cn } from "@/src/utils/tailwind";
-
-export function EvaluatorRecommendedCardSurface({
- children,
-}: {
- children: ReactNode;
-}) {
- return (
- <div className="bg-background hover:bg-muted/40 relative flex h-full flex-col rounded-md border p-4 text-left transition-colors">
- {children}
- </div>
- );
-}
-
-export function EvaluatorRecommendedCardContent({
- icon,
- badge,
- title,
- description,
-}: {
- icon: ReactNode;
- badge: ReactNode;
- title: string;
- description: string | undefined;
-}) {
- return (
- <>
- <div className="flex items-start justify-between gap-2">
- {icon}
- {badge}
- </div>
- <span className="mt-3 line-clamp-2 text-base font-bold" title={title}>
- {title}
- </span>
- <p
- className="text-muted-foreground mt-1 line-clamp-2 text-sm leading-relaxed"
- title={description}
- >
- {description}
- </p>
- </>
- );
-}
-
-export function EvaluatorRecommendedTemplateCardContent({
- title,
- description,
- type,
- categoryKey,
-}: {
- title: string;
- description: string | undefined;
- type: EvalTemplateType;
- categoryKey?: string;
-}) {
- const { icon: Icon, iconClassName } = getGalleryCategoryPresentation(
- categoryKey ?? EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY,
- );
-
- return (
- <EvaluatorRecommendedCardContent
- icon={<Icon className={cn("icon-base shrink-0", iconClassName)} />}
- badge={<EvaluatorGalleryMethodBadge type={type} />}
- title={title}
- description={description}
- />
- );
-}
-
-export function EvaluatorRecommendedCard({
- template,
- onSelect,
-}: {
- template: GalleryTemplate;
- onSelect: (template: GalleryTemplate) => void;
-}) {
- const { description, type } = getGalleryTemplatePresentation(template);
- const categoryKey = getGalleryTemplateCategoryKey(template);
-
- return (
- <button
- type="button"
- onClick={() => onSelect(template)}
- className="h-full w-full cursor-pointer bg-transparent p-0 text-left"
- >
- <EvaluatorRecommendedCardSurface>
- <EvaluatorRecommendedTemplateCardContent
- title={template.name}
- description={description}
- type={type}
- categoryKey={categoryKey}
- />
- </EvaluatorRecommendedCardSurface>
- </button>
- );
-}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorRecommendedCards/EvaluatorRecommendedCards.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorRecommendedCards/EvaluatorRecommendedCards.tsx
deleted file mode 100644
index 490cd85ce4..0000000000
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorRecommendedCards/EvaluatorRecommendedCards.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import type { ReactNode } from "react";
-
-import { EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY } from "@/src/features/evals/v2/constants/evaluatorGallery";
-import { getGalleryCategoryPresentation } from "@/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation";
-import { cn } from "@/src/utils/tailwind";
-
-export function EvaluatorRecommendedCards({
- label,
- count,
- children,
-}: {
- label: string;
- count?: number;
- children: ReactNode;
-}) {
- const { icon: Icon, iconClassName } = getGalleryCategoryPresentation(
- EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY,
- );
-
- return (
- <div className="@container flex flex-col gap-3">
- <div className="flex flex-col gap-2">
- <div className="flex items-center gap-2">
- <Icon className={cn("icon-base shrink-0", iconClassName)} />
- <h4 className="text-muted-foreground text-xs font-bold tracking-wide uppercase">
- {label}
- </h4>
- {count != null ? (
- <span className="text-muted-foreground ml-auto font-mono text-xs tabular-nums">
- {count}
- </span>
- ) : null}
- </div>
- <div className="border-t" />
- </div>
- <div className="grid grid-cols-1 gap-3 @2xl:grid-cols-3">{children}</div>
- </div>
- );
-}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.stories.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.stories.tsx
index f1b8f04a30..6f4d9e6fdf 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.stories.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.stories.tsx
@@ -16,6 +16,7 @@ const managedTemplate = {
icon: "gauge",
description: "Assess whether the answer directly addresses the question.",
maintainer: "langfuse",
+ previewScores: [{ name: "answer_relevance", value: "Relevant" }],
evaluator: {
type: EvalTemplateTypeEnum.LLM_AS_JUDGE,
promptMessages: [
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.tsx
index ad101d84c0..75f4fed347 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorTemplateRow/EvaluatorTemplateRow.tsx
@@ -1,4 +1,4 @@
-import { EvaluatorGalleryMethodBadge } from "@/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge";
+import { EvaluatorGalleryMethodBadge } from "@/src/features/evals/v2/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge";
import { getGalleryTemplatePresentation } from "@/src/features/evals/v2/fns/templateGallery/galleryTemplatePresentation";
import type { GalleryTemplate } from "@/src/features/evals/v2/types/templateGallery";
@@ -16,24 +16,24 @@ export function EvaluatorTemplateRow({
<button
type="button"
onClick={() => onSelect(template)}
- className="hover:bg-muted/60 @container block w-full cursor-pointer rounded-md px-1 py-2.5 text-left transition-colors"
+ className="hover:bg-muted-gray/60 after:bg-border @container relative -mx-2 block cursor-pointer px-2 py-1.5 text-left transition-colors after:absolute after:inset-x-2 after:bottom-0 after:h-px last:after:hidden"
>
- <span className="grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-1 @3xl:grid-cols-[minmax(10rem,18rem)_minmax(0,1fr)_max-content_max-content]">
+ <span className="grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-1 @3xl:grid-cols-[minmax(10rem,18rem)_minmax(0,1fr)_12rem_9rem]">
<span
- className="col-start-1 row-start-1 min-w-0 truncate text-sm font-bold"
+ className="col-start-1 row-start-1 min-w-0 truncate text-xs"
title={template.name}
>
{template.name}
</span>
<span
- className="text-muted-foreground col-span-2 col-start-1 row-start-2 min-w-0 truncate text-sm @3xl:col-span-1 @3xl:col-start-2 @3xl:row-start-1"
+ className="text-muted-foreground col-span-2 col-start-1 row-start-2 min-w-0 truncate text-xs @3xl:col-span-1 @3xl:col-start-2 @3xl:row-start-1"
title={description}
>
{description}
</span>
{attribution ? (
<span
- className="text-muted-foreground/80 col-span-2 col-start-1 row-start-3 min-w-0 text-xs leading-5 whitespace-normal @3xl:col-span-1 @3xl:col-start-3 @3xl:row-start-1 @3xl:text-sm @3xl:whitespace-nowrap"
+ className="text-muted-foreground/80 col-span-2 col-start-1 row-start-3 min-w-0 text-xs leading-5 whitespace-normal @3xl:col-span-1 @3xl:col-start-3 @3xl:row-start-1 @3xl:truncate"
title={attribution}
>
{attribution}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySidebar/EvaluatorGallerySidebar.stories.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySidebar/EvaluatorGallerySidebar.stories.tsx
index 4f4e469e40..9ce7fbde38 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySidebar/EvaluatorGallerySidebar.stories.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySidebar/EvaluatorGallerySidebar.stories.tsx
@@ -36,6 +36,8 @@ export const Default = meta.story({
items,
activeSection: EVALUATOR_GALLERY_ALL_SECTION_KEY,
onSelectSection: fn(),
+ search: "",
+ onSearchChange: fn(),
},
});
@@ -44,6 +46,8 @@ export const YourTemplatesSelected = meta.story({
items,
activeSection: "custom",
onSelectSection: fn(),
+ search: "",
+ onSearchChange: fn(),
},
});
@@ -53,6 +57,8 @@ export const NarrowContainer = meta.story({
items,
activeSection: EVALUATOR_GALLERY_ALL_SECTION_KEY,
onSelectSection: fn(),
+ search: "",
+ onSearchChange: fn(),
},
});
@@ -62,6 +68,8 @@ export const SelectsYourTemplates = meta.story({
items,
activeSection: EVALUATOR_GALLERY_ALL_SECTION_KEY,
onSelectSection: fn(),
+ search: "",
+ onSearchChange: fn(),
},
play: async ({ canvas, args }) => {
await userEvent.click(
@@ -78,6 +86,8 @@ export const SelectsYourTemplatesInNarrowContainer = meta.story({
items,
activeSection: EVALUATOR_GALLERY_ALL_SECTION_KEY,
onSelectSection: fn(),
+ search: "",
+ onSearchChange: fn(),
},
play: async ({ canvas, args }) => {
await userEvent.click(canvas.getByRole("combobox"));
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySidebar/EvaluatorGallerySidebar.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySidebar/EvaluatorGallerySidebar.tsx
index 0db4a12210..7f1b21d249 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySidebar/EvaluatorGallerySidebar.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySidebar/EvaluatorGallerySidebar.tsx
@@ -1,4 +1,5 @@
import { Button } from "@/src/components/ui/button";
+import { SearchInput } from "@/src/components/design-system/SearchInput/SearchInput";
import {
Select,
SelectContent,
@@ -7,18 +8,23 @@ import {
SelectValue,
} from "@/src/components/ui/select";
import { cn } from "@/src/utils/tailwind";
-import { getGalleryCategoryPresentation } from "@/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation";
import type { GalleryNavigationItem } from "@/src/features/evals/v2/types/templateGallery";
+type EvaluatorGallerySidebarProps = {
+ items: GalleryNavigationItem[];
+ activeSection: string | null;
+ onSelectSection: (key: string) => void;
+ search: string;
+ onSearchChange: (search: string) => void;
+};
+
export function EvaluatorGallerySidebar({
items,
activeSection,
onSelectSection,
-}: {
- items: GalleryNavigationItem[];
- activeSection: string | null;
- onSelectSection: (key: string) => void;
-}) {
+ search,
+ onSearchChange,
+}: EvaluatorGallerySidebarProps) {
const selectedSection = activeSection ?? items[0]?.key;
const selectedItem = items.find((item) => item.key === selectedSection);
@@ -28,14 +34,11 @@ export function EvaluatorGallerySidebar({
aria-label="Browse categories"
className="hidden w-56 shrink-0 flex-col gap-0.5 overflow-y-auto border-r p-4 @2xl:flex"
>
- <div className="text-muted-foreground px-3 pb-2 text-xs font-bold tracking-wide uppercase">
- Browse
+ <div className="pb-2">
+ <GallerySearch search={search} onSearchChange={onSearchChange} />
</div>
{items.map((item) => {
const isActive = selectedSection === item.key;
- const { icon: FallbackIcon, iconClassName } =
- getGalleryCategoryPresentation(item.key);
- const Icon = item.icon ?? FallbackIcon;
return (
<Button
@@ -51,7 +54,6 @@ export function EvaluatorGallerySidebar({
aria-current={isActive ? "page" : undefined}
onClick={() => onSelectSection(item.key)}
>
- <Icon className={cn("icon-base mr-2 shrink-0", iconClassName)} />
<span className="flex min-w-0 flex-1 items-baseline justify-between gap-3">
<span className="truncate" title={item.label}>
{item.label}
@@ -67,7 +69,11 @@ export function EvaluatorGallerySidebar({
})}
</nav>
- <nav aria-label="Browse categories" className="border-b p-3 @2xl:hidden">
+ <nav
+ aria-label="Browse categories"
+ className="flex flex-col gap-2 border-b p-3 @2xl:hidden"
+ >
+ <GallerySearch search={search} onSearchChange={onSearchChange} />
<Select value={selectedSection} onValueChange={onSelectSection}>
<SelectTrigger aria-label="Browse categories" className="w-full">
<SelectValue placeholder="Browse categories">
@@ -99,3 +105,19 @@ export function EvaluatorGallerySidebar({
</>
);
}
+
+type GallerySearchProps = {
+ search: string;
+ onSearchChange: (search: string) => void;
+};
+
+function GallerySearch({ search, onSearchChange }: GallerySearchProps) {
+ return (
+ <SearchInput
+ value={search}
+ onChange={onSearchChange}
+ onSubmit={onSearchChange}
+ placeholder="Search templates"
+ />
+ );
+}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/EvaluatorGalleryStartRow.module.css b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/EvaluatorGalleryStartRow.module.css
new file mode 100644
index 0000000000..fefa91ee14
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/EvaluatorGalleryStartRow.module.css
@@ -0,0 +1,5 @@
+.card:hover {
+ box-shadow:
+ 0 1px 2px 0 rgb(0 0 0 / 0.06),
+ 0 6px 14px -2px rgb(0 0 0 / 0.12);
+}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/EvaluatorGalleryStartRow.stories.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/EvaluatorGalleryStartRow.stories.tsx
new file mode 100644
index 0000000000..3fe89e9907
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/EvaluatorGalleryStartRow.stories.tsx
@@ -0,0 +1,34 @@
+import { expect, fn, userEvent } from "storybook/test";
+import { EvalTemplateTypeEnum } from "@langfuse/shared";
+
+import preview from "../../../../../../../../.storybook/preview";
+import { EvaluatorGalleryStartRow } from "./EvaluatorGalleryStartRow";
+
+const meta = preview.meta({
+ component: EvaluatorGalleryStartRow,
+ decorators: [
+ (Story) => (
+ <div className="@container w-full">
+ <Story />
+ </div>
+ ),
+ ],
+});
+
+export const Default = meta.story({
+ args: { onCreateFromScratch: fn() },
+});
+
+export const CreatesDecisionModel = meta.story({
+ name: "(Test) Starts a blank decision model",
+ args: { onCreateFromScratch: fn() },
+ play: async ({ canvas, args }) => {
+ await expect(canvas.getByText("NEW")).toBeVisible();
+ await userEvent.click(
+ canvas.getByRole("button", { name: /^Decision model/ }),
+ );
+ await expect(args.onCreateFromScratch).toHaveBeenCalledWith(
+ EvalTemplateTypeEnum.DECISION_MODEL,
+ );
+ },
+});
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/EvaluatorGalleryStartRow.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/EvaluatorGalleryStartRow.tsx
new file mode 100644
index 0000000000..207dc34d48
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/EvaluatorGalleryStartRow.tsx
@@ -0,0 +1,93 @@
+import { EvalTemplateTypeEnum, type EvalTemplateType } from "@langfuse/shared";
+
+import { Badge } from "@/src/components/design-system/Badge/Badge";
+
+import { EvaluatorGallerySectionHeader } from "@/src/features/evals/v2/components/EvaluatorGallerySectionHeader/EvaluatorGallerySectionHeader";
+import { cn } from "@/src/utils/tailwind";
+
+import { EvaluatorMethodTile } from "./components/EvaluatorMethodTile/EvaluatorMethodTile";
+import styles from "./EvaluatorGalleryStartRow.module.css";
+
+const EVALUATOR_START_OPTIONS = [
+ {
+ type: EvalTemplateTypeEnum.LLM_AS_JUDGE,
+ title: "LLM-as-a-judge",
+ description: "Explains each score, for nuanced inputs.",
+ },
+ {
+ type: EvalTemplateTypeEnum.DECISION_MODEL,
+ title: "Decision model",
+ isNew: true,
+ description: "Fast and cheap for simple questions.",
+ },
+ {
+ type: EvalTemplateTypeEnum.CODE,
+ title: "Code",
+ description: "Exact rules, no model call.",
+ },
+] as const;
+
+type EvaluatorGalleryStartRowProps = {
+ onCreateFromScratch: (type: EvalTemplateType) => void;
+};
+
+/** The three blank evaluator types, always visible above the templates. */
+export function EvaluatorGalleryStartRow({
+ onCreateFromScratch,
+}: EvaluatorGalleryStartRowProps) {
+ return (
+ <section className="flex flex-col gap-3">
+ <EvaluatorGallerySectionHeader label="Start from scratch" />
+ <div className="grid grid-cols-1 gap-3 @2xl:grid-cols-3">
+ {EVALUATOR_START_OPTIONS.map((option) => (
+ <StartOptionCard
+ key={option.type}
+ option={option}
+ onCreateFromScratch={onCreateFromScratch}
+ />
+ ))}
+ </div>
+ </section>
+ );
+}
+
+type StartOptionCardProps = {
+ option: (typeof EVALUATOR_START_OPTIONS)[number];
+ onCreateFromScratch: (type: EvalTemplateType) => void;
+};
+
+function StartOptionCard({
+ option,
+ onCreateFromScratch,
+}: StartOptionCardProps) {
+ const handleCreate = () => onCreateFromScratch(option.type);
+
+ return (
+ <button
+ type="button"
+ onClick={handleCreate}
+ className={cn(
+ styles.card,
+ "bg-popover flex cursor-pointer items-center gap-3 rounded-lg border p-3 text-left",
+ )}
+ >
+ <EvaluatorMethodTile type={option.type} />
+ <span className="flex min-w-0 flex-col">
+ <span className="flex items-center gap-1.5 text-xs font-bold">
+ {option.title}
+ {"isNew" in option ? <EvaluatorNewBadge /> : null}
+ </span>
+ <span
+ className="text-muted-foreground truncate text-xs"
+ title={option.description}
+ >
+ {option.description}
+ </span>
+ </span>
+ </button>
+ );
+}
+
+function EvaluatorNewBadge() {
+ return <Badge text="NEW" color="green" font="mono" size="sm" />;
+}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/components/EvaluatorMethodTile/EvaluatorMethodTile.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/components/EvaluatorMethodTile/EvaluatorMethodTile.tsx
new file mode 100644
index 0000000000..a0a5bfa095
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGalleryStartRow/components/EvaluatorMethodTile/EvaluatorMethodTile.tsx
@@ -0,0 +1,24 @@
+import type { EvalTemplateType } from "@langfuse/shared";
+
+import { EVALUATOR_METHOD_PRESENTATION } from "@/src/features/evals/v2/fns/templateGallery/evaluatorMethodPresentation";
+import { cn } from "@/src/utils/tailwind";
+
+type EvaluatorMethodTileProps = {
+ type: EvalTemplateType;
+};
+
+/** The type icon on its pastel tile. */
+export function EvaluatorMethodTile({ type }: EvaluatorMethodTileProps) {
+ const { Icon, tileClassName } = EVALUATOR_METHOD_PRESENTATION[type];
+
+ return (
+ <span
+ className={cn(
+ "inline-flex size-10 shrink-0 items-center justify-center rounded-md",
+ tileClassName,
+ )}
+ >
+ <Icon className="icon-base" aria-hidden="true" />
+ </span>
+ );
+}
diff --git a/web/src/features/evals/v2/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.module.css b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.module.css
new file mode 100644
index 0000000000..fefa91ee14
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.module.css
@@ -0,0 +1,5 @@
+.card:hover {
+ box-shadow:
+ 0 1px 2px 0 rgb(0 0 0 / 0.06),
+ 0 6px 14px -2px rgb(0 0 0 / 0.12);
+}
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.stories.tsx b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.stories.tsx
similarity index 87%
rename from web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.stories.tsx
rename to web/src/features/evals/v2/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.stories.tsx
index 04fc386cd9..c9f862ba30 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.stories.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.stories.tsx
@@ -1,9 +1,9 @@
import { fn, userEvent, expect } from "storybook/test";
import { EvalTemplateTypeEnum } from "@langfuse/shared";
-import preview from "../../../../../../../../../../.storybook/preview";
+import preview from "../../../../../../.storybook/preview";
import { EvaluatorRecommendedCard } from "./EvaluatorRecommendedCard";
-import type { GalleryTemplate } from "../../../../../../types/templateGallery";
+import type { GalleryTemplate } from "../../types/templateGallery";
const template = {
source: "managed",
@@ -13,6 +13,7 @@ const template = {
icon: "message-square",
description: "Classifies user questions into predefined intent buckets.",
maintainer: "langfuse",
+ previewScores: [{ name: "chat_intent", value: "billing_question" }],
evaluator: {
type: EvalTemplateTypeEnum.LLM_AS_JUDGE,
promptMessages: [{ role: "user", content: "Classify {{input}}." }],
diff --git a/web/src/features/evals/v2/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.tsx b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.tsx
new file mode 100644
index 0000000000..af486d5e50
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard.tsx
@@ -0,0 +1,59 @@
+import { EvaluatorGalleryMethodBadge } from "@/src/features/evals/v2/components/EvaluatorGalleryMethodBadge/EvaluatorGalleryMethodBadge";
+import { getGalleryTemplatePresentation } from "@/src/features/evals/v2/fns/templateGallery/galleryTemplatePresentation";
+import type { GalleryTemplate } from "@/src/features/evals/v2/types/templateGallery";
+import { cn } from "@/src/utils/tailwind";
+
+import { EvaluatorGalleryScorePreview } from "./components/EvaluatorGalleryScorePreview/EvaluatorGalleryScorePreview";
+import styles from "./EvaluatorRecommendedCard.module.css";
+
+type EvaluatorRecommendedCardProps = {
+ template: Extract<GalleryTemplate, { source: "managed" }>;
+ onSelect: (template: GalleryTemplate) => void;
+};
+
+export function EvaluatorRecommendedCard({
+ template,
+ onSelect,
+}: EvaluatorRecommendedCardProps) {
+ const { description, type } = getGalleryTemplatePresentation(template);
+ const handleSelect = () => onSelect(template);
+
+ return (
+ <button
+ type="button"
+ onClick={handleSelect}
+ className="h-full w-full cursor-pointer bg-transparent p-0 text-left"
+ >
+ <div
+ className={cn(
+ styles.card,
+ "group/card bg-popover relative flex h-full flex-col overflow-hidden rounded-lg border text-left",
+ )}
+ >
+ <div className="px-3 pt-3">
+ <EvaluatorGalleryScorePreview
+ scores={template.previewScores}
+ type={type}
+ />
+ </div>
+ <div className="flex flex-1 flex-col px-3 pt-3 pb-3">
+ <span
+ className="line-clamp-2 text-xs font-bold"
+ title={template.name}
+ >
+ {template.name}
+ </span>
+ <p
+ className="text-muted-foreground mt-1 line-clamp-2 text-xs"
+ title={description}
+ >
+ {description}
+ </p>
+ </div>
+ <div className="flex items-center px-3 pb-3">
+ <EvaluatorGalleryMethodBadge type={type} />
+ </div>
+ </div>
+ </button>
+ );
+}
diff --git a/web/src/features/evals/v2/components/EvaluatorRecommendedCard/components/EvaluatorGalleryScorePreview/EvaluatorGalleryScorePreview.module.css b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/components/EvaluatorGalleryScorePreview/EvaluatorGalleryScorePreview.module.css
new file mode 100644
index 0000000000..ef131b7c02
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/components/EvaluatorGalleryScorePreview/EvaluatorGalleryScorePreview.module.css
@@ -0,0 +1,51 @@
+/* Base well apart from the chip's bg-muted (darker in light mode, lighter in
+ dark); a faint mesh in the type hue; light grain. */
+.preview {
+ --preview-base: hsl(var(--muted-gray));
+ position: relative;
+ isolation: isolate;
+ background:
+ radial-gradient(
+ 70% 120% at 25% 10%,
+ color-mix(in srgb, var(--mesh-hue, transparent) 11%, transparent),
+ transparent 70%
+ ),
+ radial-gradient(
+ 60% 100% at 80% 90%,
+ color-mix(in srgb, var(--mesh-hue, transparent) 6%, transparent),
+ transparent 70%
+ ),
+ var(--preview-base);
+}
+
+:global(.dark) .preview {
+ --preview-base: hsl(var(--control-track));
+}
+
+.preview::after {
+ content: "";
+ position: absolute;
+ inset: 0;
+ z-index: -1;
+ pointer-events: none;
+ opacity: 0.15;
+ mix-blend-mode: multiply;
+ background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
+}
+
+:global(.dark) .preview::after {
+ mix-blend-mode: screen;
+ opacity: 0.06;
+}
+
+.judge {
+ --mesh-hue: hsl(var(--dark-blue));
+}
+
+.decisionModel {
+ --mesh-hue: var(--color-category-violet);
+}
+
+.code {
+ --mesh-hue: var(--color-category-orange);
+}
diff --git a/web/src/features/evals/v2/components/EvaluatorRecommendedCard/components/EvaluatorGalleryScorePreview/EvaluatorGalleryScorePreview.stories.tsx b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/components/EvaluatorGalleryScorePreview/EvaluatorGalleryScorePreview.stories.tsx
new file mode 100644
index 0000000000..c9936cedb1
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/components/EvaluatorGalleryScorePreview/EvaluatorGalleryScorePreview.stories.tsx
@@ -0,0 +1,42 @@
+import preview from "../../../../../../../../.storybook/preview";
+import { EvaluatorGalleryScorePreview } from "./EvaluatorGalleryScorePreview";
+import { MANAGED_TEMPLATES_CATALOG } from "../../../../constants/managedTemplatesCatalog";
+
+function catalogPreview(key: string) {
+ const template = MANAGED_TEMPLATES_CATALOG.templates.find(
+ (candidate) => candidate.key === key,
+ );
+ if (!template) throw new Error(`Catalog template ${key} not found`);
+ return { scores: template.previewScores, type: template.evaluator.type };
+}
+
+const meta = preview.meta({
+ component: EvaluatorGalleryScorePreview,
+ decorators: [
+ (Story) => (
+ <div className="w-72">
+ <Story />
+ </div>
+ ),
+ ],
+});
+
+export const LlmAsAJudge = meta.story({
+ args: catalogPreview("out-of-scope-request"),
+});
+
+export const DecisionModel = meta.story({
+ args: catalogPreview("topic-decision-model"),
+});
+
+export const Code = meta.story({
+ args: catalogPreview("exact-match"),
+});
+
+export const LongValue = meta.story({
+ args: catalogPreview("context-precision"),
+});
+
+export const OverflowCount = meta.story({
+ args: catalogPreview("conversation-signals"),
+});
diff --git a/web/src/features/evals/v2/components/EvaluatorRecommendedCard/components/EvaluatorGalleryScorePreview/EvaluatorGalleryScorePreview.tsx b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/components/EvaluatorGalleryScorePreview/EvaluatorGalleryScorePreview.tsx
new file mode 100644
index 0000000000..a02d739b55
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorRecommendedCard/components/EvaluatorGalleryScorePreview/EvaluatorGalleryScorePreview.tsx
@@ -0,0 +1,77 @@
+import { ChevronRight } from "lucide-react";
+import { EvalTemplateTypeEnum, type EvalTemplateType } from "@langfuse/shared";
+
+import { BadgeShell } from "@/src/components/design-system/Badge/Badge";
+import type { ManagedTemplate } from "@/src/features/evals/v2/types/templateGallery";
+import { cn } from "@/src/utils/tailwind";
+
+import styles from "./EvaluatorGalleryScorePreview.module.css";
+
+const MAX_VISIBLE_SCORES = 1;
+
+const MESH_TINT: Partial<Record<EvalTemplateType, string>> = {
+ [EvalTemplateTypeEnum.LLM_AS_JUDGE]: styles.judge,
+ [EvalTemplateTypeEnum.DECISION_MODEL]: styles.decisionModel,
+ [EvalTemplateTypeEnum.CODE]: styles.code,
+};
+
+/** Sample `name: value` chips on a type-tinted mesh, styled like trace score badges. */
+type EvaluatorGalleryScorePreviewProps = {
+ scores: ManagedTemplate["previewScores"];
+ type: EvalTemplateType;
+};
+
+export function EvaluatorGalleryScorePreview({
+ scores,
+ type,
+}: EvaluatorGalleryScorePreviewProps) {
+ const visibleScores = scores.slice(0, MAX_VISIBLE_SCORES);
+ const hiddenCount = scores.length - visibleScores.length;
+
+ return (
+ <div
+ aria-hidden="true"
+ className={cn(
+ styles.preview,
+ MESH_TINT[type],
+ "flex h-20 items-center justify-center gap-1 overflow-hidden rounded-md px-3",
+ )}
+ >
+ <div className="flex max-w-full min-w-0 items-center justify-center gap-1">
+ {visibleScores.map((score) => (
+ <span key={score.name} className="flex min-w-0">
+ <BadgeShell color="filled" size="md">
+ <span className="text-muted-foreground flex min-w-0 font-mono">
+ <span className="truncate py-0.5" title={score.name}>
+ {score.name}
+ </span>
+ <span className="py-0.5">:</span>
+ </span>
+ <span
+ className="text-foreground truncate py-0.5 font-mono"
+ title={score.value}
+ >
+ {score.value}
+ </span>
+ </BadgeShell>
+ </span>
+ ))}
+ {hiddenCount > 0 ? (
+ <BadgeShell color="filled" size="md">
+ <span className="text-muted-foreground py-0.5 font-mono">
+ +{hiddenCount}
+ </span>
+ </BadgeShell>
+ ) : null}
+ </div>
+ {/* Shown while the parent card (group/card) is hovered. */}
+ <div className="absolute inset-0 hidden items-center justify-center bg-black/40 text-white backdrop-blur-xs group-hover/card:flex">
+ <span className="flex items-center gap-1 text-sm font-bold">
+ Use template
+ {/* Same optical nudge as DropdownIndicator for icons beside text. */}
+ <ChevronRight className="icon-base translate-y-px" />
+ </span>
+ </div>
+ </div>
+ );
+}
diff --git a/web/src/features/evals/v2/components/EvaluatorRecommendedCards/EvaluatorRecommendedCards.tsx b/web/src/features/evals/v2/components/EvaluatorRecommendedCards/EvaluatorRecommendedCards.tsx
new file mode 100644
index 0000000000..93d19d4118
--- /dev/null
+++ b/web/src/features/evals/v2/components/EvaluatorRecommendedCards/EvaluatorRecommendedCards.tsx
@@ -0,0 +1,26 @@
+import type { ReactNode } from "react";
+
+import { EvaluatorGallerySectionHeader } from "@/src/features/evals/v2/components/EvaluatorGallerySectionHeader/EvaluatorGallerySectionHeader";
+
+export function EvaluatorRecommendedCards({
+ label,
+ count,
+ children,
+}: {
+ label: string;
+ count?: number;
+ children: ReactNode;
+}) {
+ return (
+ <div className="@container flex flex-col gap-3">
+ <EvaluatorGallerySectionHeader label={label}>
+ {count != null ? (
+ <span className="text-muted-foreground ml-auto font-mono text-xs tabular-nums">
+ {count}
+ </span>
+ ) : null}
+ </EvaluatorGallerySectionHeader>
+ <div className="grid grid-cols-1 gap-3 @2xl:grid-cols-3">{children}</div>
+ </div>
+ );
+}
diff --git a/web/src/features/evals/v2/components/Evaluators/EvaluationTypeConfiguration/components/EvaluationTypeToggle/EvaluationTypeToggle.tsx b/web/src/features/evals/v2/components/Evaluators/EvaluationTypeConfiguration/components/EvaluationTypeToggle/EvaluationTypeToggle.tsx
index 30c31e1c4c..e55c1ea3fe 100644
--- a/web/src/features/evals/v2/components/Evaluators/EvaluationTypeConfiguration/components/EvaluationTypeToggle/EvaluationTypeToggle.tsx
+++ b/web/src/features/evals/v2/components/Evaluators/EvaluationTypeConfiguration/components/EvaluationTypeToggle/EvaluationTypeToggle.tsx
@@ -1,4 +1,3 @@
-import { Code2, Scale, Sparkles } from "lucide-react";
import { EvalTemplateTypeEnum, type EvalTemplateType } from "@langfuse/shared";
import { Tabs } from "@/src/components/design-system/Tabs/Tabs";
@@ -9,22 +8,23 @@ import {
SelectTrigger,
SelectValue,
} from "@/src/components/ui/select";
+import { getEvaluatorMethodIcon } from "@/src/features/evals/v2/fns/templateGallery/evaluatorMethodPresentation";
const evaluationTypes = [
{
value: EvalTemplateTypeEnum.LLM_AS_JUDGE,
label: "LLM-as-a-judge",
- icon: Sparkles,
+ icon: getEvaluatorMethodIcon(EvalTemplateTypeEnum.LLM_AS_JUDGE),
},
{
value: EvalTemplateTypeEnum.CODE,
label: "Code evaluator",
- icon: Code2,
+ icon: getEvaluatorMethodIcon(EvalTemplateTypeEnum.CODE),
},
{
value: EvalTemplateTypeEnum.DECISION_MODEL,
label: "Decision model",
- icon: Scale,
+ icon: getEvaluatorMethodIcon(EvalTemplateTypeEnum.DECISION_MODEL),
},
] as const;
diff --git a/web/src/features/evals/v2/components/EvaluatorsEmptyState/EvaluatorsEmptyState.tsx b/web/src/features/evals/v2/components/EvaluatorsEmptyState/EvaluatorsEmptyState.tsx
index fc51d6d04b..28951d7913 100644
--- a/web/src/features/evals/v2/components/EvaluatorsEmptyState/EvaluatorsEmptyState.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorsEmptyState/EvaluatorsEmptyState.tsx
@@ -1,9 +1,4 @@
import { usePostHogClientCapture } from "@/src/features/posthog-analytics";
-import {
- useIsInAppAgentLauncherVisible,
- useInAppAiAgent,
-} from "@/src/features/in-app-agent";
-import { DETECT_TOPICS_ASSISTANT_PROMPT } from "@/src/features/evals/v2/constants/evaluatorEmptyState";
import { EvaluatorsEmptyStateView } from "./components/EvaluatorsEmptyStateView/EvaluatorsEmptyStateView";
import { prepareEvaluatorEmptyState } from "@/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState";
import type { GalleryTemplate } from "@/src/features/evals/v2/types/templateGallery";
@@ -17,11 +12,6 @@ export function EvaluatorsEmptyState({
onBrowseLibrary: () => void;
}) {
const capture = usePostHogClientCapture();
- // Launcher visibility, not `useCanUseInAppAgent`: with org AI features off
- // the action still shows and `openAssistant` opens the dialog that turns
- // them on, exactly like every other assistant entry point.
- const isAssistantLauncherVisible = useIsInAppAgentLauncherVisible();
- const { openAssistant, submit } = useInAppAiAgent();
const emptyState = prepareEvaluatorEmptyState();
const handleSelectTemplate = (template: GalleryTemplate) => {
@@ -42,34 +32,12 @@ export function EvaluatorsEmptyState({
onSelectTemplate(template);
};
- const handleDetectTopics = () => {
- const openedAssistant = openAssistant("evaluators_empty_state");
- capture("evaluators:empty_state_detect_topics", {
- openedAssistant,
- });
-
- // False means the enable-AI-features dialog took over; the prompt would be
- // submitted into an assistant the user cannot reach yet.
- if (!openedAssistant) {
- return;
- }
-
- submit(DETECT_TOPICS_ASSISTANT_PROMPT, {
- newConversation: true,
- entryPoint: "evaluators-empty-state",
- }).catch(() => undefined);
- };
-
return (
<div className="max-h-full overflow-y-auto">
<EvaluatorsEmptyStateView
startingPoints={emptyState.startingPoints}
- templateCount={emptyState.templateCount}
docsHref={emptyState.docsHref}
onSelectTemplate={handleSelectTemplate}
- onDetectTopics={
- isAssistantLauncherVisible ? handleDetectTopics : undefined
- }
onBrowseLibrary={() => {
capture("evaluators:empty_state_browse_library");
capture("eval:onboarding_started", {
diff --git a/web/src/features/evals/v2/components/EvaluatorsEmptyState/components/EvaluatorsEmptyStateView/EvaluatorsEmptyStateView.stories.tsx b/web/src/features/evals/v2/components/EvaluatorsEmptyState/components/EvaluatorsEmptyStateView/EvaluatorsEmptyStateView.stories.tsx
index 2bf5a7ac23..b567a26738 100644
--- a/web/src/features/evals/v2/components/EvaluatorsEmptyState/components/EvaluatorsEmptyStateView/EvaluatorsEmptyStateView.stories.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorsEmptyState/components/EvaluatorsEmptyStateView/EvaluatorsEmptyStateView.stories.tsx
@@ -1,143 +1,36 @@
import { expect, fn, userEvent } from "storybook/test";
-import { EvalTemplateTypeEnum } from "@langfuse/shared";
import preview from "../../../../../../../../.storybook/preview";
import { EVALUATOR_EMPTY_STATE_DOCS_HREF } from "@/src/features/evals/v2/constants/evaluatorEmptyState";
-import type { EvaluatorEmptyStateStartingPoint } from "@/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState";
+import { prepareEvaluatorEmptyState } from "@/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState";
import { EvaluatorsEmptyStateView } from "./EvaluatorsEmptyStateView";
-const startingPoints = [
- {
- action: "detect-topics",
- template: {
- source: "managed",
- key: "topic-classifier",
- name: "Classify input topic",
- categories: ["classifier"],
- icon: "tags",
- description: "Assigns the input to one of a predefined set of topics.",
- maintainer: "langfuse",
- evaluator: {
- type: EvalTemplateTypeEnum.LLM_AS_JUDGE,
- promptMessages: [{ role: "user", content: "Classify {{input}}." }],
- variables: [{ name: "input", defaultMapping: { field: "input" } }],
- outputDefinition: {
- dataType: "CATEGORICAL",
- score: {
- description: "Topic.",
- categories: ["support", "other"],
- shouldAllowMultipleMatches: false,
- },
- reasoning: { description: "One sentence." },
- },
- },
- },
- title: "Detect Topics",
- description:
- "Classify the requests going through your system to better understand volumes of different categories.",
- },
- {
- action: "select-template",
- template: {
- source: "managed",
- key: "user-disagreement",
- name: "Detect User Disagreement",
- categories: ["conversation"],
- icon: "messages-square",
- description: "Detects whether the user is pushing back on the assistant.",
- maintainer: "langfuse",
- evaluator: {
- type: EvalTemplateTypeEnum.LLM_AS_JUDGE,
- promptMessages: [
- {
- role: "user",
- content: "Decide whether {{last_user_message}} is disagreement.",
- },
- ],
- variables: [
- { name: "last_user_message", defaultMapping: { field: "input" } },
- ],
- outputDefinition: {
- dataType: "BOOLEAN",
- score: { description: "True if disagreement is present." },
- reasoning: { description: "One sentence." },
- },
- },
- },
- },
-] satisfies EvaluatorEmptyStateStartingPoint[];
+const { startingPoints } = prepareEvaluatorEmptyState();
const meta = preview.meta({ component: EvaluatorsEmptyStateView });
export const Default = meta.story({
args: {
startingPoints,
- templateCount: 21,
- docsHref: EVALUATOR_EMPTY_STATE_DOCS_HREF,
- onSelectTemplate: fn(),
- onDetectTopics: fn(),
- onBrowseLibrary: fn(),
- },
-});
-
-export const OpensDetectTopics = meta.story({
- name: "(Test) Opens Detect Topics via the assistant action",
- args: {
- startingPoints,
- templateCount: 21,
- docsHref: EVALUATOR_EMPTY_STATE_DOCS_HREF,
- onSelectTemplate: fn(),
- onDetectTopics: fn(),
- onBrowseLibrary: fn(),
- },
- play: async ({ canvas, args }) => {
- await userEvent.click(
- canvas.getByRole("button", { name: "Set up with AI" }),
- );
- await expect(args.onDetectTopics).toHaveBeenCalledOnce();
- await expect(args.onSelectTemplate).not.toHaveBeenCalled();
- },
-});
-
-export const SetsUpDetectTopicsFromTheTemplate = meta.story({
- name: "(Test) Sets up Detect Topics from the managed template",
- args: {
- startingPoints,
- templateCount: 21,
docsHref: EVALUATOR_EMPTY_STATE_DOCS_HREF,
onSelectTemplate: fn(),
- onDetectTopics: fn(),
onBrowseLibrary: fn(),
},
- play: async ({ canvas, args }) => {
- await userEvent.click(
- canvas.getByRole("button", { name: "Set up Detect Topics" }),
- );
- await expect(args.onSelectTemplate).toHaveBeenCalledWith(
- startingPoints[0]?.template,
- );
- await expect(args.onDetectTopics).not.toHaveBeenCalled();
- },
});
export const SelectsAStartingPoint = meta.story({
name: "(Test) Selects a starting-point template",
args: {
startingPoints,
- templateCount: 21,
docsHref: EVALUATOR_EMPTY_STATE_DOCS_HREF,
onSelectTemplate: fn(),
- onDetectTopics: fn(),
onBrowseLibrary: fn(),
},
play: async ({ canvas, args }) => {
await userEvent.click(
- canvas.getByRole("button", { name: /Detect User Disagreement/ }),
- );
- await expect(args.onSelectTemplate).toHaveBeenCalledWith(
- startingPoints[1]?.template,
+ canvas.getByRole("button", { name: /Rate Customer Frustration/ }),
);
- await expect(args.onDetectTopics).not.toHaveBeenCalled();
+ await expect(args.onSelectTemplate).toHaveBeenCalledWith(startingPoints[2]);
},
});
@@ -145,15 +38,15 @@ export const OpensTheLibrary = meta.story({
name: "(Test) Opens the template library",
args: {
startingPoints,
- templateCount: 21,
docsHref: EVALUATOR_EMPTY_STATE_DOCS_HREF,
onSelectTemplate: fn(),
- onDetectTopics: fn(),
onBrowseLibrary: fn(),
},
play: async ({ canvas, args }) => {
await userEvent.click(
- canvas.getByRole("button", { name: /Browse all templates/ }),
+ canvas.getByRole("button", {
+ name: "Browse all templates or start from scratch",
+ }),
);
await expect(args.onBrowseLibrary).toHaveBeenCalledOnce();
},
@@ -163,10 +56,8 @@ export const LinksToDocs = meta.story({
name: "(Test) Links to the evaluators overview docs",
args: {
startingPoints,
- templateCount: 21,
docsHref: EVALUATOR_EMPTY_STATE_DOCS_HREF,
onSelectTemplate: fn(),
- onDetectTopics: fn(),
onBrowseLibrary: fn(),
},
play: async ({ canvas }) => {
diff --git a/web/src/features/evals/v2/components/EvaluatorsEmptyState/components/EvaluatorsEmptyStateView/EvaluatorsEmptyStateView.tsx b/web/src/features/evals/v2/components/EvaluatorsEmptyState/components/EvaluatorsEmptyStateView/EvaluatorsEmptyStateView.tsx
index e47a410428..bbdd88dfe6 100644
--- a/web/src/features/evals/v2/components/EvaluatorsEmptyState/components/EvaluatorsEmptyStateView/EvaluatorsEmptyStateView.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorsEmptyState/components/EvaluatorsEmptyStateView/EvaluatorsEmptyStateView.tsx
@@ -1,118 +1,20 @@
-import { BotMessageSquare, LayoutGrid } from "lucide-react";
-import { Button } from "@/src/components/ui/button";
-import {
- EvaluatorRecommendedCard,
- EvaluatorRecommendedCardContent,
- EvaluatorRecommendedCardSurface,
- EvaluatorRecommendedTemplateCardContent,
-} from "@/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard";
-import { EvaluatorRecommendedCards } from "@/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/components/EvaluatorRecommendedCards/EvaluatorRecommendedCards";
-import { EVALUATOR_ACCENT_BUTTON_CLASSNAME } from "@/src/features/evals/v2/constants/evaluatorEmptyState";
-import {
- getGalleryTemplateCategoryKey,
- getGalleryTemplatePresentation,
-} from "@/src/features/evals/v2/fns/templateGallery/galleryTemplatePresentation";
-import type { EvaluatorEmptyStateStartingPoint } from "@/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState";
+import { EvaluatorRecommendedCard } from "@/src/features/evals/v2/components/EvaluatorRecommendedCard/EvaluatorRecommendedCard";
+import { EvaluatorRecommendedCards } from "@/src/features/evals/v2/components/EvaluatorRecommendedCards/EvaluatorRecommendedCards";
import type { GalleryTemplate } from "@/src/features/evals/v2/types/templateGallery";
-import { cn } from "@/src/utils/tailwind";
-function DetectTopicsStartingPointCard({
- startingPoint,
- onDetectTopics,
- onSelectTemplate,
-}: {
- startingPoint: Extract<
- EvaluatorEmptyStateStartingPoint,
- { action: "detect-topics" }
- >;
- onDetectTopics?: () => void;
+type EvaluatorsEmptyStateViewProps = {
+ startingPoints: Extract<GalleryTemplate, { source: "managed" }>[];
+ docsHref: string;
onSelectTemplate: (template: GalleryTemplate) => void;
-}) {
- const { type } = getGalleryTemplatePresentation(startingPoint.template);
-
- return (
- <EvaluatorRecommendedCardSurface>
- <button
- type="button"
- onClick={() => onSelectTemplate(startingPoint.template)}
- aria-label={`Set up ${startingPoint.title}`}
- className="absolute inset-0 cursor-pointer rounded-md"
- />
- <div className="pointer-events-none relative flex h-full flex-col">
- <EvaluatorRecommendedTemplateCardContent
- title={startingPoint.title}
- description={startingPoint.description}
- type={type}
- categoryKey={getGalleryTemplateCategoryKey(startingPoint.template)}
- />
- {onDetectTopics ? (
- <div className="mt-auto flex justify-end pt-3">
- <Button
- type="button"
- size="sm"
- variant="outline"
- onClick={onDetectTopics}
- className={cn(
- EVALUATOR_ACCENT_BUTTON_CLASSNAME,
- "pointer-events-auto relative shrink-0 gap-1 px-2 text-xs",
- )}
- >
- <BotMessageSquare className="icon-base text-icon-foreground" />
- Set up with AI
- </Button>
- </div>
- ) : null}
- </div>
- </EvaluatorRecommendedCardSurface>
- );
-}
-
-function BrowseLibraryCard({
- templateCount,
- onBrowseLibrary,
-}: {
- templateCount: number;
onBrowseLibrary: () => void;
-}) {
- return (
- <button
- type="button"
- onClick={onBrowseLibrary}
- className="h-full w-full cursor-pointer bg-transparent p-0 text-left"
- >
- <EvaluatorRecommendedCardSurface>
- <EvaluatorRecommendedCardContent
- icon={
- <LayoutGrid className="text-muted-foreground icon-base shrink-0" />
- }
- badge={
- <span className="bg-muted text-muted-foreground inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-xs">
- {templateCount} templates
- </span>
- }
- title="Browse all templates"
- description="Search by what you want to measure — quality, retrieval, safety, classifiers, coding agents."
- />
- </EvaluatorRecommendedCardSurface>
- </button>
- );
-}
+};
export function EvaluatorsEmptyStateView({
startingPoints,
- templateCount,
docsHref,
onSelectTemplate,
- onDetectTopics,
onBrowseLibrary,
-}: {
- startingPoints: EvaluatorEmptyStateStartingPoint[];
- templateCount: number;
- docsHref: string;
- onSelectTemplate: (template: GalleryTemplate) => void;
- onDetectTopics?: () => void;
- onBrowseLibrary: () => void;
-}) {
+}: EvaluatorsEmptyStateViewProps) {
return (
<div className="mx-auto flex w-full max-w-5xl flex-col items-center px-8 pt-24 pb-8">
<div className="mb-6 max-w-2xl text-center">
@@ -120,48 +22,36 @@ export function EvaluatorsEmptyStateView({
Turn traces into quality signals
</h2>
<p className="text-muted-foreground text-base">
- Evaluators score your data with an LLM-as-a-judge or with code. Run
- them on production traces to catch patterns, or on dataset runs to
- evaluate changes before you ship.{" "}
+ Score production traces and dataset runs with an LLM-as-a-judge, a
+ decision model, or code.{" "}
<a
href={docsHref}
target="_blank"
rel="noopener noreferrer"
- className="text-link hover:text-link-hover"
+ className="hover:text-foreground whitespace-nowrap underline underline-offset-2"
>
How evaluators work.
</a>
</p>
</div>
- <div className="w-full">
+ <div className="flex w-full flex-col gap-8">
<EvaluatorRecommendedCards label="Recommended starting points">
- {startingPoints.map((startingPoint) => {
- switch (startingPoint.action) {
- case "detect-topics":
- return (
- <DetectTopicsStartingPointCard
- key={startingPoint.template.key}
- startingPoint={startingPoint}
- onDetectTopics={onDetectTopics}
- onSelectTemplate={onSelectTemplate}
- />
- );
- case "select-template":
- return (
- <EvaluatorRecommendedCard
- key={startingPoint.template.key}
- template={startingPoint.template}
- onSelect={onSelectTemplate}
- />
- );
- }
- })}
- <BrowseLibraryCard
- templateCount={templateCount}
- onBrowseLibrary={onBrowseLibrary}
- />
+ {startingPoints.map((template) => (
+ <EvaluatorRecommendedCard
+ key={template.key}
+ template={template}
+ onSelect={onSelectTemplate}
+ />
+ ))}
</EvaluatorRecommendedCards>
+ <button
+ type="button"
+ onClick={onBrowseLibrary}
+ className="text-link hover:text-link-hover w-fit self-center text-base"
+ >
+ Browse all templates or start from scratch
+ </button>
</div>
</div>
);
diff --git a/web/src/features/evals/v2/constants/evaluatorEmptyState.ts b/web/src/features/evals/v2/constants/evaluatorEmptyState.ts
index cce2cc2c23..695664b025 100644
--- a/web/src/features/evals/v2/constants/evaluatorEmptyState.ts
+++ b/web/src/features/evals/v2/constants/evaluatorEmptyState.ts
@@ -1,22 +1,9 @@
export const EVALUATOR_EMPTY_STATE_DOCS_HREF =
"https://langfuse.com/docs/evaluation/overview";
-export const EVALUATOR_ACCENT_BUTTON_CLASSNAME =
- "border-primary-accent/40 bg-primary-accent/10 text-primary-accent hover:bg-primary-accent/15 hover:text-primary-accent";
-
-export const DETECT_TOPICS_ASSISTANT_PROMPT =
- "Identify 5-10 common topics in my traces and create a categorical LLM as a judge evaluator running on root observations of my traces. Make sure to add an 'other' category as well";
-
-export const EVALUATOR_EMPTY_STATE_STARTING_POINTS = [
- {
- action: "detect-topics",
- templateKey: "topic-classifier",
- title: "Detect Topics",
- description:
- "Classify the requests going through your system to better understand volumes of different categories.",
- },
- {
- action: "select-template",
- templateKey: "user-disagreement",
- },
+/** Catalog templates shown as starting points in the evaluators empty state. */
+export const EVALUATOR_EMPTY_STATE_TEMPLATE_KEYS = [
+ "topic-decision-model",
+ "correctness",
+ "frustration-decision-model",
] as const;
diff --git a/web/src/features/evals/v2/constants/managedTemplatesCatalog.clienttest.ts b/web/src/features/evals/v2/constants/managedTemplatesCatalog.clienttest.ts
index 402a3500bf..8c2809006b 100644
--- a/web/src/features/evals/v2/constants/managedTemplatesCatalog.clienttest.ts
+++ b/web/src/features/evals/v2/constants/managedTemplatesCatalog.clienttest.ts
@@ -61,6 +61,23 @@ describe("managed evaluator templates catalog", () => {
: [],
);
}
+
+ // Decision-model and code chips use the score names the evaluator writes.
+ // Judge chips are short display keys, so they are not checked.
+ expect(template.previewScores.length).toBeGreaterThan(0);
+ if (template.evaluator.type === "DECISION_MODEL") {
+ const scoreNames = template.evaluator.questions.map(
+ ({ scoreName }) => scoreName,
+ );
+ for (const { name } of template.previewScores) {
+ expect(scoreNames).toContain(name);
+ }
+ }
+ if (template.evaluator.type === "CODE") {
+ for (const { name } of template.previewScores) {
+ expect(template.evaluator.source).toContain(`name: "${name}"`);
+ }
+ }
}
});
diff --git a/web/src/features/evals/v2/constants/managedTemplatesCatalog.ts b/web/src/features/evals/v2/constants/managedTemplatesCatalog.ts
index 9d72ea1694..8db4c5473a 100644
--- a/web/src/features/evals/v2/constants/managedTemplatesCatalog.ts
+++ b/web/src/features/evals/v2/constants/managedTemplatesCatalog.ts
@@ -16,7 +16,7 @@ export const MANAGED_TEMPLATES_CATALOG = {
categories: [
{
key: "recommended",
- label: "Recommended starting points",
+ label: "Recommended templates",
description:
"A curated starter set of templates that works well for most teams.",
icon: "sparkles",
@@ -73,6 +73,7 @@ export const MANAGED_TEMPLATES_CATALOG = {
description:
"Classifies the user's primary request into one predefined intent category.",
maintainer: "langfuse",
+ previewScores: [{ name: "chat_intent", value: "billing_question" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -141,6 +142,7 @@ User message: {{input}}`,
description:
"Checks whether the user's request is clearly outside the assistant's defined role or supported scope.",
maintainer: "langfuse",
+ previewScores: [{ name: "out_of_scope", value: "False" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -218,6 +220,7 @@ Think step by step and return the structured result.`,
description:
"Detects whether the user perceives the assistant as making an error or heading in the wrong direction.",
maintainer: "langfuse",
+ previewScores: [{ name: "user_disagreement", value: "False" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -288,6 +291,7 @@ Last user message: {{last_user_message}}`,
description:
"Detects whether user uses all capital letters, potentially indicating frustration.",
maintainer: "langfuse",
+ previewScores: [{ name: "All CAPS", value: "False" }],
evaluator: {
type: "CODE",
language: "TYPESCRIPT",
@@ -379,6 +383,7 @@ Last user message: {{last_user_message}}`,
description:
"Detects whether the latest user message expresses clear, meaningful emotional distress.",
maintainer: "langfuse",
+ previewScores: [{ name: "user_distress", value: "False" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -448,6 +453,7 @@ Last user message: {{last_user_message}}`,
description:
"Checks whether the actual output matches the expected output in material meaning.",
maintainer: "langfuse",
+ previewScores: [{ name: "correctness", value: "True" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -516,6 +522,7 @@ Expected output: {{expected_output}}`,
description:
"Checks whether the output exactly matches the expected output.",
maintainer: "langfuse",
+ previewScores: [{ name: "Exact match", value: "True" }],
evaluator: {
type: "CODE",
language: "TYPESCRIPT",
@@ -612,6 +619,7 @@ Expected output: {{expected_output}}`,
description:
"Scores what fraction of expected keywords from keyword_overlap appear in the output.",
maintainer: "langfuse",
+ previewScores: [{ name: "Keyword overlap", value: "0.67" }],
evaluator: {
type: "CODE",
language: "TYPESCRIPT",
@@ -713,6 +721,7 @@ Expected output: {{expected_output}}`,
description:
"Checks whether the response actually addresses the user's question or task.",
maintainer: "langfuse",
+ previewScores: [{ name: "answer_relevance", value: "Relevant" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -775,6 +784,7 @@ Assistant output: {{assistant_output}}`,
icon: "scale",
description: "Checks whether output follows a defined quality criterion.",
maintainer: "langfuse",
+ previewScores: [{ name: "quality_criterion", value: "True" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -827,6 +837,7 @@ Assistant output: {{assistant_output}}`,
description:
"Assigns the input, output, or conversation to one of a predefined set of topics.",
maintainer: "langfuse",
+ previewScores: [{ name: "input_topic", value: "support" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -894,6 +905,7 @@ Input: {{input}}`,
description:
"Classifies input into one of the pre-defined language categories.",
maintainer: "langfuse",
+ previewScores: [{ name: "input_language", value: "English" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -951,6 +963,7 @@ Input: {{input}}`,
description:
"Checks whether the output is supported by the provided context and avoids unsupported claims.",
maintainer: "langfuse",
+ previewScores: [{ name: "groundedness", value: "Grounded" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -1011,6 +1024,9 @@ Context: {{context}}`,
description:
"Checks whether the provided context is actually useful and relevant for producing the answer.",
maintainer: "langfuse",
+ previewScores: [
+ { name: "context_precision", value: "Partially useful context" },
+ ],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -1072,6 +1088,7 @@ Context: {{context}}`,
description:
"Checks whether the provided context covers the information needed to support the answer.",
maintainer: "langfuse",
+ previewScores: [{ name: "context_recall", value: "Good coverage" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -1135,6 +1152,7 @@ Context: {{context}}`,
description:
"Checks whether assistant output contains sensitive personal information that could identify or harm a private individual.",
maintainer: "langfuse",
+ previewScores: [{ name: "pii_leakage", value: "False" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -1198,6 +1216,7 @@ Assistant output: {{output}}`,
description:
"Checks whether the output follows a defined policy, instruction set, rubric, or formatting rule.",
maintainer: "langfuse",
+ previewScores: [{ name: "rule_adherence", value: "True" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -1247,6 +1266,7 @@ Assistant output: {{assistant_output}}`,
description:
"Checks whether the input contains attempts of prompt injection.",
maintainer: "langfuse",
+ previewScores: [{ name: "prompt_injection", value: "False" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -1303,6 +1323,7 @@ Input text: {{input_text}}`,
icon: "code-2",
description: "Categorizes the type of task the coding agent is used for.",
maintainer: "langfuse",
+ previewScores: [{ name: "task_type", value: "Bug fixing" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -1378,6 +1399,7 @@ Task text: {{task_text}}`,
icon: "building-2",
description: "Classifies coding-agent usage into department buckets.",
maintainer: "langfuse",
+ previewScores: [{ name: "department", value: "Engineering" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [
@@ -1442,6 +1464,7 @@ Task text: {{task_text}}`,
description:
"Assigns the input to one of your topics with a calibrated probability for each option, in one fast decision-model call.",
maintainer: "langfuse",
+ previewScores: [{ name: "topic", value: "billing" }],
evaluator: {
type: "DECISION_MODEL",
questions: [
@@ -1492,6 +1515,7 @@ Task text: {{task_text}}`,
description:
"Returns the probability that the user's request falls outside what the assistant is meant to handle.",
maintainer: "langfuse",
+ previewScores: [{ name: "out_of_scope", value: "0.08" }],
evaluator: {
type: "DECISION_MODEL",
questions: [
@@ -1522,6 +1546,7 @@ Task text: {{task_text}}`,
description:
"Rates how frustrated the user sounds along levels you describe, from calm to ready to leave.",
maintainer: "langfuse",
+ previewScores: [{ name: "customer_frustration", value: "1.12" }],
evaluator: {
type: "DECISION_MODEL",
questions: [
@@ -1555,6 +1580,15 @@ Task text: {{task_text}}`,
description:
"Flags seven user-side conversation signals—rephrases, corrections, human handoff, retries, quoted errors, frustration, and success—in one decision-model call.",
maintainer: "langfuse",
+ previewScores: [
+ { name: "user_correct_agent", value: "0.81" },
+ { name: "user_express_frustration", value: "0.22" },
+ { name: "user_repeats_request", value: "0.12" },
+ { name: "user_rephrase_same", value: "0.06" },
+ { name: "user_error_quote_back", value: "0.04" },
+ { name: "user_requests_human", value: "0.03" },
+ { name: "user_confirm_success", value: "0.02" },
+ ],
evaluator: {
type: "DECISION_MODEL",
questions: [
diff --git a/web/src/features/evals/v2/fns/templateGallery/evaluatorMethodPresentation.ts b/web/src/features/evals/v2/fns/templateGallery/evaluatorMethodPresentation.ts
new file mode 100644
index 0000000000..43e3d88eea
--- /dev/null
+++ b/web/src/features/evals/v2/fns/templateGallery/evaluatorMethodPresentation.ts
@@ -0,0 +1,34 @@
+import { Code2, Gavel, Split, Tags } from "lucide-react";
+import { EvalTemplateTypeEnum, type EvalTemplateType } from "@langfuse/shared";
+
+/** Icon, label and tile colours that mark each evaluator type. */
+export const EVALUATOR_METHOD_PRESENTATION = {
+ [EvalTemplateTypeEnum.CODE]: {
+ Icon: Code2,
+ label: "Code",
+ tileClassName: "bg-category-orange/10 text-category-orange",
+ },
+ [EvalTemplateTypeEnum.LLM_AS_JUDGE]: {
+ Icon: Gavel,
+ label: "LLM-as-a-judge",
+ tileClassName: "bg-light-blue text-dark-blue",
+ },
+ [EvalTemplateTypeEnum.DECISION_MODEL]: {
+ Icon: Split,
+ label: "Decision model",
+ tileClassName: "bg-light-violet text-dark-violet",
+ },
+ [EvalTemplateTypeEnum.FACET]: {
+ Icon: Tags,
+ label: "Facet",
+ tileClassName: "bg-muted text-muted-foreground",
+ },
+} as const satisfies Record<
+ EvalTemplateType,
+ { Icon: unknown; label: string; tileClassName: string }
+>;
+
+/** The icon that marks an evaluator type everywhere in the evals UI. */
+export function getEvaluatorMethodIcon(type: EvalTemplateType) {
+ return EVALUATOR_METHOD_PRESENTATION[type].Icon;
+}
diff --git a/web/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation.clienttest.ts b/web/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation.clienttest.ts
deleted file mode 100644
index a6f8a33e28..0000000000
--- a/web/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation.clienttest.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { Lightbulb } from "lucide-react";
-
-import { MANAGED_TEMPLATES_CATALOG } from "@/src/features/evals/v2/constants/managedTemplatesCatalog";
-import {
- GALLERY_CATEGORY_PRESENTATION,
- getGalleryCategoryPresentation,
-} from "./galleryCategoryPresentation";
-
-describe("galleryCategoryPresentation", () => {
- it("has an icon and color for every managed category", () => {
- for (const category of MANAGED_TEMPLATES_CATALOG.categories) {
- const presentation = GALLERY_CATEGORY_PRESENTATION[category.key];
- expect(presentation).toBeDefined();
- expect(presentation.icon).toBeDefined();
- expect(presentation.iconClassName).toBeDefined();
- }
- });
-
- it("uses a lightbulb for recommended, distinct from the LLM judge sparkle", () => {
- expect(getGalleryCategoryPresentation("recommended")).toEqual({
- icon: Lightbulb,
- iconClassName: "text-dark-yellow",
- });
- });
-});
diff --git a/web/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation.ts b/web/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation.ts
deleted file mode 100644
index a25eb38177..0000000000
--- a/web/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-import {
- Code2,
- FileSearch,
- Gauge,
- LayoutGrid,
- Lightbulb,
- ListFilter,
- MessagesSquare,
- Shield,
- User,
- type LucideIcon,
-} from "lucide-react";
-
-import {
- EVALUATOR_GALLERY_ALL_SECTION_KEY,
- EVALUATOR_GALLERY_PROJECT_SECTION_KEY,
- EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY,
- EVALUATOR_GALLERY_SAFETY_SECTION_KEY,
-} from "@/src/features/evals/v2/constants/evaluatorGallery";
-
-export type GalleryCategoryPresentation = {
- icon: LucideIcon;
- iconClassName: string;
-};
-
-const FALLBACK_PRESENTATION: GalleryCategoryPresentation = {
- icon: LayoutGrid,
- iconClassName: "text-muted-foreground",
-};
-
-export const GALLERY_CATEGORY_PRESENTATION: Record<
- string,
- GalleryCategoryPresentation
-> = {
- [EVALUATOR_GALLERY_ALL_SECTION_KEY]: {
- icon: LayoutGrid,
- iconClassName: "text-muted-foreground",
- },
- [EVALUATOR_GALLERY_PROJECT_SECTION_KEY]: {
- icon: User,
- iconClassName: "text-muted-foreground",
- },
- [EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY]: {
- icon: Lightbulb,
- iconClassName: "text-dark-yellow",
- },
- conversation: {
- icon: MessagesSquare,
- iconClassName: "text-dark-violet",
- },
- quality: {
- icon: Gauge,
- iconClassName: "text-dark-yellow",
- },
- classifier: {
- icon: ListFilter,
- iconClassName: "text-dark-blue",
- },
- retrieval: {
- icon: FileSearch,
- iconClassName: "text-dark-teal",
- },
- [EVALUATOR_GALLERY_SAFETY_SECTION_KEY]: {
- icon: Shield,
- iconClassName: "text-dark-red",
- },
- "coding-agents": {
- icon: Code2,
- iconClassName: "text-dark-green",
- },
-};
-
-export function getGalleryCategoryPresentation(key: string) {
- return GALLERY_CATEGORY_PRESENTATION[key] ?? FALLBACK_PRESENTATION;
-}
diff --git a/web/src/features/evals/v2/fns/templateGallery/galleryTemplatePresentation.ts b/web/src/features/evals/v2/fns/templateGallery/galleryTemplatePresentation.ts
index d3e19a3a40..cb6312718b 100644
--- a/web/src/features/evals/v2/fns/templateGallery/galleryTemplatePresentation.ts
+++ b/web/src/features/evals/v2/fns/templateGallery/galleryTemplatePresentation.ts
@@ -7,7 +7,6 @@ import type {
ManagedTemplate,
} from "@/src/features/evals/v2/types/templateGallery";
import { sourceCodeLanguageLabel } from "@/src/features/evals/v2/fns/evaluators/sourceCodeLanguageLabel";
-import { EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY } from "@/src/features/evals/v2/constants/evaluatorGallery";
export type GalleryTemplatePresentation = {
description: string | undefined;
@@ -60,11 +59,3 @@ export function getGalleryTemplatePresentation(
export function getGalleryTemplateId(template: GalleryTemplate) {
return template.source === "managed" ? template.key : template.id;
}
-
-export function getGalleryTemplateCategoryKey(template: GalleryTemplate) {
- return template.source === "managed"
- ? template.categories.find(
- (category) => category !== EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY,
- )
- : undefined;
-}
diff --git a/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState.clienttest.ts b/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState.clienttest.ts
index fd8fc7fcf4..7c0af0b5bc 100644
--- a/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState.clienttest.ts
+++ b/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState.clienttest.ts
@@ -1,8 +1,4 @@
-import {
- DETECT_TOPICS_ASSISTANT_PROMPT,
- EVALUATOR_EMPTY_STATE_DOCS_HREF,
-} from "@/src/features/evals/v2/constants/evaluatorEmptyState";
-import { MANAGED_TEMPLATES_CATALOG } from "@/src/features/evals/v2/constants/managedTemplatesCatalog";
+import { EVALUATOR_EMPTY_STATE_DOCS_HREF } from "@/src/features/evals/v2/constants/evaluatorEmptyState";
import { prepareEvaluatorEmptyState } from "./prepareEvaluatorEmptyState";
describe("prepareEvaluatorEmptyState", () => {
@@ -10,33 +6,10 @@ describe("prepareEvaluatorEmptyState", () => {
const emptyState = prepareEvaluatorEmptyState();
expect(emptyState.docsHref).toBe(EVALUATOR_EMPTY_STATE_DOCS_HREF);
- expect(emptyState.templateCount).toBe(
- MANAGED_TEMPLATES_CATALOG.templates.length,
- );
- expect(
- emptyState.startingPoints.map(({ template, action }) => ({
- key: template.key,
- action,
- })),
- ).toEqual([
- { key: "topic-classifier", action: "detect-topics" },
- { key: "user-disagreement", action: "select-template" },
+ expect(emptyState.startingPoints.map(({ key }) => key)).toEqual([
+ "topic-decision-model",
+ "correctness",
+ "frustration-decision-model",
]);
- expect(emptyState.startingPoints[0]).toMatchObject({
- action: "detect-topics",
- title: "Detect Topics",
- template: { key: "topic-classifier" },
- });
- expect(emptyState.startingPoints[1]).toMatchObject({
- action: "select-template",
- template: { key: "user-disagreement" },
- });
- expect(emptyState.startingPoints[1]).not.toHaveProperty("title");
- });
-
- it("locks the Detect Topics assistant prompt used by the empty-state experiment", () => {
- expect(DETECT_TOPICS_ASSISTANT_PROMPT).toBe(
- "Identify 5-10 common topics in my traces and create a categorical LLM as a judge evaluator running on root observations of my traces. Make sure to add an 'other' category as well",
- );
});
});
diff --git a/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState.ts b/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState.ts
index 94d173d33e..60dad4da68 100644
--- a/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState.ts
+++ b/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorEmptyState.ts
@@ -1,58 +1,23 @@
import {
EVALUATOR_EMPTY_STATE_DOCS_HREF,
- EVALUATOR_EMPTY_STATE_STARTING_POINTS,
+ EVALUATOR_EMPTY_STATE_TEMPLATE_KEYS,
} from "@/src/features/evals/v2/constants/evaluatorEmptyState";
import { managedEvaluatorTemplateService } from "@/src/features/evals/v2/fns/templateGallery/managedEvaluatorTemplateService";
import type { GalleryTemplate } from "@/src/features/evals/v2/types/templateGallery";
type ManagedGalleryTemplate = Extract<GalleryTemplate, { source: "managed" }>;
-export type EvaluatorEmptyStateStartingPoint =
- | {
- action: "detect-topics";
- template: ManagedGalleryTemplate;
- title: string;
- description: string;
- }
- | {
- action: "select-template";
- template: ManagedGalleryTemplate;
- };
-
export type EvaluatorEmptyStateModel = {
- startingPoints: EvaluatorEmptyStateStartingPoint[];
- templateCount: number;
+ startingPoints: ManagedGalleryTemplate[];
docsHref: string;
};
export function prepareEvaluatorEmptyState(): EvaluatorEmptyStateModel {
return {
- startingPoints: EVALUATOR_EMPTY_STATE_STARTING_POINTS.flatMap((point) => {
- const template = managedEvaluatorTemplateService.get(point.templateKey);
- return template ? [toStartingPoint(point, template)] : [];
+ startingPoints: EVALUATOR_EMPTY_STATE_TEMPLATE_KEYS.flatMap((key) => {
+ const template = managedEvaluatorTemplateService.get(key);
+ return template ? [{ source: "managed" as const, ...template }] : [];
}),
- templateCount: managedEvaluatorTemplateService.list().templates.length,
docsHref: EVALUATOR_EMPTY_STATE_DOCS_HREF,
};
}
-
-function toStartingPoint(
- point: (typeof EVALUATOR_EMPTY_STATE_STARTING_POINTS)[number],
- template: NonNullable<ReturnType<typeof managedEvaluatorTemplateService.get>>,
-): EvaluatorEmptyStateStartingPoint {
- const galleryTemplate = { source: "managed" as const, ...template };
-
- if (point.action === "detect-topics") {
- return {
- action: "detect-topics",
- template: galleryTemplate,
- title: point.title,
- description: point.description,
- };
- }
-
- return {
- action: "select-template",
- template: galleryTemplate,
- };
-}
diff --git a/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorGallery.clienttest.ts b/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorGallery.clienttest.ts
index 13026aa44d..3ce93a233b 100644
--- a/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorGallery.clienttest.ts
+++ b/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorGallery.clienttest.ts
@@ -18,13 +18,12 @@ describe("prepareEvaluatorGallery", () => {
search: "",
});
- expect(gallery.navigationItems[0]).toMatchObject({
+ expect(gallery.navigationItems.at(-1)).toMatchObject({
key: "custom",
count: 12,
});
- expect(gallery.sections[0]?.totalCount).toBe(12);
+ expect(gallery.sections.at(-1)?.totalCount).toBe(12);
expect(gallery.sections.map(({ key }) => key)).toEqual([
- "custom",
"recommended",
"conversation",
"quality",
@@ -32,6 +31,7 @@ describe("prepareEvaluatorGallery", () => {
"retrieval",
"safety",
"coding-agents",
+ "custom",
]);
const recommendedSection = gallery.sections.find(
@@ -69,13 +69,13 @@ describe("prepareEvaluatorGallery", () => {
const gallery = prepareEvaluatorGallery({
customTemplates: [customTemplate],
customTemplateCount: 0,
+ hasCustomTemplates: true,
search: "grounded",
});
expect(
gallery.navigationItems.map(({ key, count }) => ({ key, count })),
).toEqual([
- { key: "custom", count: 0 },
{ key: "recommended", count: 0 },
{ key: "conversation", count: 0 },
{ key: "quality", count: 0 },
@@ -83,13 +83,18 @@ describe("prepareEvaluatorGallery", () => {
{ key: "retrieval", count: 1 },
{ key: "safety", count: 0 },
{ key: "coding-agents", count: 0 },
+ { key: "custom", count: 0 },
]);
- expect(gallery.sections).toHaveLength(1);
- expect(gallery.sections[0]?.templates).toEqual([
- expect.objectContaining({
- source: "managed",
- key: "answer-groundedness",
- }),
+ expect(
+ gallery.sections.map(({ key, templates }) => ({
+ key,
+ templates: templates.map((template) =>
+ template.source === "managed" ? template.key : template.id,
+ ),
+ })),
+ ).toEqual([
+ { key: "retrieval", templates: ["answer-groundedness"] },
+ { key: "custom", templates: [] },
]);
});
});
diff --git a/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorGallery.ts b/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorGallery.ts
index 51b62aaa9b..925a02b73a 100644
--- a/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorGallery.ts
+++ b/web/src/features/evals/v2/fns/templateGallery/prepareEvaluatorGallery.ts
@@ -3,7 +3,6 @@ import type {
GalleryNavigationItem,
GallerySection,
} from "@/src/features/evals/v2/types/templateGallery";
-import { getGalleryCategoryPresentation } from "@/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation";
import { managedEvaluatorTemplateService } from "@/src/features/evals/v2/fns/templateGallery/managedEvaluatorTemplateService";
import { EVALUATOR_GALLERY_PROJECT_SECTION_KEY } from "@/src/features/evals/v2/constants/evaluatorGallery";
@@ -25,10 +24,14 @@ const RECOMMENDED_TEMPLATE_RANK = new Map<string, number>(
export function prepareEvaluatorGallery({
customTemplates,
customTemplateCount,
+ hasCustomTemplates = customTemplateCount > 0,
search,
}: {
customTemplates: CustomEvaluatorTemplate[];
+ /** Saved evaluators matching the current search. */
customTemplateCount: number;
+ /** Whether the project has any saved evaluators, ignoring the search. */
+ hasCustomTemplates?: boolean;
search: string;
}): {
navigationItems: GalleryNavigationItem[];
@@ -76,36 +79,25 @@ export function prepareEvaluatorGallery({
}),
);
const navigationItems: GalleryNavigationItem[] = [
- {
- key: EVALUATOR_GALLERY_PROJECT_SECTION_KEY,
- label: "Your templates",
- icon: getGalleryCategoryPresentation(
- EVALUATOR_GALLERY_PROJECT_SECTION_KEY,
- ).icon,
- count: customTemplateCount,
- },
...managedCatalog.categories.map((category) => ({
key: category.key,
label: category.label,
- icon: getGalleryCategoryPresentation(category.key).icon,
count: managedByCategory.get(category.key)?.length ?? 0,
})),
- ];
- const sections: GallerySection[] = [
- ...(filteredCustom.length
+ // Projects without saved evaluators get no empty "Your templates" entry.
+ ...(hasCustomTemplates
? [
{
key: EVALUATOR_GALLERY_PROJECT_SECTION_KEY,
label: "Your templates",
- description: "Start from a template this project already created.",
- totalCount: customTemplateCount,
- templates: filteredCustom.map((template) => ({
- source: "custom" as const,
- ...template,
- })),
+ count: customTemplateCount,
},
]
: []),
+ ];
+
+ // Own templates last: catalog sections lead the browse view.
+ const sections: GallerySection[] = [
...managedCatalog.categories.flatMap((category) => {
const templates = managedByCategory.get(category.key) ?? [];
return templates.length
@@ -119,6 +111,21 @@ export function prepareEvaluatorGallery({
]
: [];
}),
+ // Kept while the sidebar lists it, so selecting it lands even at 0 matches.
+ ...(hasCustomTemplates
+ ? [
+ {
+ key: EVALUATOR_GALLERY_PROJECT_SECTION_KEY,
+ label: "Your templates",
+ description: "Start from a template this project already created.",
+ totalCount: customTemplateCount,
+ templates: filteredCustom.map((template) => ({
+ source: "custom" as const,
+ ...template,
+ })),
+ },
+ ]
+ : []),
];
return { navigationItems, sections };
diff --git a/web/src/features/evals/v2/fns/templateGallery/visibleGallerySections.clienttest.ts b/web/src/features/evals/v2/fns/templateGallery/visibleGallerySections.clienttest.ts
index 917abfc2c2..14e6f6dd0d 100644
--- a/web/src/features/evals/v2/fns/templateGallery/visibleGallerySections.clienttest.ts
+++ b/web/src/features/evals/v2/fns/templateGallery/visibleGallerySections.clienttest.ts
@@ -1,4 +1,3 @@
-import { LayoutGrid } from "lucide-react";
import {
gallerySidebarItems,
visibleGallerySections,
@@ -17,6 +16,7 @@ const template = {
icon: "gauge",
description: "Assess whether the answer directly addresses the question.",
maintainer: "langfuse",
+ previewScores: [{ name: "answer_relevance", value: "Relevant" }],
evaluator: {
type: "LLM_AS_JUDGE",
promptMessages: [{ role: "user", content: "Rate relevance." }],
@@ -77,7 +77,7 @@ describe("gallerySidebarItems", () => {
qualitySection,
]),
).toEqual([
- { key: "all", label: "All", icon: LayoutGrid, count: 13 },
+ { key: "all", label: "All", count: 13 },
{ key: "custom", label: "Your templates", count: 12 },
{ key: "quality", label: "Quality", count: 1 },
]);
@@ -102,4 +102,16 @@ describe("visibleGallerySections", () => {
visibleGallerySections(sections, "custom").map((section) => section.key),
).toEqual(["custom"]);
});
+
+ it("keeps an empty Your templates only when it is selected", () => {
+ const emptyCustom = { ...customSection, templates: [] };
+ const withEmpty = [emptyCustom, qualitySection];
+
+ expect(
+ visibleGallerySections(withEmpty, "all").map((section) => section.key),
+ ).toEqual(["quality"]);
+ expect(
+ visibleGallerySections(withEmpty, "custom").map((section) => section.key),
+ ).toEqual(["custom"]);
+ });
});
diff --git a/web/src/features/evals/v2/fns/templateGallery/visibleGallerySections.ts b/web/src/features/evals/v2/fns/templateGallery/visibleGallerySections.ts
index 0e89b12153..43b3b7a4ba 100644
--- a/web/src/features/evals/v2/fns/templateGallery/visibleGallerySections.ts
+++ b/web/src/features/evals/v2/fns/templateGallery/visibleGallerySections.ts
@@ -2,7 +2,6 @@ import {
EVALUATOR_GALLERY_ALL_SECTION_KEY,
EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY,
} from "@/src/features/evals/v2/constants/evaluatorGallery";
-import { getGalleryCategoryPresentation } from "@/src/features/evals/v2/fns/templateGallery/galleryCategoryPresentation";
import type {
GalleryNavigationItem,
GallerySection,
@@ -36,8 +35,6 @@ export function gallerySidebarItems(
{
key: EVALUATOR_GALLERY_ALL_SECTION_KEY,
label: "All",
- icon: getGalleryCategoryPresentation(EVALUATOR_GALLERY_ALL_SECTION_KEY)
- .icon,
count: allCount,
},
...categoryItems,
@@ -59,9 +56,11 @@ export function visibleGallerySections(
);
if (isGalleryAllSection(activeSection) || !selectedSection) {
- return recommendedSection
- ? [recommendedSection, ...remainingSections]
- : remainingSections;
+ return (
+ recommendedSection
+ ? [recommendedSection, ...remainingSections]
+ : remainingSections
+ ).filter((section) => section.templates.length > 0);
}
return [selectedSection];
diff --git a/web/src/features/evals/v2/types/templateGallery.ts b/web/src/features/evals/v2/types/templateGallery.ts
index 2c9839e7f9..dbbd7f0ec0 100644
--- a/web/src/features/evals/v2/types/templateGallery.ts
+++ b/web/src/features/evals/v2/types/templateGallery.ts
@@ -1,4 +1,3 @@
-import type { LucideIcon } from "lucide-react";
import type {
DecisionModelQuestions,
EvalTemplateSourceCodeLanguage,
@@ -22,6 +21,8 @@ export type ManagedTemplate = {
icon: string;
description: string;
maintainer: string;
+ /** Sample scores shown on the gallery card, as `name: value` chips. */
+ previewScores: Array<{ name: string; value: string }>;
evaluator:
| {
type: Extract<EvalTemplateType, "LLM_AS_JUDGE">;
@@ -69,7 +70,6 @@ export type GalleryTemplate =
export type GalleryNavigationItem = {
key: string;
label: string;
- icon?: LucideIcon;
count?: number;
};