🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(scores): lead score column headers with the score name (#16772)
Nikita Kabardin0f96074a8f40
diff --git a/web/src/features/scores/hooks/useScoreColumns.clienttest.ts b/web/src/features/scores/hooks/useScoreColumns.clienttest.tsnew file mode 100644index 0000000000..7167f4accc--- /dev/null+++ b/web/src/features/scores/hooks/useScoreColumns.clienttest.ts@@ -0,0 +1,33 @@+import { describe, expect, it } from "vitest";+import { createScoreColumns } from "@/src/features/scores/hooks/useScoreColumns";++const column = {+ key: "persona_fit-api-NUMERIC",+ name: "persona_fit",+ source: "API",+ dataType: "NUMERIC" as const,+};++const build = (prefix?: string) =>+ createScoreColumns<{ scores: Record<string, unknown> }>(+ [column],+ "scores",+ "aggregate",+ prefix,+ )[0];++describe("createScoreColumns headers", () => {+ it("leads with the score name and trails the level", () => {+ // A score column is narrow and truncates from the right, so anything ahead+ // of the name hides the one part that identifies the column.+ expect(build("Trace").header).toBe("# persona_fit (api) · Trace");+ });++ it("omits the separator when there is no level", () => {+ expect(build().header).toBe("# persona_fit (api)");+ });++ it("keeps the level out of the column id, so persisted layouts survive", () => {+ expect(build("Trace").id).toBe("Trace-persona_fit-api-NUMERIC");+ });+});diff --git a/web/src/features/scores/hooks/useScoreColumns.ts b/web/src/features/scores/hooks/useScoreColumns.tsindex 6517720234..7994312616 100644--- a/web/src/features/scores/hooks/useScoreColumns.ts+++ b/web/src/features/scores/hooks/useScoreColumns.ts@@ -25,11 +25,14 @@ export function createScoreColumns<T extends Record<string, any>>(rawKey?: boolean,): LangfuseColumnDef<T>[] {return scoreColumns.map(({ key, name, source, dataType }) => {- // Apply prefix to both column ID/accessor and headerconst accessorKey = prefix ? `${prefix}-${key}` : key;- const header = prefix- ? `${prefix}: ${getScoreDataTypeIcon(dataType)} ${name} (${source.toLowerCase()})`- : `${getScoreDataTypeIcon(dataType)} ${name} (${source.toLowerCase()})`;+ // The score's name identifies the column, so it comes first. A score+ // column is narrow and truncates from the right, so a leading level ate+ // the name and left every column of a level looking alike. The level+ // still trails the name, where the hover title and the column picker+ // pick it up in full.+ const label = `${getScoreDataTypeIcon(dataType)} ${name} (${source.toLowerCase()})`;+ const header = prefix ? `${label} · ${prefix}` : label;return {accessorKey,