Skip to content

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

feat: add eval to score table (#1847)

Max Deichmann99b0f5b15745
diff --git a/web/src/components/table/use-cases/scores.tsx b/web/src/components/table/use-cases/scores.tsx
index 877381181b..a796f66ac0 100644
--- a/web/src/components/table/use-cases/scores.tsx
+++ b/web/src/components/table/use-cases/scores.tsx
@@ -25,6 +25,7 @@ export type ScoresTableRow = {
observationId?: string;
traceName?: string;
userId?: string;
+ jobConfigurationId?: string;
};
export type ScoreFilterInput = Omit<
@@ -186,6 +187,29 @@ export default function ScoresTable({
) : undefined;
},
},
+ {
+ accessorKey: "jobConfigurationId",
+ header: "Eval Configuration ID",
+ id: "jobConfigurationId",
+ headerTooltip: {
+ description: "The Job Configuration ID associated with the trace.",
+ href: "https://langfuse.com/docs/scores/model-based-evals",
+ },
+ enableHiding: true,
+ enableSorting: true,
+ cell: ({ row }) => {
+ const value = row.getValue("jobConfigurationId");
+ return typeof value === "string" ? (
+ <>
+ <TableLink
+ path={`/project/${projectId}/evals/configs/${value}`}
+ value={value}
+ truncateAt={40}
+ />
+ </>
+ ) : undefined;
+ },
+ },
{
accessorKey: "comment",
header: "Comment",
@@ -218,6 +242,7 @@ export default function ScoresTable({
traceId: score.traceId,
traceName: score.traceName ?? undefined,
userId: score.userId ?? undefined,
+ jobConfigurationId: score.jobConfigurationId ?? undefined,
};
};
diff --git a/web/src/server/api/definitions/scoresTable.ts b/web/src/server/api/definitions/scoresTable.ts
index 0f12eb073d..29c89b469c 100644
--- a/web/src/server/api/definitions/scoresTable.ts
+++ b/web/src/server/api/definitions/scoresTable.ts
@@ -37,6 +37,12 @@ export const scoresTableCols: ColumnDefinition[] = [
},
{ name: "Value", id: "value", type: "number", internal: 's."value"' },
{ name: "User ID", id: "userId", type: "string", internal: 't."user_id"' },
+ {
+ name: "Eval Configuration ID",
+ id: "jobConfigurationId",
+ type: "string",
+ internal: 'je."job_configuration_id"',
+ },
];
export type ScoreOptions = {
diff --git a/web/src/server/api/routers/scores.ts b/web/src/server/api/routers/scores.ts
index a33519171b..c05e35a0a1 100644
--- a/web/src/server/api/routers/scores.ts
+++ b/web/src/server/api/routers/scores.ts
@@ -48,7 +48,13 @@ export const scoresRouter = createTRPCRouter({
);
const scores = await ctx.prisma.$queryRaw<
- Array<Score & { traceName: string | null; userId: string | null }>
+ Array<
+ Score & {
+ traceName: string | null;
+ userId: string | null;
+ jobConfigurationId: string | null;
+ }
+ >
>(
generateScoresQuery(
Prisma.sql`
@@ -60,7 +66,9 @@ export const scoresRouter = createTRPCRouter({
s.trace_id as "traceId",
s.observation_id as "observationId",
t.user_id as "userId",
- t.name as "traceName"`,
+ t.name as "traceName",
+ je.job_configuration_id as "jobConfigurationId"
+ `,
input.projectId,
filterCondition,
orderByCondition,
@@ -322,7 +330,7 @@ const generateScoresQuery = (
SELECT
${select}
FROM scores s
- JOIN traces t ON t.id = s.trace_id
+ JOIN traces t ON t.id = s.trace_id LEFT JOIN job_executions je ON je.job_output_score_id = s.id AND je.project_id = ${projectId}
WHERE t.project_id = ${projectId}
${filterCondition}
${orderCondition}