Skip to content

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

fix: eval template ui fixes (#1662)

Max Deichmann75d020cc2c04
diff --git a/web/src/features/evals/components/new-template-form.tsx b/web/src/features/evals/components/new-template-form.tsx
index a5e6844f5d..5e9410beb9 100644
--- a/web/src/features/evals/components/new-template-form.tsx
+++ b/web/src/features/evals/components/new-template-form.tsx
@@ -23,10 +23,10 @@ import { usePlaygroundContext } from "@/src/features/playground/client/context";
import { ModelParameters } from "@/src/features/playground/client/components/ModelParameters";
import { EvalModelNames, OutputSchema, evalModels } from "@langfuse/shared";
import { PromptDescription } from "@/src/features/prompts/components/prompt-description";
-import { AlphaNumericDashString } from "@/src/utils/zod";
+import { AlphaNumericUnderscoreString } from "@/src/utils/zod";
const formSchema = z.object({
- name: AlphaNumericDashString,
+ name: AlphaNumericUnderscoreString,
prompt: z
.string()
.min(1, "Enter a prompt")
@@ -182,6 +182,7 @@ export const EvalTemplateForm = (props: {
placeholder="Select a template name"
/>
</FormControl>
+ <FormMessage />
</FormItem>
</>
)}
diff --git a/web/src/features/evals/server/router.ts b/web/src/features/evals/server/router.ts
index 0f7caae726..9601d33761 100644
--- a/web/src/features/evals/server/router.ts
+++ b/web/src/features/evals/server/router.ts
@@ -13,10 +13,10 @@ import {
singleFilter,
variableMapping,
} from "@langfuse/shared";
-import { AlphaNumericDashString } from "@/src/utils/zod";
+import { AlphaNumericUnderscoreString } from "@/src/utils/zod";
export const CreateEvalTemplate = z.object({
- name: AlphaNumericDashString,
+ name: AlphaNumericUnderscoreString,
projectId: z.string(),
prompt: z.string(),
model: EvalModelNames,
@@ -195,7 +195,7 @@ export const evalRouter = createTRPCRouter({
z.object({
projectId: z.string(),
evalTemplateId: z.string(),
- scoreName: AlphaNumericDashString,
+ scoreName: AlphaNumericUnderscoreString,
target: z.string(),
filter: z.array(singleFilter).nullable(), // re-using the filter type from the tables
mapping: z.array(variableMapping),
diff --git a/web/src/utils/zod.ts b/web/src/utils/zod.ts
index 6bfd925c93..ef05acc3d2 100644
--- a/web/src/utils/zod.ts
+++ b/web/src/utils/zod.ts
@@ -54,7 +54,7 @@ export const noHtmlCheck = (value: string) => !noHtmlRegex.test(value);
export const NonEmptyString = z.string().min(1);
-export const AlphaNumericDashString = z
+export const AlphaNumericUnderscoreString = z
.string()
.min(1, "Enter a name")
- .regex(/^[A-Za-z0-9-]+$/, "Must be alphanumeric or contain dashes (-)");
+ .regex(/^[A-Za-z_]+$/, "Must be alphanumeric or contain dashes (_)");