Skip to content

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

fix(evals): allow observation filter options to pull all names (#12022)

marliessophie0391a11183db
diff --git a/packages/shared/src/server/repositories/observations.ts b/packages/shared/src/server/repositories/observations.ts
index 5be7a7c3ec..0a7a5f8eb6 100644
--- a/packages/shared/src/server/repositories/observations.ts
+++ b/packages/shared/src/server/repositories/observations.ts
@@ -969,6 +969,7 @@ export const getObservationsGroupedByModelId = async (
export const getObservationsGroupedByName = async (
projectId: string,
filter: FilterState,
+ type: ObservationType | null = "GENERATION",
) => {
const observationsFilter = new FilterList([
new StringFilter({
@@ -995,7 +996,7 @@ export const getObservationsGroupedByName = async (
SELECT o.name as name
FROM observations o
WHERE ${appliedObservationsFilter.query}
- AND o.type = 'GENERATION'
+ ${type ? `AND o.type = {type: String}` : ""}
GROUP BY o.name
ORDER BY count() DESC
LIMIT 1000;
@@ -1005,6 +1006,7 @@ export const getObservationsGroupedByName = async (
query,
params: {
...appliedObservationsFilter.params,
+ ...(type ? { type } : {}),
},
tags: {
feature: "tracing",
diff --git a/web/src/features/evals/hooks/useEvalConfigFilterOptions.ts b/web/src/features/evals/hooks/useEvalConfigFilterOptions.ts
index b6247da172..79532198a7 100644
--- a/web/src/features/evals/hooks/useEvalConfigFilterOptions.ts
+++ b/web/src/features/evals/hooks/useEvalConfigFilterOptions.ts
@@ -38,6 +38,7 @@ export function useEvalConfigFilterOptions({
const observationsFilterOptionsResponse =
api.generations.filterOptions.useQuery({
projectId,
+ observationType: "ALL",
});
const traceFilterOptions = useMemo(() => {
diff --git a/web/src/features/events/hooks/useObservationEvals.ts b/web/src/features/events/hooks/useObservationEvals.ts
index 0544101d44..34fceb7e18 100644
--- a/web/src/features/events/hooks/useObservationEvals.ts
+++ b/web/src/features/events/hooks/useObservationEvals.ts
@@ -5,5 +5,5 @@ export function useObservationEvals() {
}
export function useIsObservationEvalsBeta() {
- return true;
+ return false;
}
diff --git a/web/src/server/api/routers/generations/filterOptionsQuery.ts b/web/src/server/api/routers/generations/filterOptionsQuery.ts
index 8ba320f32a..d5a5a57c3f 100644
--- a/web/src/server/api/routers/generations/filterOptionsQuery.ts
+++ b/web/src/server/api/routers/generations/filterOptionsQuery.ts
@@ -1,6 +1,10 @@
import { z } from "zod/v4";
-import { timeFilter, type ObservationOptions } from "@langfuse/shared";
+import {
+ ObservationType,
+ timeFilter,
+ type ObservationOptions,
+} from "@langfuse/shared";
import { protectedProjectProcedure } from "@/src/server/api/trpc";
import {
getCategoricalScoresGroupedByName,
@@ -21,6 +25,9 @@ export const filterOptionsQuery = protectedProjectProcedure
z.object({
projectId: z.string(),
startTimeFilter: z.array(timeFilter).optional(),
+ observationType: z
+ .union([z.enum(ObservationType), z.literal("ALL")])
+ .default("GENERATION"),
}),
)
.query(async ({ input }) => {
@@ -77,7 +84,11 @@ export const filterOptionsQuery = protectedProjectProcedure
//model
getObservationsGroupedByModel(input.projectId, startTimeFilter ?? []),
//name
- getObservationsGroupedByName(input.projectId, startTimeFilter ?? []),
+ getObservationsGroupedByName(
+ input.projectId,
+ startTimeFilter ?? [],
+ input.observationType === "ALL" ? null : input.observationType,
+ ),
//prompt name
getObservationsGroupedByPromptName(
input.projectId,