Skip to content

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

feat(score-configs): allow names up to 80 characters (#18855)

marliessophieb5e0f1fbc0ed
diff --git a/fern/apis/server/definition/commons.yml b/fern/apis/server/definition/commons.yml
index 3ec7a75a93..a0909b4eac 100644
--- a/fern/apis/server/definition/commons.yml
+++ b/fern/apis/server/definition/commons.yml
@@ -205,7 +205,9 @@ types:
docs: Configuration for a score
properties:
id: string
- name: string
+ name:
+ type: string
+ docs: Score config name. Maximum 80 characters.
createdAt: datetime
updatedAt: datetime
projectId: string
diff --git a/fern/apis/server/definition/score-configs.yml b/fern/apis/server/definition/score-configs.yml
index dbb91e1350..d1453d0809 100644
--- a/fern/apis/server/definition/score-configs.yml
+++ b/fern/apis/server/definition/score-configs.yml
@@ -56,7 +56,7 @@ types:
properties:
name:
type: string
- docs: "Name of the score config. Max 35 characters. Only letters, numbers, underscores, spaces, periods, parentheses, and hyphens are allowed."
+ docs: "Name of the score config. Max 80 characters. Only letters, numbers, underscores, spaces, periods, parentheses, and hyphens are allowed."
dataType: commons.ScoreConfigDataType
categories:
type: optional<list<commons.ConfigCategory>>
@@ -77,7 +77,7 @@ types:
docs: The status of the score config showing if it is archived or not
name:
type: optional<string>
- docs: "Name of the score config. Max 35 characters. Only letters, numbers, underscores, spaces, periods, parentheses, and hyphens are allowed."
+ docs: "Name of the score config. Max 80 characters. Only letters, numbers, underscores, spaces, periods, parentheses, and hyphens are allowed."
categories:
type: optional<list<commons.ConfigCategory>>
docs: Configure custom categories for categorical scores. Pass a list of objects with `label` and `value` properties. Categories are autogenerated for boolean configs and cannot be passed
diff --git a/packages/shared/src/domain/score-configs.ts b/packages/shared/src/domain/score-configs.ts
index f2abedd98e..c58e9c7683 100644
--- a/packages/shared/src/domain/score-configs.ts
+++ b/packages/shared/src/domain/score-configs.ts
@@ -8,7 +8,7 @@ export const ScoreConfigCategory = z.object({
});
export const SCORE_CONFIG_NAME_MIN_LENGTH = 1;
-export const SCORE_CONFIG_NAME_MAX_LENGTH = 35;
+export const SCORE_CONFIG_NAME_MAX_LENGTH = 80;
const SCORE_CONFIG_NAME_MAX_LENGTH_FOR_DB_READ = 80;
/** Input-only schema for score config names. Use at API/tRPC boundaries, not for DB reads. */
diff --git a/web/public/generated/api/openapi.yml b/web/public/generated/api/openapi.yml
index cca8e67abb..cc0f8192f9 100644
--- a/web/public/generated/api/openapi.yml
+++ b/web/public/generated/api/openapi.yml
@@ -8461,6 +8461,7 @@ components:
type: string
name:
type: string
+ description: Score config name. Maximum 80 characters.
createdAt:
type: string
format: date-time
@@ -13221,7 +13222,7 @@ components:
name:
type: string
description: >-
- Name of the score config. Max 35 characters. Only letters, numbers,
+ Name of the score config. Max 80 characters. Only letters, numbers,
underscores, spaces, periods, parentheses, and hyphens are allowed.
dataType:
$ref: '#/components/schemas/ScoreConfigDataType'
@@ -13270,7 +13271,7 @@ components:
type: string
nullable: true
description: >-
- Name of the score config. Max 35 characters. Only letters, numbers,
+ Name of the score config. Max 80 characters. Only letters, numbers,
underscores, spaces, periods, parentheses, and hyphens are allowed.
categories:
type: array
diff --git a/web/src/__tests__/server/score-configs.servertest.ts b/web/src/__tests__/server/score-configs.servertest.ts
index 05c96a81f6..213f8bff53 100644
--- a/web/src/__tests__/server/score-configs.servertest.ts
+++ b/web/src/__tests__/server/score-configs.servertest.ts
@@ -8,7 +8,10 @@ import {
PostScoreConfigResponse,
PutScoreConfigResponse,
} from "@/src/features/public-api/types/score-configs";
-import { ScoreConfigDataType } from "@langfuse/shared";
+import {
+ SCORE_CONFIG_NAME_MAX_LENGTH,
+ ScoreConfigDataType,
+} from "@langfuse/shared";
import { type ScoreConfig, prisma } from "@langfuse/shared/src/db";
import { createOrgProjectAndApiKey } from "@langfuse/shared/src/server";
import { v4 } from "uuid";
@@ -587,7 +590,7 @@ describe("/api/public/score-configs API Endpoint", () => {
"PATCH",
`/api/public/score-configs/${configId}`,
{
- name: "a".repeat(50), // Exceeds 35 character limit
+ name: "a".repeat(SCORE_CONFIG_NAME_MAX_LENGTH + 1), // Exceeds the maximum length
},
auth,
);
diff --git a/web/src/features/public-api/types/score-configs.ts b/web/src/features/public-api/types/score-configs.ts
index 6dbd8076fb..6c99f6be1d 100644
--- a/web/src/features/public-api/types/score-configs.ts
+++ b/web/src/features/public-api/types/score-configs.ts
@@ -7,6 +7,7 @@ import {
paginationMetaResponseZod,
publicApiPaginationZod,
ScoreConfigCategory,
+ SCORE_CONFIG_NAME_MAX_LENGTH,
ScoreConfigNameSchema,
validateCategories,
validateNumericRangeFields,
@@ -34,7 +35,7 @@ const CategoriesWithCustomError = jsonSchema.superRefine((categories, ctx) => {
const ScoreConfigBase = z.object({
id: z.string(),
projectId: z.string(),
- name: z.string(),
+ name: z.string().max(SCORE_CONFIG_NAME_MAX_LENGTH),
description: z.string().nullish(),
createdAt: z.coerce.date(),
updatedAt: z.coerce.date(),
diff --git a/web/src/features/score-configs/lib/upsertFormTypes.ts b/web/src/features/score-configs/lib/upsertFormTypes.ts
index 0f9b9a396f..06b27d1c1b 100644
--- a/web/src/features/score-configs/lib/upsertFormTypes.ts
+++ b/web/src/features/score-configs/lib/upsertFormTypes.ts
@@ -1,8 +1,11 @@
-import { ScoreConfigCategory } from "@langfuse/shared";
+import {
+ SCORE_CONFIG_NAME_MAX_LENGTH,
+ ScoreConfigCategory,
+} from "@langfuse/shared";
import { z } from "zod";
export const createConfigSchema = z.object({
- name: z.string().min(1).max(35),
+ name: z.string().min(1).max(SCORE_CONFIG_NAME_MAX_LENGTH),
description: z.string().optional(),
dataType: z.enum(["CATEGORICAL", "NUMERIC", "BOOLEAN", "TEXT"]),
minValue: z.coerce.number().optional(),
diff --git a/web/src/features/score-configs/lib/validateScoreConfigUpsertFormInput.ts b/web/src/features/score-configs/lib/validateScoreConfigUpsertFormInput.ts
index d749720069..8c8de8961b 100644
--- a/web/src/features/score-configs/lib/validateScoreConfigUpsertFormInput.ts
+++ b/web/src/features/score-configs/lib/validateScoreConfigUpsertFormInput.ts
@@ -1,5 +1,6 @@
import {
NumericConfigFields,
+ SCORE_CONFIG_NAME_MAX_LENGTH,
CategoricalConfigFields,
BooleanConfigFields,
TextConfigFields,
@@ -9,7 +10,7 @@ import { z } from "zod";
import { type CreateConfig, type UpdateConfig } from "./upsertFormTypes";
const ScoreConfigBaseSchema = z.object({
- name: z.string().min(1).max(35),
+ name: z.string().min(1).max(SCORE_CONFIG_NAME_MAX_LENGTH),
description: z.string().optional(),
});