Score Configuration Management#
Score configs are reusable templates that define a scoring dimension's name, data type, and constraints. They standardize the schema that annotators and evaluators score against, ensuring consistent and comparable data across human annotation, annotation queues, and programmatic score ingestion.
Score configs are project-scoped and immutable after creation (data type cannot be changed). They can be archived and restored but not deleted. The dataType field is locked on creation — the UI disables the selector when editing an existing config .
Data Types#
Four data types are supported :
| Type | Constraints | Use case |
|---|---|---|
NUMERIC | Optional minValue / maxValue (floats) | Continuous scores: accuracy, relevance, similarity |
CATEGORICAL | Array of {label, value} pairs (labels and values must be unique) | Discrete classifications with predefined options |
BOOLEAN | Fixed [{label: "True", value: 1}, {label: "False", value: 0}] | Pass/fail checks |
TEXT | No numeric constraints; free-form string (1–500 chars) | Qualitative notes; excluded from aggregation/analytics |
TEXT configs are intentionally excluded from experiments, LLM-as-a-Judge evaluations, and score analytics because free-form text cannot be meaningfully aggregated.
Numeric Range Constraints#
For NUMERIC configs, minValue and maxValue are both optional floats stored on the ScoreConfig row . The key validation rule: if both are provided, maxValue must be strictly greater than minValue — enforced in validateNumericRangeFields.
This check runs in two places:
- Client-side, via
validateScoreConfigUpsertFormInputbefore form submission, using the sharedScoreConfigValidationSchema. - Server-side, inside the tRPC
updatemutation viavalidateDbScoreConfigSafe, which merges the incoming patch with the persisted config before re-validating.
Key Source Files#
| File | Purpose |
|---|---|
packages/shared/src/domain/score-configs.ts | Canonical Zod schemas and validation functions (NumericConfigFields, CategoricalConfigFields, BooleanConfigFields, TextConfigFields, validateNumericRangeFields, ScoreConfigSchema) |
web/src/features/score-configs/lib/validateScoreConfigUpsertFormInput.ts | Client-side form validation — assembles the full schema and returns error strings |
web/src/features/score-configs/lib/upsertFormTypes.ts | createConfigSchema / updateConfigSchema Zod schemas and CreateConfig / UpdateConfig types |
web/src/features/score-configs/components/UpsertScoreConfigDialog.tsx | React dialog for creating/editing configs; renders type-specific fields (min/max for NUMERIC, category editor for CATEGORICAL/BOOLEAN) |
web/src/server/api/routers/scoreConfigs.ts | tRPC router — create, update, all, byId procedures with scoreConfigs:CUD / scoreConfigs:read RBAC scope checks |
packages/shared/prisma/schema.prisma | ScoreConfig Prisma model — minValue/maxValue as Float?, categories as Json? |
Creating / Editing Configs#
Via UI: Navigate to Project Settings → Scores / Evaluation and click Create new score config. The UpsertScoreConfigDialog handles both create and update flows — it defaults to NUMERIC with no min/max . Changing the data type clears incompatible fields (e.g., switching to TEXT clears minValue/maxValue) .
Via API/SDK: Use POST /api/public/score-configs or the api property on the Langfuse client. The tRPC create mutation maps directly to this . Updates use the update mutation , which only allows changing name, description, isArchived, minValue, maxValue, and categories — not dataType.
Both paths write an audit log entry with before/after snapshots .
Integration with Evaluation Workflows#
- Human Annotation: At least one score config must exist before annotations can be submitted via the UI.
- Annotation Queues: Queues reference specific score configs to define which scoring dimensions annotators will fill in.
- Programmatic ingestion (API/SDK): Scores can optionally reference a config via
configId. When provided, Langfuse validates the score's name, data type, and value against the config's constraints at ingestion time. - Score name is constrained to 1–35 characters .
RBAC#
Two RBAC scopes gate access :
scoreConfigs:read— list and fetch configsscoreConfigs:CUD— create, update, archive