Skip to content

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

fix(evals): coerce to number when streaming usage details from CH events table (#12130)

Hassieb Pakzadd39db3dd104f
diff --git a/packages/shared/src/features/evals/observationForEval.ts b/packages/shared/src/features/evals/observationForEval.ts
index 06b068673e..bb71ad2919 100644
--- a/packages/shared/src/features/evals/observationForEval.ts
+++ b/packages/shared/src/features/evals/observationForEval.ts
@@ -6,7 +6,10 @@ import { SingleValueOption } from "../../tableDefinitions";
import { ColumnDefinition } from "../../tableDefinitions";
import { formatColumnOptions } from "../../tableDefinitions/typeHelpers";
-const flexibleUsageCostSchema = z.record(z.string(), z.number().nullable());
+const flexibleUsageCostSchema = z.record(
+ z.string(),
+ z.coerce.number().nullable(),
+);
export const observationForEvalSchema = z.object({
// Identifiers