Skip to content

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

perf(ui): remove unused scores from observations.byId (#3011)

Marc Klingen876917d1129b
diff --git a/web/src/server/api/routers/observations.ts b/web/src/server/api/routers/observations.ts
index b7292bd4d6..ea4d731822 100644
--- a/web/src/server/api/routers/observations.ts
+++ b/web/src/server/api/routers/observations.ts
@@ -14,22 +14,12 @@ export const observationsRouter = createTRPCRouter({
}),
)
.query(async ({ input, ctx }) => {
- const [observation, scores] = await Promise.all([
- ctx.prisma.observation.findFirstOrThrow({
- where: {
- id: input.observationId,
- traceId: input.traceId,
- projectId: input.projectId,
- },
- }),
- ctx.prisma.score.findMany({
- where: {
- traceId: input.traceId,
- projectId: input.projectId,
- },
- }),
- ]);
-
- return { ...observation, scores: scores ?? [] };
+ return ctx.prisma.observation.findFirstOrThrow({
+ where: {
+ id: input.observationId,
+ traceId: input.traceId,
+ projectId: input.projectId,
+ },
+ });
}),
});