🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(scores): rename source `REVIEW` to `ANNOTATION` (#2141)
marliessophie74ff2371455f
diff --git a/fern/apis/server/definition/commons.yml b/fern/apis/server/definition/commons.ymlindex dc5e0ae9bf..30e790f912 100644--- a/fern/apis/server/definition/commons.yml+++ b/fern/apis/server/definition/commons.yml@@ -209,8 +209,8 @@ types:- ARCHIVEDScoreSource:enum:+ - ANNOTATION- API- - REVIEW- EVALerrors:diff --git a/packages/shared/prisma/generated/types.ts b/packages/shared/prisma/generated/types.tsindex 9946e3e9d4..b5dd2ac34a 100644--- a/packages/shared/prisma/generated/types.ts+++ b/packages/shared/prisma/generated/types.ts@@ -25,8 +25,8 @@ export const ObservationLevel = {} as const;export type ObservationLevel = (typeof ObservationLevel)[keyof typeof ObservationLevel];export const ScoreSource = {+ ANNOTATION: "ANNOTATION",API: "API",- REVIEW: "REVIEW",EVAL: "EVAL"} as const;export type ScoreSource = (typeof ScoreSource)[keyof typeof ScoreSource];diff --git a/packages/shared/prisma/migrations/20240524154058_scores_source_enum_add_annotation/migration.sql b/packages/shared/prisma/migrations/20240524154058_scores_source_enum_add_annotation/migration.sqlnew file mode 100644index 0000000000..9058e9fc77--- /dev/null+++ b/packages/shared/prisma/migrations/20240524154058_scores_source_enum_add_annotation/migration.sql@@ -0,0 +1,2 @@+-- AlterEnum+ALTER TYPE "ScoreSource" ADD VALUE 'ANNOTATION';diff --git a/packages/shared/prisma/migrations/20240524156058_scores_source_backfill_annotation_for_review/migration.sql b/packages/shared/prisma/migrations/20240524156058_scores_source_backfill_annotation_for_review/migration.sqlnew file mode 100644index 0000000000..f64f1fcba5--- /dev/null+++ b/packages/shared/prisma/migrations/20240524156058_scores_source_backfill_annotation_for_review/migration.sql@@ -0,0 +1,4 @@+-- Backfill the scores source for 'REVIEW' to be 'ANNOTATION'+UPDATE "scores"+SET "source" = 'ANNOTATION'::"ScoreSource"+WHERE "source" = 'REVIEW'::"ScoreSource";diff --git a/packages/shared/prisma/migrations/20240524165931_scores_source_enum_drop_review/migration.sql b/packages/shared/prisma/migrations/20240524165931_scores_source_enum_drop_review/migration.sqlnew file mode 100644index 0000000000..49e114efcb--- /dev/null+++ b/packages/shared/prisma/migrations/20240524165931_scores_source_enum_drop_review/migration.sql@@ -0,0 +1,14 @@+/*+ Warnings:++ - The values [REVIEW] on the enum `ScoreSource` will be removed. If these variants are still used in the database, this will fail.++*/+-- AlterEnum+BEGIN;+CREATE TYPE "ScoreSource_new" AS ENUM ('ANNOTATION', 'API', 'EVAL');+ALTER TABLE "scores" ALTER COLUMN "source" TYPE "ScoreSource_new" USING ("source"::text::"ScoreSource_new");+ALTER TYPE "ScoreSource" RENAME TO "ScoreSource_old";+ALTER TYPE "ScoreSource_new" RENAME TO "ScoreSource";+DROP TYPE "ScoreSource_old";+COMMIT;diff --git a/packages/shared/prisma/schema.prisma b/packages/shared/prisma/schema.prismaindex bff1c6c8c4..3abbb660f4 100644--- a/packages/shared/prisma/schema.prisma+++ b/packages/shared/prisma/schema.prisma@@ -423,8 +423,8 @@ model Score {}enum ScoreSource {+ ANNOTATIONAPI- REVIEWEVAL}diff --git a/packages/shared/prisma/seed.ts b/packages/shared/prisma/seed.tsindex 8d99a2a5c3..1fefd630b9 100644--- a/packages/shared/prisma/seed.ts+++ b/packages/shared/prisma/seed.ts@@ -500,7 +500,7 @@ function createObjects(name: "manual-score",value: Math.floor(Math.random() * 3) - 1,timestamp: traceTs,- source: ScoreSource.REVIEW,+ source: ScoreSource.ANNOTATION,projectId,authorUserId: `user-${i}`,},diff --git a/web/public/generated/api/openapi.yml b/web/public/generated/api/openapi.ymlindex 1b149bb7d1..e5c26525be 100644--- a/web/public/generated/api/openapi.yml+++ b/web/public/generated/api/openapi.yml@@ -1825,8 +1825,8 @@ components:title: ScoreSourcetype: stringenum:+ - ANNOTATION- API- - REVIEW- EVALCreateDatasetItemRequest:title: CreateDatasetItemRequestdiff --git a/web/src/features/manual-scoring/components/ManualScoreButton.tsx b/web/src/features/manual-scoring/components/ManualScoreButton.tsxindex 10a718e50a..9e80eab11e 100644--- a/web/src/features/manual-scoring/components/ManualScoreButton.tsx+++ b/web/src/features/manual-scoring/components/ManualScoreButton.tsx@@ -77,13 +77,13 @@ export function ManualScoreButton({utils.sessions.invalidate(),]);};- const mutCreateScore = api.scores.createReviewScore.useMutation({+ const mutCreateScore = api.scores.createAnnotationScore.useMutation({onSuccess,});- const mutUpdateScore = api.scores.updateReviewScore.useMutation({+ const mutUpdateScore = api.scores.updateAnnotationScore.useMutation({onSuccess,});- const mutDeleteScore = api.scores.deleteReviewScore.useMutation({+ const mutDeleteScore = api.scores.deleteAnnotationScore.useMutation({onSuccess,});diff --git a/web/src/server/api/routers/scores.ts b/web/src/server/api/routers/scores.tsindex bef22cb208..87a58f2eee 100644--- a/web/src/server/api/routers/scores.ts+++ b/web/src/server/api/routers/scores.ts@@ -121,7 +121,7 @@ export const scoresRouter = createTRPCRouter({return res;}),- createReviewScore: protectedProjectProcedure+ createAnnotationScore: protectedProjectProcedure.input(z.object({projectId: z.string(),@@ -158,7 +158,7 @@ export const scoresRouter = createTRPCRouter({name: input.name,comment: input.comment,authorUserId: ctx.session.user.id,- source: "REVIEW",+ source: "ANNOTATION",},});await auditLog({@@ -174,7 +174,7 @@ export const scoresRouter = createTRPCRouter({});return score;}),- updateReviewScore: protectedProjectProcedure+ updateAnnotationScore: protectedProjectProcedure.input(z.object({projectId: z.string(),@@ -193,11 +193,11 @@ export const scoresRouter = createTRPCRouter({where: {id: input.id,projectId: input.projectId,- source: "REVIEW",+ source: "ANNOTATION",},});if (!score) {- throw new Error("No review score with this id in this project.");+ throw new Error("No annotation score with this id in this project.");}await auditLog({@@ -224,7 +224,7 @@ export const scoresRouter = createTRPCRouter({},});}),- deleteReviewScore: protectedProjectProcedure+ deleteAnnotationScore: protectedProjectProcedure.input(z.object({ projectId: z.string(), id: z.string() })).mutation(async ({ input, ctx }) => {throwIfNoAccess({@@ -236,12 +236,12 @@ export const scoresRouter = createTRPCRouter({const score = await ctx.prisma.score.findFirst({where: {id: input.id,- source: "REVIEW",+ source: "ANNOTATION",projectId: input.projectId,},});if (!score) {- throw new Error("No review score with this id in this project.");+ throw new Error("No annotation score with this id in this project.");}await auditLog({diff --git a/worker/generated/types.ts b/worker/generated/types.tsindex e0e48013bc..0449896658 100644--- a/worker/generated/types.ts+++ b/worker/generated/types.ts@@ -28,8 +28,8 @@ export const ObservationLevel = {export type ObservationLevel =(typeof ObservationLevel)[keyof typeof ObservationLevel];export const ScoreSource = {+ ANNOTATION: "ANNOTATION",API: "API",- REVIEW: "REVIEW",EVAL: "EVAL",} as const;export type ScoreSource = (typeof ScoreSource)[keyof typeof ScoreSource];