Skip to content

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

fix(scores): enable filtering by environment (#10331)

Nimar022dca865ca2
diff --git a/web/src/components/table/use-cases/scores.tsx b/web/src/components/table/use-cases/scores.tsx
index 765eaca0fd..0e0eb739e6 100644
--- a/web/src/components/table/use-cases/scores.tsx
+++ b/web/src/components/table/use-cases/scores.tsx
@@ -159,6 +159,12 @@ export default function ScoresTable({
},
);
+ const environmentOptions = React.useMemo(
+ () =>
+ environmentFilterOptions.data?.map((value) => value.environment) || [],
+ [environmentFilterOptions.data],
+ );
+
const [orderByState, setOrderByState] = useOrderByState({
column: "timestamp",
order: "DESC",
@@ -238,8 +244,9 @@ export default function ScoresTable({
count: u.count !== undefined ? Number(u.count) : undefined,
})) || [],
tags: filterOptions.data?.tags?.map((t) => t.value) || [], // tags don't have counts
+ environment: environmentOptions,
}),
- [filterOptions.data],
+ [filterOptions.data, environmentOptions],
);
const queryFilter = useSidebarFilterState(
diff --git a/web/src/features/filters/config/scores-config.ts b/web/src/features/filters/config/scores-config.ts
index 536b84f76f..638cf236f7 100644
--- a/web/src/features/filters/config/scores-config.ts
+++ b/web/src/features/filters/config/scores-config.ts
@@ -13,11 +13,16 @@ export const scoreFilterConfig: FilterConfig = {
columnDefinitions: scoresTableCols,
- defaultExpanded: ["name"],
+ defaultExpanded: ["environment", "name"],
defaultSidebarCollapsed: true,
facets: [
+ {
+ type: "categorical" as const,
+ column: "environment",
+ label: "Environment",
+ },
{
type: "categorical" as const,
column: "name",
diff --git a/web/src/server/api/definitions/scoresTable.ts b/web/src/server/api/definitions/scoresTable.ts
index 22b960c38e..410eea20d5 100644
--- a/web/src/server/api/definitions/scoresTable.ts
+++ b/web/src/server/api/definitions/scoresTable.ts
@@ -21,6 +21,13 @@ export const scoresTableCols: ColumnDefinition[] = [
options: [], // to be added at runtime
nullable: true,
},
+ {
+ name: "Environment",
+ id: "environment",
+ type: "stringOptions",
+ internal: 's."environment"',
+ options: [], // to be added at runtime
+ },
{
name: "Observation ID",
id: "observationId",