Skip to content

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

fix(evals): tighten eval log IO cell padding (#13906)

Tobias Wochinger9029502aef11
diff --git a/web/src/components/table/data-table.tsx b/web/src/components/table/data-table.tsx
index 7fc82a0d7b..b19b11971f 100644
--- a/web/src/components/table/data-table.tsx
+++ b/web/src/components/table/data-table.tsx
@@ -14,7 +14,10 @@ import {
getRowHeightTailwindClass,
} from "@/src/components/table/data-table-row-height-switch";
import { TableTextLoadingCell } from "@/src/components/table/loading-cells";
-import { type LangfuseColumnDef } from "@/src/components/table/types";
+import {
+ type DataTableCellPadding,
+ type LangfuseColumnDef,
+} from "@/src/components/table/types";
import { type ModelTableRow } from "@/src/components/table/use-cases/models";
import {
Table,
@@ -79,7 +82,7 @@ interface DataTableProps<TData, TValue> {
getRowClassName?: (row: TData) => string;
highlightAllRows?: boolean;
topAlignCells?: boolean;
- cellPadding?: "compact" | "comfortable";
+ cellPadding?: DataTableCellPadding;
}
export interface AsyncTableData<T> {
@@ -153,6 +156,17 @@ const getPinningClasses = <TData,>(column: Column<TData>): string => {
);
};
+const getCellPaddingClassName = (padding: DataTableCellPadding) => {
+ switch (padding) {
+ case "comfortable":
+ return "p-1";
+ case "none":
+ return "p-0 first:pl-0";
+ case "compact":
+ return "px-1";
+ }
+};
+
export function DataTable<TData extends object, TValue>({
columns,
data,
@@ -499,7 +513,7 @@ interface TableBodyComponentProps<TData> {
getRowClassName?: (row: TData) => string;
highlightAllRows?: boolean;
topAlignCells?: boolean;
- cellPadding?: "compact" | "comfortable";
+ cellPadding?: DataTableCellPadding;
/** Used for React.memo comparison only */
tableSnapshot?: {
columnVisibility?: VisibilityState;
@@ -579,58 +593,62 @@ function TableBodyComponent<TData>({
{data.isLoading || !data.data ? (
Array.from({ length: skeletonRowCount }).map((_, rowIndex) => (
<TableRow key={`loading-row-${rowIndex}`} aria-hidden="true">
- {visibleColumns.map((column, columnIndex) => (
- <TableCell
- key={`${column.id}-loading-cell-${rowIndex}`}
- className={cn(
- "overflow-hidden border-b text-xs first:pl-2",
- cellPadding === "comfortable" ? "p-1" : "px-1",
- (rowHeight ?? "s") === "s" && "whitespace-nowrap",
- getPinningClasses(column),
- )}
- style={{
- width: `calc(var(--col-${column.id}-size) * 1px)`,
- ...getCommonPinningStyles(column),
- }}
- >
- <div
+ {visibleColumns.map((column, columnIndex) => {
+ const columnDef = column.columnDef as LangfuseColumnDef<TData>;
+
+ return (
+ <TableCell
+ key={`${column.id}-loading-cell-${rowIndex}`}
className={cn(
- "flex",
- (rowHeight ?? "s") === "s" && !topAlignCells
- ? "items-center"
- : "items-start",
- (rowHeight ?? "s") !== "s" && "py-1",
- rowheighttw,
+ "overflow-hidden border-b text-xs first:pl-2",
+ getCellPaddingClassName(
+ columnDef.cellPadding ?? cellPadding,
+ ),
+ (rowHeight ?? "s") === "s" && "whitespace-nowrap",
+ getPinningClasses(column),
)}
+ style={{
+ width: `calc(var(--col-${column.id}-size) * 1px)`,
+ ...getCommonPinningStyles(column),
+ }}
>
- {(() => {
- const columnDef =
- column.columnDef as LangfuseColumnDef<TData>;
- const loadingCell = columnDef.loadingCell;
-
- if (typeof loadingCell === "function") {
- return loadingCell();
- }
-
- if (loadingCell !== undefined) {
- return loadingCell;
- }
-
- return (
- <TableTextLoadingCell
- className={cn(
- "min-w-[3rem]",
- (rowIndex + columnIndex) % 4 === 0 && "w-3/4",
- (rowIndex + columnIndex) % 4 === 1 && "w-1/2",
- (rowIndex + columnIndex) % 4 === 2 && "w-2/3",
- (rowIndex + columnIndex) % 4 === 3 && "w-5/6",
- )}
- />
- );
- })()}
- </div>
- </TableCell>
- ))}
+ <div
+ className={cn(
+ "flex",
+ (rowHeight ?? "s") === "s" && !topAlignCells
+ ? "items-center"
+ : "items-start",
+ (rowHeight ?? "s") !== "s" && "py-1",
+ rowheighttw,
+ )}
+ >
+ {(() => {
+ const loadingCell = columnDef.loadingCell;
+
+ if (typeof loadingCell === "function") {
+ return loadingCell();
+ }
+
+ if (loadingCell !== undefined) {
+ return loadingCell;
+ }
+
+ return (
+ <TableTextLoadingCell
+ className={cn(
+ "min-w-[3rem]",
+ (rowIndex + columnIndex) % 4 === 0 && "w-3/4",
+ (rowIndex + columnIndex) % 4 === 1 && "w-1/2",
+ (rowIndex + columnIndex) % 4 === 2 && "w-2/3",
+ (rowIndex + columnIndex) % 4 === 3 && "w-5/6",
+ )}
+ />
+ );
+ })()}
+ </div>
+ </TableCell>
+ );
+ })}
</TableRow>
))
) : table.getRowModel().rows.length ? (
@@ -646,13 +664,17 @@ function TableBodyComponent<TData>({
const cellValue = cell.getValue();
const isStringCell = typeof cellValue === "string";
const isSmallRowHeight = (rowHeight ?? "s") === "s";
+ const columnDef = cell.column
+ .columnDef as LangfuseColumnDef<TData>;
return (
<TableCell
key={cell.id}
className={cn(
"overflow-hidden border-b text-xs first:pl-2",
- cellPadding === "comfortable" ? "p-1" : "px-1",
+ getCellPaddingClassName(
+ columnDef.cellPadding ?? cellPadding,
+ ),
isSmallRowHeight && "whitespace-nowrap",
getPinningClasses(cell.column),
)}
diff --git a/web/src/components/table/types.ts b/web/src/components/table/types.ts
index ac8110e909..6bd1c4c79f 100644
--- a/web/src/components/table/types.ts
+++ b/web/src/components/table/types.ts
@@ -6,6 +6,8 @@ export type TableRowOptions = {
options: { label: string; value: number; icon?: LucideIcon }[];
};
+export type DataTableCellPadding = "compact" | "comfortable" | "none";
+
declare module "@tanstack/react-table" {
// extends tanstack ColumnDef to include additional properties
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -18,6 +20,7 @@ declare module "@tanstack/react-table" {
isFixedPosition?: boolean; // if true, column cannot be reordered
isPinnedLeft?: boolean; // if true, column will be pinned to left side
loadingCell?: React.ReactNode | (() => React.ReactNode);
+ cellPadding?: DataTableCellPadding;
}
}
diff --git a/web/src/components/ui/IOTableCell.tsx b/web/src/components/ui/IOTableCell.tsx
index dab776cd17..e036e10168 100644
--- a/web/src/components/ui/IOTableCell.tsx
+++ b/web/src/components/ui/IOTableCell.tsx
@@ -13,17 +13,27 @@ import {
} from "@/src/components/ui/hover-card";
import { decodeUnicodeEscapesOnly } from "@/src/utils/unicode";
+type IOTableCellPadding = "default" | "compact";
+
+const ioTableCellPaddingClassNames: Record<IOTableCellPadding, string> = {
+ default: "px-2 py-1",
+ compact: "px-1 py-1",
+};
+
const IOTableCellContent = ({
data,
singleLine,
className,
+ padding,
}: {
data: unknown;
singleLine: boolean;
className?: string;
+ padding: IOTableCellPadding;
}) => {
const stringifiedJson =
data !== null && data !== undefined ? stringifyJsonNode(data) : undefined;
+ const paddingClassName = ioTableCellPaddingClassNames[padding];
// perf: truncate to IO_TABLE_CHAR_LIMIT characters as table becomes unresponsive attempting to render large JSONs with high levels of nesting
const shouldTruncate =
@@ -32,7 +42,8 @@ const IOTableCellContent = ({
return singleLine ? (
<div
className={cn(
- "h-full w-full self-stretch truncate overflow-hidden overflow-y-auto px-2 py-1",
+ "h-full w-full self-stretch truncate overflow-hidden overflow-y-auto",
+ paddingClassName,
className,
)}
>
@@ -49,7 +60,7 @@ const IOTableCellContent = ({
true, // greedy mode for double-escaped Unicode (e.g., \\uXXXX)
)}
className={cn("h-full w-full self-stretch", className)}
- codeClassName="py-1 px-2 min-h-0 h-full overflow-y-auto"
+ codeClassName={cn("min-h-0 h-full overflow-y-auto", paddingClassName)}
collapseStringsAfterLength={null} // in table, show full strings as row height is fixed
borderless
/>
@@ -63,7 +74,7 @@ const IOTableCellContent = ({
stringifiedJson ? decodeUnicodeEscapesOnly(stringifiedJson, true) : data
}
className={cn("h-full w-full self-stretch", className)}
- codeClassName="py-1 px-2 min-h-0 h-full overflow-y-auto"
+ codeClassName={cn("min-h-0 h-full overflow-y-auto", paddingClassName)}
collapseStringsAfterLength={null} // in table, show full strings as row height is fixed
borderless
/>
@@ -74,21 +85,29 @@ export const IOTableCell = ({
data,
isLoading = false,
className,
+ padding = "default",
singleLine = false,
enableExpandOnHover = false,
}: {
data: unknown;
isLoading?: boolean;
className?: string;
+ padding?: IOTableCellPadding;
singleLine?: boolean;
enableExpandOnHover?: boolean;
}) => {
+ const paddingClassName = ioTableCellPaddingClassNames[padding];
+
if (isLoading) {
return (
<JsonSkeleton
borderless
numRows={singleLine ? 1 : undefined}
- className="h-full w-full overflow-hidden px-2 py-1"
+ className={cn(
+ "h-full w-full overflow-hidden",
+ paddingClassName,
+ className,
+ )}
/>
);
}
@@ -99,6 +118,7 @@ export const IOTableCell = ({
data={data}
singleLine={singleLine}
className={className}
+ padding={padding}
/>
);
}
@@ -111,6 +131,7 @@ export const IOTableCell = ({
data={data}
singleLine={singleLine}
className={className}
+ padding={padding}
/>
</div>
</HoverCardTrigger>
diff --git a/web/src/features/evals/components/eval-log.tsx b/web/src/features/evals/components/eval-log.tsx
index 7c5a966c8e..62df65d15c 100644
--- a/web/src/features/evals/components/eval-log.tsx
+++ b/web/src/features/evals/components/eval-log.tsx
@@ -125,11 +125,24 @@ export default function EvalLogTable({
header: "Score Comment",
id: "scoreComment",
enableHiding: true,
+ cellPadding: "none",
+ loadingCell: () => (
+ <IOTableCell
+ isLoading
+ data={undefined}
+ padding="compact"
+ singleLine={rowHeight === "s"}
+ />
+ ),
cell: (row) => {
const value = row.getValue();
return (
value !== undefined && (
- <IOTableCell data={value} singleLine={rowHeight === "s"} />
+ <IOTableCell
+ data={value}
+ padding="compact"
+ singleLine={rowHeight === "s"}
+ />
)
);
},
@@ -138,11 +151,24 @@ export default function EvalLogTable({
id: "error",
header: "Error",
enableHiding: true,
+ cellPadding: "none",
+ loadingCell: () => (
+ <IOTableCell
+ isLoading
+ data={undefined}
+ padding="compact"
+ singleLine={rowHeight === "s"}
+ />
+ ),
cell: (row) => {
const value = row.getValue();
return (
value !== undefined && (
- <IOTableCell data={value} singleLine={rowHeight === "s"} />
+ <IOTableCell
+ data={value}
+ padding="compact"
+ singleLine={rowHeight === "s"}
+ />
)
);
},