diff --git a/apps/web/src/actions/evaluationTemplates/create.ts b/apps/web/src/actions/evaluationTemplates/create.ts index 8eab4f6db..eb8fb3278 100644 --- a/apps/web/src/actions/evaluationTemplates/create.ts +++ b/apps/web/src/actions/evaluationTemplates/create.ts @@ -2,7 +2,7 @@ import { EvaluationResultableType } from '@latitude-data/core/browser' import { UnauthorizedError } from '@latitude-data/core/lib/errors' -import { createEvaluationTemplate } from '@latitude-data/core/services/evaluationTemplates/create' +import { createEvaluationTemplate } from '@latitude-data/core/services/evaluationLegacyTemplates/create' import { z } from 'zod' import { authProcedure } from '../procedures' diff --git a/apps/web/src/actions/evaluationTemplates/destroy.ts b/apps/web/src/actions/evaluationTemplates/destroy.ts index 5c6101581..ca9733c47 100644 --- a/apps/web/src/actions/evaluationTemplates/destroy.ts +++ b/apps/web/src/actions/evaluationTemplates/destroy.ts @@ -1,7 +1,7 @@ 'use server' import { UnauthorizedError } from '@latitude-data/core/lib/errors' -import { destroyEvaluationTemplate } from '@latitude-data/core/services/evaluationTemplates/destroy' +import { destroyEvaluationTemplate } from '@latitude-data/core/services/evaluationLegacyTemplates/destroy' import { z } from 'zod' import { authProcedure } from '../procedures' diff --git a/apps/web/src/actions/evaluations/create.ts b/apps/web/src/actions/evaluations/create.ts index 7fc8e2c58..93d40ac20 100644 --- a/apps/web/src/actions/evaluations/create.ts +++ b/apps/web/src/actions/evaluations/create.ts @@ -18,7 +18,7 @@ export const createEvaluationAction = authProcedure type: z .nativeEnum(EvaluationMetadataType) .optional() - .default(EvaluationMetadataType.LlmAsJudge), + .default(EvaluationMetadataType.LlmAsJudgeLegacy), configuration: z.object({ type: z.nativeEnum(EvaluationResultableType), detail: z diff --git a/apps/web/src/actions/evaluations/createFromPrompt.ts b/apps/web/src/actions/evaluations/createFromPrompt.ts index dc4f2b515..f3e5febb4 100644 --- a/apps/web/src/actions/evaluations/createFromPrompt.ts +++ b/apps/web/src/actions/evaluations/createFromPrompt.ts @@ -32,7 +32,7 @@ export const createEvaluationFromPromptAction = withDocument workspace: ctx.workspace, name: input.name, description: 'AI-generated evaluation', - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: input.type === 'number' diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/RefineModal/steps/2_SelectEvaluationResults/SelectableEvaluationResultsTable.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/RefineModal/steps/2_SelectEvaluationResults/SelectableEvaluationResultsTable.tsx index 4531a7d20..b614d3244 100644 --- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/RefineModal/steps/2_SelectEvaluationResults/SelectableEvaluationResultsTable.tsx +++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/RefineModal/steps/2_SelectEvaluationResults/SelectableEvaluationResultsTable.tsx @@ -29,7 +29,10 @@ export const ResultCellContent = ({ evaluation: EvaluationDto value: unknown }) => { - if (evaluation.configuration.type === EvaluationResultableType.Boolean) { + if ( + (evaluation.configuration ?? evaluation.metadata.configuration)!.type === + EvaluationResultableType.Boolean + ) { return ( {String(value)} @@ -37,9 +40,16 @@ export const ResultCellContent = ({ ) } - if (evaluation.configuration.type === EvaluationResultableType.Number) { - const minValue = evaluation.configuration.detail?.range.from ?? 0 - const maxValue = evaluation.configuration.detail?.range.to ?? 10 + if ( + (evaluation.configuration ?? evaluation.metadata.configuration)!.type === + EvaluationResultableType.Number + ) { + const minValue = + (evaluation.configuration ?? evaluation.metadata.configuration)!.detail + ?.range.from ?? 0 + const maxValue = + (evaluation.configuration ?? evaluation.metadata.configuration)!.detail + ?.range.to ?? 10 return ( { - if (evaluation.configuration.type === EvaluationResultableType.Boolean) { + if ( + (evaluation.configuration ?? evaluation.metadata.configuration)!.type === + EvaluationResultableType.Boolean + ) { return ( {String(value)} @@ -47,9 +50,16 @@ export const ResultCellContent = ({ ) } - if (evaluation.configuration.type === EvaluationResultableType.Number) { - const minValue = evaluation.configuration.detail?.range.from ?? 0 - const maxValue = evaluation.configuration.detail?.range.to ?? 10 + if ( + (evaluation.configuration ?? evaluation.metadata.configuration)!.type === + EvaluationResultableType.Number + ) { + const minValue = + (evaluation.configuration ?? evaluation.metadata.configuration)!.detail + ?.range.from ?? 0 + const maxValue = + (evaluation.configuration ?? evaluation.metadata.configuration)!.detail + ?.range.to ?? 10 return ( { diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/MetricsSummary/Charts/Numerical/index.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/MetricsSummary/Charts/Numerical/index.tsx index 3c153ab92..3fc84e8f1 100644 --- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/MetricsSummary/Charts/Numerical/index.tsx +++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/MetricsSummary/Charts/Numerical/index.tsx @@ -1,4 +1,4 @@ -import { Evaluation } from '@latitude-data/core/browser' +import { EvaluationDto } from '@latitude-data/core/browser' import { CostOverResultsChart } from './CostOverResults' import { ResultOverTimeChart } from './ResultsOverTime' @@ -7,7 +7,7 @@ export function NumericalCharts({ evaluation, documentUuid, }: { - evaluation: Evaluation + evaluation: EvaluationDto documentUuid: string }) { return ( diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/MetricsSummary/Charts/index.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/MetricsSummary/Charts/index.tsx index 45b27fccc..cb3bb3f8c 100644 --- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/MetricsSummary/Charts/index.tsx +++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/MetricsSummary/Charts/index.tsx @@ -13,7 +13,8 @@ export function EvaluationResultsCharts({ documentUuid: string }) { const isNumerical = - evaluation.configuration.type === EvaluationResultableType.Number + (evaluation.configuration ?? evaluation.metadata.configuration)!.type === + EvaluationResultableType.Number if (!isNumerical) return null diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/layout.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/layout.tsx index 06f6cec5f..3cabb59b0 100644 --- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/layout.tsx +++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/layout.tsx @@ -48,7 +48,8 @@ export default async function ConnectedEvaluationLayout({ uuid: params.commitUuid, }) const isNumeric = - evaluation.configuration.type == EvaluationResultableType.Number + (evaluation.configuration ?? evaluation.metadata.configuration)!.type == + EvaluationResultableType.Number let provider if (evaluation.metadata.prompt) { @@ -92,7 +93,12 @@ export default async function ConnectedEvaluationLayout({ {evaluation.name} - {TYPE_TEXT[evaluation.configuration.type]} + { + TYPE_TEXT[ + (evaluation.configuration ?? + evaluation.metadata.configuration)!.type + ] + } statement-breakpoint +ALTER TABLE "latitude"."llm_as_judge_evaluation_metadatas" ADD COLUMN "configuration" jsonb;--> statement-breakpoint +ALTER TABLE "latitude"."llm_as_judge_evaluation_metadatas" DROP COLUMN IF EXISTS "metadata_type"; \ No newline at end of file diff --git a/packages/core/drizzle/meta/0079_snapshot.json b/packages/core/drizzle/meta/0079_snapshot.json index 0d0d953e7..a849220b9 100644 --- a/packages/core/drizzle/meta/0079_snapshot.json +++ b/packages/core/drizzle/meta/0079_snapshot.json @@ -61,9 +61,7 @@ "users_email_unique": { "name": "users_email_unique", "nullsNotDistinct": false, - "columns": [ - "email" - ] + "columns": ["email"] } } }, @@ -111,12 +109,8 @@ "tableFrom": "sessions", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -174,12 +168,8 @@ "tableFrom": "workspaces", "tableTo": "subscriptions", "schemaTo": "latitude", - "columnsFrom": [ - "current_subscription_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["current_subscription_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -188,12 +178,8 @@ "tableFrom": "workspaces", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "creator_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["creator_id"], + "columnsTo": ["id"], "onDelete": "set null", "onUpdate": "no action" } @@ -369,12 +355,8 @@ "tableFrom": "memberships", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, @@ -383,12 +365,8 @@ "tableFrom": "memberships", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -398,9 +376,7 @@ "memberships_invitation_token_unique": { "name": "memberships_invitation_token_unique", "nullsNotDistinct": false, - "columns": [ - "invitation_token" - ] + "columns": ["invitation_token"] } } }, @@ -483,12 +459,8 @@ "tableFrom": "api_keys", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -498,9 +470,7 @@ "api_keys_token_unique": { "name": "api_keys_token_unique", "nullsNotDistinct": false, - "columns": [ - "token" - ] + "columns": ["token"] } } }, @@ -589,12 +559,8 @@ "tableFrom": "claimed_rewards", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -603,12 +569,8 @@ "tableFrom": "claimed_rewards", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "creator_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["creator_id"], + "columnsTo": ["id"], "onDelete": "set null", "onUpdate": "no action" } @@ -697,12 +659,8 @@ "tableFrom": "projects", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -894,12 +852,8 @@ "tableFrom": "commits", "tableTo": "projects", "schemaTo": "latitude", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["project_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, @@ -908,12 +862,8 @@ "tableFrom": "commits", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "set null", "onUpdate": "no action" } @@ -923,9 +873,7 @@ "commits_uuid_unique": { "name": "commits_uuid_unique", "nullsNotDistinct": false, - "columns": [ - "uuid" - ] + "columns": ["uuid"] } } }, @@ -1099,12 +1047,8 @@ "tableFrom": "document_versions", "tableTo": "commits", "schemaTo": "latitude", - "columnsFrom": [ - "commit_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["commit_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -1284,12 +1228,8 @@ "tableFrom": "provider_api_keys", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["author_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -1298,12 +1238,8 @@ "tableFrom": "provider_api_keys", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -1474,12 +1410,8 @@ "tableFrom": "document_logs", "tableTo": "commits", "schemaTo": "latitude", - "columnsFrom": [ - "commit_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["commit_id"], + "columnsTo": ["id"], "onDelete": "restrict", "onUpdate": "cascade" } @@ -1489,9 +1421,7 @@ "document_logs_uuid_unique": { "name": "document_logs_uuid_unique", "nullsNotDistinct": false, - "columns": [ - "uuid" - ] + "columns": ["uuid"] } } }, @@ -1742,12 +1672,8 @@ "tableFrom": "provider_logs", "tableTo": "provider_api_keys", "schemaTo": "latitude", - "columnsFrom": [ - "provider_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["provider_id"], + "columnsTo": ["id"], "onDelete": "restrict", "onUpdate": "cascade" }, @@ -1756,12 +1682,8 @@ "tableFrom": "provider_logs", "tableTo": "api_keys", "schemaTo": "latitude", - "columnsFrom": [ - "apiKeyId" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["apiKeyId"], + "columnsTo": ["id"], "onDelete": "restrict", "onUpdate": "cascade" } @@ -1771,9 +1693,7 @@ "provider_logs_uuid_unique": { "name": "provider_logs_uuid_unique", "nullsNotDistinct": false, - "columns": [ - "uuid" - ] + "columns": ["uuid"] } } }, @@ -1897,12 +1817,8 @@ "tableFrom": "datasets", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, @@ -1911,12 +1827,8 @@ "tableFrom": "datasets", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["author_id"], + "columnsTo": ["id"], "onDelete": "set null", "onUpdate": "no action" } @@ -2058,12 +1970,8 @@ "tableFrom": "evaluations", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -2073,9 +1981,7 @@ "evaluations_uuid_unique": { "name": "evaluations_uuid_unique", "nullsNotDistinct": false, - "columns": [ - "uuid" - ] + "columns": ["uuid"] } } }, @@ -2146,12 +2052,8 @@ "tableFrom": "llm_as_judge_evaluation_metadatas", "tableTo": "evaluations_templates", "schemaTo": "latitude", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["template_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -2232,12 +2134,8 @@ "tableFrom": "connected_evaluations", "tableTo": "evaluations", "schemaTo": "latitude", - "columnsFrom": [ - "evaluation_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["evaluation_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -2247,10 +2145,7 @@ "connected_evaluations_unique_idx": { "name": "connected_evaluations_unique_idx", "nullsNotDistinct": false, - "columns": [ - "document_uuid", - "evaluation_id" - ] + "columns": ["document_uuid", "evaluation_id"] } } }, @@ -2412,12 +2307,8 @@ "tableFrom": "evaluation_results", "tableTo": "evaluations", "schemaTo": "latitude", - "columnsFrom": [ - "evaluation_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["evaluation_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, @@ -2426,12 +2317,8 @@ "tableFrom": "evaluation_results", "tableTo": "document_logs", "schemaTo": "latitude", - "columnsFrom": [ - "document_log_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["document_log_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -2440,12 +2327,8 @@ "tableFrom": "evaluation_results", "tableTo": "provider_logs", "schemaTo": "latitude", - "columnsFrom": [ - "provider_log_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["provider_log_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -2455,9 +2338,7 @@ "evaluation_results_uuid_unique": { "name": "evaluation_results_uuid_unique", "nullsNotDistinct": false, - "columns": [ - "uuid" - ] + "columns": ["uuid"] } } }, @@ -2523,12 +2404,8 @@ "tableFrom": "evaluations_templates", "tableTo": "evaluations_template_categories", "schemaTo": "latitude", - "columnsFrom": [ - "category" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["category"], + "columnsTo": ["id"], "onDelete": "restrict", "onUpdate": "cascade" } @@ -2623,12 +2500,8 @@ "tableFrom": "magic_link_tokens", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -2638,9 +2511,7 @@ "magic_link_tokens_token_unique": { "name": "magic_link_tokens_token_unique", "nullsNotDistinct": false, - "columns": [ - "token" - ] + "columns": ["token"] } } }, @@ -2725,12 +2596,8 @@ "tableFrom": "events", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -2851,12 +2718,7 @@ "latitude.subscription_plans": { "name": "subscription_plans", "schema": "latitude", - "values": [ - "hobby_v1", - "hobby_v2", - "team_v1", - "enterprise_v1" - ] + "values": ["hobby_v1", "hobby_v2", "team_v1", "enterprise_v1"] }, "latitude.reward_types": { "name": "reward_types", @@ -2904,26 +2766,17 @@ "latitude.run_error_entity_enum": { "name": "run_error_entity_enum", "schema": "latitude", - "values": [ - "document_log", - "evaluation_result" - ] + "values": ["document_log", "evaluation_result"] }, "latitude.log_source": { "name": "log_source", "schema": "latitude", - "values": [ - "playground", - "api", - "evaluation" - ] + "values": ["playground", "api", "evaluation"] }, "latitude.metadata_type": { "name": "metadata_type", "schema": "latitude", - "values": [ - "llm_as_judge" - ] + "values": ["llm_as_judge"] }, "public.evaluation_result_types": { "name": "evaluation_result_types", @@ -2943,4 +2796,4 @@ "schemas": {}, "tables": {} } -} \ No newline at end of file +} diff --git a/packages/core/drizzle/meta/0082_snapshot.json b/packages/core/drizzle/meta/0082_snapshot.json index e56a0288b..82fce83c2 100644 --- a/packages/core/drizzle/meta/0082_snapshot.json +++ b/packages/core/drizzle/meta/0082_snapshot.json @@ -61,9 +61,7 @@ "users_email_unique": { "name": "users_email_unique", "nullsNotDistinct": false, - "columns": [ - "email" - ] + "columns": ["email"] } } }, @@ -111,12 +109,8 @@ "tableFrom": "sessions", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -174,12 +168,8 @@ "tableFrom": "workspaces", "tableTo": "subscriptions", "schemaTo": "latitude", - "columnsFrom": [ - "current_subscription_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["current_subscription_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -188,12 +178,8 @@ "tableFrom": "workspaces", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "creator_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["creator_id"], + "columnsTo": ["id"], "onDelete": "set null", "onUpdate": "no action" } @@ -369,12 +355,8 @@ "tableFrom": "memberships", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, @@ -383,12 +365,8 @@ "tableFrom": "memberships", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -398,9 +376,7 @@ "memberships_invitation_token_unique": { "name": "memberships_invitation_token_unique", "nullsNotDistinct": false, - "columns": [ - "invitation_token" - ] + "columns": ["invitation_token"] } } }, @@ -483,12 +459,8 @@ "tableFrom": "api_keys", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -498,9 +470,7 @@ "api_keys_token_unique": { "name": "api_keys_token_unique", "nullsNotDistinct": false, - "columns": [ - "token" - ] + "columns": ["token"] } } }, @@ -589,12 +559,8 @@ "tableFrom": "claimed_rewards", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -603,12 +569,8 @@ "tableFrom": "claimed_rewards", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "creator_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["creator_id"], + "columnsTo": ["id"], "onDelete": "set null", "onUpdate": "no action" } @@ -697,12 +659,8 @@ "tableFrom": "projects", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -894,12 +852,8 @@ "tableFrom": "commits", "tableTo": "projects", "schemaTo": "latitude", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["project_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, @@ -908,12 +862,8 @@ "tableFrom": "commits", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "set null", "onUpdate": "no action" } @@ -923,9 +873,7 @@ "commits_uuid_unique": { "name": "commits_uuid_unique", "nullsNotDistinct": false, - "columns": [ - "uuid" - ] + "columns": ["uuid"] } } }, @@ -1099,12 +1047,8 @@ "tableFrom": "document_versions", "tableTo": "commits", "schemaTo": "latitude", - "columnsFrom": [ - "commit_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["commit_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -1284,12 +1228,8 @@ "tableFrom": "provider_api_keys", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["author_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -1298,12 +1238,8 @@ "tableFrom": "provider_api_keys", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -1313,21 +1249,12 @@ "provider_api_keys_name_workspace_id_deleted_at_unique": { "name": "provider_api_keys_name_workspace_id_deleted_at_unique", "nullsNotDistinct": true, - "columns": [ - "name", - "workspace_id", - "deleted_at" - ] + "columns": ["name", "workspace_id", "deleted_at"] }, "provider_api_keys_token_provider_workspace_id_deleted_at_unique": { "name": "provider_api_keys_token_provider_workspace_id_deleted_at_unique", "nullsNotDistinct": true, - "columns": [ - "token", - "provider", - "workspace_id", - "deleted_at" - ] + "columns": ["token", "provider", "workspace_id", "deleted_at"] } } }, @@ -1494,12 +1421,8 @@ "tableFrom": "document_logs", "tableTo": "commits", "schemaTo": "latitude", - "columnsFrom": [ - "commit_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["commit_id"], + "columnsTo": ["id"], "onDelete": "restrict", "onUpdate": "cascade" } @@ -1509,9 +1432,7 @@ "document_logs_uuid_unique": { "name": "document_logs_uuid_unique", "nullsNotDistinct": false, - "columns": [ - "uuid" - ] + "columns": ["uuid"] } } }, @@ -1768,12 +1689,8 @@ "tableFrom": "provider_logs", "tableTo": "provider_api_keys", "schemaTo": "latitude", - "columnsFrom": [ - "provider_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["provider_id"], + "columnsTo": ["id"], "onDelete": "restrict", "onUpdate": "cascade" }, @@ -1782,12 +1699,8 @@ "tableFrom": "provider_logs", "tableTo": "api_keys", "schemaTo": "latitude", - "columnsFrom": [ - "apiKeyId" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["apiKeyId"], + "columnsTo": ["id"], "onDelete": "restrict", "onUpdate": "cascade" } @@ -1797,9 +1710,7 @@ "provider_logs_uuid_unique": { "name": "provider_logs_uuid_unique", "nullsNotDistinct": false, - "columns": [ - "uuid" - ] + "columns": ["uuid"] } } }, @@ -1923,12 +1834,8 @@ "tableFrom": "datasets", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, @@ -1937,12 +1844,8 @@ "tableFrom": "datasets", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["author_id"], + "columnsTo": ["id"], "onDelete": "set null", "onUpdate": "no action" } @@ -2084,12 +1987,8 @@ "tableFrom": "evaluations", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -2099,9 +1998,7 @@ "evaluations_uuid_unique": { "name": "evaluations_uuid_unique", "nullsNotDistinct": false, - "columns": [ - "uuid" - ] + "columns": ["uuid"] } } }, @@ -2172,12 +2069,8 @@ "tableFrom": "llm_as_judge_evaluation_metadatas", "tableTo": "evaluations_templates", "schemaTo": "latitude", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["template_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -2258,12 +2151,8 @@ "tableFrom": "connected_evaluations", "tableTo": "evaluations", "schemaTo": "latitude", - "columnsFrom": [ - "evaluation_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["evaluation_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -2273,10 +2162,7 @@ "connected_evaluations_unique_idx": { "name": "connected_evaluations_unique_idx", "nullsNotDistinct": false, - "columns": [ - "document_uuid", - "evaluation_id" - ] + "columns": ["document_uuid", "evaluation_id"] } } }, @@ -2438,12 +2324,8 @@ "tableFrom": "evaluation_results", "tableTo": "evaluations", "schemaTo": "latitude", - "columnsFrom": [ - "evaluation_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["evaluation_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" }, @@ -2452,12 +2334,8 @@ "tableFrom": "evaluation_results", "tableTo": "document_logs", "schemaTo": "latitude", - "columnsFrom": [ - "document_log_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["document_log_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" }, @@ -2466,12 +2344,8 @@ "tableFrom": "evaluation_results", "tableTo": "provider_logs", "schemaTo": "latitude", - "columnsFrom": [ - "provider_log_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["provider_log_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -2481,9 +2355,7 @@ "evaluation_results_uuid_unique": { "name": "evaluation_results_uuid_unique", "nullsNotDistinct": false, - "columns": [ - "uuid" - ] + "columns": ["uuid"] } } }, @@ -2549,12 +2421,8 @@ "tableFrom": "evaluations_templates", "tableTo": "evaluations_template_categories", "schemaTo": "latitude", - "columnsFrom": [ - "category" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["category"], + "columnsTo": ["id"], "onDelete": "restrict", "onUpdate": "cascade" } @@ -2649,12 +2517,8 @@ "tableFrom": "magic_link_tokens", "tableTo": "users", "schemaTo": "latitude", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["user_id"], + "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" } @@ -2664,9 +2528,7 @@ "magic_link_tokens_token_unique": { "name": "magic_link_tokens_token_unique", "nullsNotDistinct": false, - "columns": [ - "token" - ] + "columns": ["token"] } } }, @@ -2751,12 +2613,8 @@ "tableFrom": "events", "tableTo": "workspaces", "schemaTo": "latitude", - "columnsFrom": [ - "workspace_id" - ], - "columnsTo": [ - "id" - ], + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], "onDelete": "no action", "onUpdate": "no action" } @@ -2877,12 +2735,7 @@ "latitude.subscription_plans": { "name": "subscription_plans", "schema": "latitude", - "values": [ - "hobby_v1", - "hobby_v2", - "team_v1", - "enterprise_v1" - ] + "values": ["hobby_v1", "hobby_v2", "team_v1", "enterprise_v1"] }, "latitude.reward_types": { "name": "reward_types", @@ -2931,26 +2784,17 @@ "latitude.run_error_entity_enum": { "name": "run_error_entity_enum", "schema": "latitude", - "values": [ - "document_log", - "evaluation_result" - ] + "values": ["document_log", "evaluation_result"] }, "latitude.log_source": { "name": "log_source", "schema": "latitude", - "values": [ - "playground", - "api", - "evaluation" - ] + "values": ["playground", "api", "evaluation"] }, "latitude.metadata_type": { "name": "metadata_type", "schema": "latitude", - "values": [ - "llm_as_judge" - ] + "values": ["llm_as_judge"] }, "public.evaluation_result_types": { "name": "evaluation_result_types", @@ -2970,4 +2814,4 @@ "schemas": {}, "tables": {} } -} \ No newline at end of file +} diff --git a/packages/core/drizzle/meta/0085_snapshot.json b/packages/core/drizzle/meta/0085_snapshot.json index f168db231..6146d6a95 100644 --- a/packages/core/drizzle/meta/0085_snapshot.json +++ b/packages/core/drizzle/meta/0085_snapshot.json @@ -60,9 +60,7 @@ "uniqueConstraints": { "users_email_unique": { "name": "users_email_unique", - "columns": [ - "email" - ], + "columns": ["email"], "nullsNotDistinct": false } } @@ -109,14 +107,10 @@ "sessions_user_id_users_id_fk": { "name": "sessions_user_id_users_id_fk", "tableFrom": "sessions", - "columnsFrom": [ - "user_id" - ], + "columnsFrom": ["user_id"], "tableTo": "users", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "cascade" } @@ -172,28 +166,20 @@ "workspaces_current_subscription_id_subscriptions_id_fk": { "name": "workspaces_current_subscription_id_subscriptions_id_fk", "tableFrom": "workspaces", - "columnsFrom": [ - "current_subscription_id" - ], + "columnsFrom": ["current_subscription_id"], "tableTo": "subscriptions", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "no action" }, "workspaces_creator_id_users_id_fk": { "name": "workspaces_creator_id_users_id_fk", "tableFrom": "workspaces", - "columnsFrom": [ - "creator_id" - ], + "columnsFrom": ["creator_id"], "tableTo": "users", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "set null" } @@ -367,28 +353,20 @@ "memberships_workspace_id_workspaces_id_fk": { "name": "memberships_workspace_id_workspaces_id_fk", "tableFrom": "memberships", - "columnsFrom": [ - "workspace_id" - ], + "columnsFrom": ["workspace_id"], "tableTo": "workspaces", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "cascade" }, "memberships_user_id_users_id_fk": { "name": "memberships_user_id_users_id_fk", "tableFrom": "memberships", - "columnsFrom": [ - "user_id" - ], + "columnsFrom": ["user_id"], "tableTo": "users", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "cascade" } @@ -397,9 +375,7 @@ "uniqueConstraints": { "memberships_invitation_token_unique": { "name": "memberships_invitation_token_unique", - "columns": [ - "invitation_token" - ], + "columns": ["invitation_token"], "nullsNotDistinct": false } } @@ -481,14 +457,10 @@ "api_keys_workspace_id_workspaces_id_fk": { "name": "api_keys_workspace_id_workspaces_id_fk", "tableFrom": "api_keys", - "columnsFrom": [ - "workspace_id" - ], + "columnsFrom": ["workspace_id"], "tableTo": "workspaces", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "no action" } @@ -497,9 +469,7 @@ "uniqueConstraints": { "api_keys_token_unique": { "name": "api_keys_token_unique", - "columns": [ - "token" - ], + "columns": ["token"], "nullsNotDistinct": false } } @@ -587,28 +557,20 @@ "claimed_rewards_workspace_id_workspaces_id_fk": { "name": "claimed_rewards_workspace_id_workspaces_id_fk", "tableFrom": "claimed_rewards", - "columnsFrom": [ - "workspace_id" - ], + "columnsFrom": ["workspace_id"], "tableTo": "workspaces", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "no action" }, "claimed_rewards_creator_id_users_id_fk": { "name": "claimed_rewards_creator_id_users_id_fk", "tableFrom": "claimed_rewards", - "columnsFrom": [ - "creator_id" - ], + "columnsFrom": ["creator_id"], "tableTo": "users", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "set null" } @@ -695,14 +657,10 @@ "projects_workspace_id_workspaces_id_fk": { "name": "projects_workspace_id_workspaces_id_fk", "tableFrom": "projects", - "columnsFrom": [ - "workspace_id" - ], + "columnsFrom": ["workspace_id"], "tableTo": "workspaces", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "cascade" } @@ -892,28 +850,20 @@ "commits_project_id_projects_id_fk": { "name": "commits_project_id_projects_id_fk", "tableFrom": "commits", - "columnsFrom": [ - "project_id" - ], + "columnsFrom": ["project_id"], "tableTo": "projects", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "cascade" }, "commits_user_id_users_id_fk": { "name": "commits_user_id_users_id_fk", "tableFrom": "commits", - "columnsFrom": [ - "user_id" - ], + "columnsFrom": ["user_id"], "tableTo": "users", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "set null" } @@ -922,9 +872,7 @@ "uniqueConstraints": { "commits_uuid_unique": { "name": "commits_uuid_unique", - "columns": [ - "uuid" - ], + "columns": ["uuid"], "nullsNotDistinct": false } } @@ -1097,14 +1045,10 @@ "document_versions_commit_id_commits_id_fk": { "name": "document_versions_commit_id_commits_id_fk", "tableFrom": "document_versions", - "columnsFrom": [ - "commit_id" - ], + "columnsFrom": ["commit_id"], "tableTo": "commits", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "cascade" } @@ -1282,28 +1226,20 @@ "provider_api_keys_author_id_users_id_fk": { "name": "provider_api_keys_author_id_users_id_fk", "tableFrom": "provider_api_keys", - "columnsFrom": [ - "author_id" - ], + "columnsFrom": ["author_id"], "tableTo": "users", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "no action" }, "provider_api_keys_workspace_id_workspaces_id_fk": { "name": "provider_api_keys_workspace_id_workspaces_id_fk", "tableFrom": "provider_api_keys", - "columnsFrom": [ - "workspace_id" - ], + "columnsFrom": ["workspace_id"], "tableTo": "workspaces", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "no action" } @@ -1312,21 +1248,12 @@ "uniqueConstraints": { "provider_api_keys_name_workspace_id_deleted_at_unique": { "name": "provider_api_keys_name_workspace_id_deleted_at_unique", - "columns": [ - "name", - "workspace_id", - "deleted_at" - ], + "columns": ["name", "workspace_id", "deleted_at"], "nullsNotDistinct": true }, "provider_api_keys_token_provider_workspace_id_deleted_at_unique": { "name": "provider_api_keys_token_provider_workspace_id_deleted_at_unique", - "columns": [ - "token", - "provider", - "workspace_id", - "deleted_at" - ], + "columns": ["token", "provider", "workspace_id", "deleted_at"], "nullsNotDistinct": true } } @@ -1492,14 +1419,10 @@ "document_logs_commit_id_commits_id_fk": { "name": "document_logs_commit_id_commits_id_fk", "tableFrom": "document_logs", - "columnsFrom": [ - "commit_id" - ], + "columnsFrom": ["commit_id"], "tableTo": "commits", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "cascade", "onDelete": "restrict" } @@ -1508,9 +1431,7 @@ "uniqueConstraints": { "document_logs_uuid_unique": { "name": "document_logs_uuid_unique", - "columns": [ - "uuid" - ], + "columns": ["uuid"], "nullsNotDistinct": false } } @@ -1781,28 +1702,20 @@ "provider_logs_provider_id_provider_api_keys_id_fk": { "name": "provider_logs_provider_id_provider_api_keys_id_fk", "tableFrom": "provider_logs", - "columnsFrom": [ - "provider_id" - ], + "columnsFrom": ["provider_id"], "tableTo": "provider_api_keys", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "cascade", "onDelete": "restrict" }, "provider_logs_apiKeyId_api_keys_id_fk": { "name": "provider_logs_apiKeyId_api_keys_id_fk", "tableFrom": "provider_logs", - "columnsFrom": [ - "apiKeyId" - ], + "columnsFrom": ["apiKeyId"], "tableTo": "api_keys", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "cascade", "onDelete": "restrict" } @@ -1811,9 +1724,7 @@ "uniqueConstraints": { "provider_logs_uuid_unique": { "name": "provider_logs_uuid_unique", - "columns": [ - "uuid" - ], + "columns": ["uuid"], "nullsNotDistinct": false } } @@ -1936,28 +1847,20 @@ "datasets_workspace_id_workspaces_id_fk": { "name": "datasets_workspace_id_workspaces_id_fk", "tableFrom": "datasets", - "columnsFrom": [ - "workspace_id" - ], + "columnsFrom": ["workspace_id"], "tableTo": "workspaces", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "cascade" }, "datasets_author_id_users_id_fk": { "name": "datasets_author_id_users_id_fk", "tableFrom": "datasets", - "columnsFrom": [ - "author_id" - ], + "columnsFrom": ["author_id"], "tableTo": "users", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "set null" } @@ -2097,14 +2000,10 @@ "evaluations_workspace_id_workspaces_id_fk": { "name": "evaluations_workspace_id_workspaces_id_fk", "tableFrom": "evaluations", - "columnsFrom": [ - "workspace_id" - ], + "columnsFrom": ["workspace_id"], "tableTo": "workspaces", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "cascade" } @@ -2113,9 +2012,7 @@ "uniqueConstraints": { "evaluations_uuid_unique": { "name": "evaluations_uuid_unique", - "columns": [ - "uuid" - ], + "columns": ["uuid"], "nullsNotDistinct": false } } @@ -2185,14 +2082,10 @@ "llm_as_judge_evaluation_metadatas_template_id_evaluations_templates_id_fk": { "name": "llm_as_judge_evaluation_metadatas_template_id_evaluations_templates_id_fk", "tableFrom": "llm_as_judge_evaluation_metadatas", - "columnsFrom": [ - "template_id" - ], + "columnsFrom": ["template_id"], "tableTo": "evaluations_templates", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "no action" } @@ -2271,14 +2164,10 @@ "connected_evaluations_evaluation_id_evaluations_id_fk": { "name": "connected_evaluations_evaluation_id_evaluations_id_fk", "tableFrom": "connected_evaluations", - "columnsFrom": [ - "evaluation_id" - ], + "columnsFrom": ["evaluation_id"], "tableTo": "evaluations", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "no action" } @@ -2287,10 +2176,7 @@ "uniqueConstraints": { "connected_evaluations_unique_idx": { "name": "connected_evaluations_unique_idx", - "columns": [ - "document_uuid", - "evaluation_id" - ], + "columns": ["document_uuid", "evaluation_id"], "nullsNotDistinct": false } } @@ -2451,42 +2337,30 @@ "evaluation_results_evaluation_id_evaluations_id_fk": { "name": "evaluation_results_evaluation_id_evaluations_id_fk", "tableFrom": "evaluation_results", - "columnsFrom": [ - "evaluation_id" - ], + "columnsFrom": ["evaluation_id"], "tableTo": "evaluations", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "cascade" }, "evaluation_results_document_log_id_document_logs_id_fk": { "name": "evaluation_results_document_log_id_document_logs_id_fk", "tableFrom": "evaluation_results", - "columnsFrom": [ - "document_log_id" - ], + "columnsFrom": ["document_log_id"], "tableTo": "document_logs", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "no action" }, "evaluation_results_provider_log_id_provider_logs_id_fk": { "name": "evaluation_results_provider_log_id_provider_logs_id_fk", "tableFrom": "evaluation_results", - "columnsFrom": [ - "provider_log_id" - ], + "columnsFrom": ["provider_log_id"], "tableTo": "provider_logs", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "no action" } @@ -2495,9 +2369,7 @@ "uniqueConstraints": { "evaluation_results_uuid_unique": { "name": "evaluation_results_uuid_unique", - "columns": [ - "uuid" - ], + "columns": ["uuid"], "nullsNotDistinct": false } } @@ -2562,14 +2434,10 @@ "evaluations_templates_category_evaluations_template_categories_id_fk": { "name": "evaluations_templates_category_evaluations_template_categories_id_fk", "tableFrom": "evaluations_templates", - "columnsFrom": [ - "category" - ], + "columnsFrom": ["category"], "tableTo": "evaluations_template_categories", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "cascade", "onDelete": "restrict" } @@ -2662,14 +2530,10 @@ "magic_link_tokens_user_id_users_id_fk": { "name": "magic_link_tokens_user_id_users_id_fk", "tableFrom": "magic_link_tokens", - "columnsFrom": [ - "user_id" - ], + "columnsFrom": ["user_id"], "tableTo": "users", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "cascade" } @@ -2678,9 +2542,7 @@ "uniqueConstraints": { "magic_link_tokens_token_unique": { "name": "magic_link_tokens_token_unique", - "columns": [ - "token" - ], + "columns": ["token"], "nullsNotDistinct": false } } @@ -2764,14 +2626,10 @@ "events_workspace_id_workspaces_id_fk": { "name": "events_workspace_id_workspaces_id_fk", "tableFrom": "events", - "columnsFrom": [ - "workspace_id" - ], + "columnsFrom": ["workspace_id"], "tableTo": "workspaces", "schemaTo": "latitude", - "columnsTo": [ - "id" - ], + "columnsTo": ["id"], "onUpdate": "no action", "onDelete": "no action" } @@ -2892,12 +2750,7 @@ "latitude.subscription_plans": { "name": "subscription_plans", "schema": "latitude", - "values": [ - "hobby_v1", - "hobby_v2", - "team_v1", - "enterprise_v1" - ] + "values": ["hobby_v1", "hobby_v2", "team_v1", "enterprise_v1"] }, "latitude.reward_types": { "name": "reward_types", @@ -2946,26 +2799,17 @@ "latitude.run_error_entity_enum": { "name": "run_error_entity_enum", "schema": "latitude", - "values": [ - "document_log", - "evaluation_result" - ] + "values": ["document_log", "evaluation_result"] }, "latitude.log_source": { "name": "log_source", "schema": "latitude", - "values": [ - "playground", - "api", - "evaluation" - ] + "values": ["playground", "api", "evaluation"] }, "latitude.metadata_type": { "name": "metadata_type", "schema": "latitude", - "values": [ - "llm_as_judge" - ] + "values": ["llm_as_judge"] }, "public.evaluation_result_types": { "name": "evaluation_result_types", @@ -2985,4 +2829,4 @@ "schemas": {}, "tables": {} } -} \ No newline at end of file +} diff --git a/packages/core/drizzle/meta/0086_snapshot.json b/packages/core/drizzle/meta/0086_snapshot.json new file mode 100644 index 000000000..8c3e7054d --- /dev/null +++ b/packages/core/drizzle/meta/0086_snapshot.json @@ -0,0 +1,2987 @@ +{ + "id": "ada4cbf9-70a2-44db-b836-ddd0ed56eb68", + "prevId": "4939be1e-dbd6-4a33-8fed-e33835c84bb4", + "version": "7", + "dialect": "postgresql", + "tables": { + "latitude.users": { + "name": "users", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "admin": { + "name": "admin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + } + }, + "latitude.sessions": { + "name": "sessions", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "sessions_user_id_users_id_fk": { + "name": "sessions_user_id_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "schemaTo": "latitude", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.workspaces": { + "name": "workspaces", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "current_subscription_id": { + "name": "current_subscription_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "creator_id": { + "name": "creator_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "workspaces_current_subscription_id_subscriptions_id_fk": { + "name": "workspaces_current_subscription_id_subscriptions_id_fk", + "tableFrom": "workspaces", + "tableTo": "subscriptions", + "schemaTo": "latitude", + "columnsFrom": [ + "current_subscription_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workspaces_creator_id_users_id_fk": { + "name": "workspaces_creator_id_users_id_fk", + "tableFrom": "workspaces", + "tableTo": "users", + "schemaTo": "latitude", + "columnsFrom": [ + "creator_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.subscriptions": { + "name": "subscriptions", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "plan": { + "name": "plan", + "type": "subscription_plans", + "typeSchema": "latitude", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "subscriptions_workspace_id_index": { + "name": "subscriptions_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "subscriptions_plan_index": { + "name": "subscriptions_plan_index", + "columns": [ + { + "expression": "plan", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.memberships": { + "name": "memberships", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "invitation_token": { + "name": "invitation_token", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "memberships_workspace_id_user_id_index": { + "name": "memberships_workspace_id_user_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "memberships_invitation_token_index": { + "name": "memberships_invitation_token_index", + "columns": [ + { + "expression": "invitation_token", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "memberships_workspace_id_workspaces_id_fk": { + "name": "memberships_workspace_id_workspaces_id_fk", + "tableFrom": "memberships", + "tableTo": "workspaces", + "schemaTo": "latitude", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "memberships_user_id_users_id_fk": { + "name": "memberships_user_id_users_id_fk", + "tableFrom": "memberships", + "tableTo": "users", + "schemaTo": "latitude", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "memberships_invitation_token_unique": { + "name": "memberships_invitation_token_unique", + "nullsNotDistinct": false, + "columns": [ + "invitation_token" + ] + } + } + }, + "latitude.api_keys": { + "name": "api_keys", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "token": { + "name": "token", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(256)", + "primaryKey": false, + "notNull": false + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_id_idx": { + "name": "workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "api_keys_workspace_id_workspaces_id_fk": { + "name": "api_keys_workspace_id_workspaces_id_fk", + "tableFrom": "api_keys", + "tableTo": "workspaces", + "schemaTo": "latitude", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "api_keys_token_unique": { + "name": "api_keys_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + } + }, + "latitude.claimed_rewards": { + "name": "claimed_rewards", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "creator_id": { + "name": "creator_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reward_type": { + "name": "reward_type", + "type": "reward_types", + "typeSchema": "latitude", + "primaryKey": false, + "notNull": true + }, + "reference": { + "name": "reference", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "is_valid": { + "name": "is_valid", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "claimed_rewards_workspace_id_idx": { + "name": "claimed_rewards_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "claimed_rewards_workspace_id_workspaces_id_fk": { + "name": "claimed_rewards_workspace_id_workspaces_id_fk", + "tableFrom": "claimed_rewards", + "tableTo": "workspaces", + "schemaTo": "latitude", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "claimed_rewards_creator_id_users_id_fk": { + "name": "claimed_rewards_creator_id_users_id_fk", + "tableFrom": "claimed_rewards", + "tableTo": "users", + "schemaTo": "latitude", + "columnsFrom": [ + "creator_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.projects": { + "name": "projects", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_idx": { + "name": "workspace_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "projects_deleted_at_idx": { + "name": "projects_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "projects_workspace_id_workspaces_id_fk": { + "name": "projects_workspace_id_workspaces_id_fk", + "tableFrom": "projects", + "tableTo": "workspaces", + "schemaTo": "latitude", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.commits": { + "name": "commits", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "title": { + "name": "title", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "merged_at": { + "name": "merged_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "project_commit_order_idx": { + "name": "project_commit_order_idx", + "columns": [ + { + "expression": "merged_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_commit_version": { + "name": "unique_commit_version", + "columns": [ + { + "expression": "version", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_idx": { + "name": "user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "merged_at_idx": { + "name": "merged_at_idx", + "columns": [ + { + "expression": "merged_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "project_id_idx": { + "name": "project_id_idx", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "commits_deleted_at_indx": { + "name": "commits_deleted_at_indx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "commits_project_id_projects_id_fk": { + "name": "commits_project_id_projects_id_fk", + "tableFrom": "commits", + "tableTo": "projects", + "schemaTo": "latitude", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "commits_user_id_users_id_fk": { + "name": "commits_user_id_users_id_fk", + "tableFrom": "commits", + "tableTo": "users", + "schemaTo": "latitude", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "commits_uuid_unique": { + "name": "commits_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + } + }, + "latitude.document_versions": { + "name": "document_versions", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "document_uuid": { + "name": "document_uuid", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "resolved_content": { + "name": "resolved_content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "commit_id": { + "name": "commit_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "document_versions_unique_document_uuid_commit_id": { + "name": "document_versions_unique_document_uuid_commit_id", + "columns": [ + { + "expression": "document_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "commit_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_versions_unique_path_commit_id_deleted_at": { + "name": "document_versions_unique_path_commit_id_deleted_at", + "columns": [ + { + "expression": "path", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "commit_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_versions_commit_id_idx": { + "name": "document_versions_commit_id_idx", + "columns": [ + { + "expression": "commit_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_versions_deleted_at_idx": { + "name": "document_versions_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_versions_path_idx": { + "name": "document_versions_path_idx", + "columns": [ + { + "expression": "path", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "document_versions_commit_id_commits_id_fk": { + "name": "document_versions_commit_id_commits_id_fk", + "tableFrom": "document_versions", + "tableTo": "commits", + "schemaTo": "latitude", + "columnsFrom": [ + "commit_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.provider_api_keys": { + "name": "provider_api_keys", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "provider", + "typeSchema": "latitude", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "author_id": { + "name": "author_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "provider_apikeys_workspace_id_idx": { + "name": "provider_apikeys_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "provider_api_keys_name_workspace_id_deleted_at_index": { + "name": "provider_api_keys_name_workspace_id_deleted_at_index", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "provider_apikeys_user_id_idx": { + "name": "provider_apikeys_user_id_idx", + "columns": [ + { + "expression": "author_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "provider_api_keys_token_provider_workspace_id_deleted_at_index": { + "name": "provider_api_keys_token_provider_workspace_id_deleted_at_index", + "columns": [ + { + "expression": "token", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "provider_api_keys_author_id_users_id_fk": { + "name": "provider_api_keys_author_id_users_id_fk", + "tableFrom": "provider_api_keys", + "tableTo": "users", + "schemaTo": "latitude", + "columnsFrom": [ + "author_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "provider_api_keys_workspace_id_workspaces_id_fk": { + "name": "provider_api_keys_workspace_id_workspaces_id_fk", + "tableFrom": "provider_api_keys", + "tableTo": "workspaces", + "schemaTo": "latitude", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "provider_api_keys_name_workspace_id_deleted_at_unique": { + "name": "provider_api_keys_name_workspace_id_deleted_at_unique", + "nullsNotDistinct": true, + "columns": [ + "name", + "workspace_id", + "deleted_at" + ] + }, + "provider_api_keys_token_provider_workspace_id_deleted_at_unique": { + "name": "provider_api_keys_token_provider_workspace_id_deleted_at_unique", + "nullsNotDistinct": true, + "columns": [ + "token", + "provider", + "workspace_id", + "deleted_at" + ] + } + } + }, + "latitude.document_logs": { + "name": "document_logs", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "document_uuid": { + "name": "document_uuid", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "commit_id": { + "name": "commit_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "resolved_content": { + "name": "resolved_content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parameters": { + "name": "parameters", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "custom_identifier": { + "name": "custom_identifier", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "log_source", + "typeSchema": "latitude", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "document_log_own_uuid_idx": { + "name": "document_log_own_uuid_idx", + "columns": [ + { + "expression": "uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_log_uuid_idx": { + "name": "document_log_uuid_idx", + "columns": [ + { + "expression": "document_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_logs_commit_id_idx": { + "name": "document_logs_commit_id_idx", + "columns": [ + { + "expression": "commit_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_logs_content_hash_idx": { + "name": "document_logs_content_hash_idx", + "columns": [ + { + "expression": "content_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_logs_created_at_idx": { + "name": "document_logs_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "document_logs_commit_id_commits_id_fk": { + "name": "document_logs_commit_id_commits_id_fk", + "tableFrom": "document_logs", + "tableTo": "commits", + "schemaTo": "latitude", + "columnsFrom": [ + "commit_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "document_logs_uuid_unique": { + "name": "document_logs_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + } + }, + "latitude.run_errors": { + "name": "run_errors", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "run_error_code_enum", + "typeSchema": "latitude", + "primaryKey": false, + "notNull": true + }, + "errorable_type": { + "name": "errorable_type", + "type": "run_error_entity_enum", + "typeSchema": "latitude", + "primaryKey": false, + "notNull": true + }, + "errorable_uuid": { + "name": "errorable_uuid", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "details": { + "name": "details", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "run_errors_errorable_entity_uuid_idx": { + "name": "run_errors_errorable_entity_uuid_idx", + "columns": [ + { + "expression": "errorable_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "errorable_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.provider_logs": { + "name": "provider_logs", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "uuid": { + "name": "uuid", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "document_log_uuid": { + "name": "document_log_uuid", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "provider_id": { + "name": "provider_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "model": { + "name": "model", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "finish_reason": { + "name": "finish_reason", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'stop'" + }, + "config": { + "name": "config", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "messages": { + "name": "messages", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "response_object": { + "name": "response_object", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "response_text": { + "name": "response_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tool_calls": { + "name": "tool_calls", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'[]'::json" + }, + "tokens": { + "name": "tokens", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "cost_in_millicents": { + "name": "cost_in_millicents", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "duration": { + "name": "duration", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "log_source", + "typeSchema": "latitude", + "primaryKey": false, + "notNull": true + }, + "apiKeyId": { + "name": "apiKeyId", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "generated_at": { + "name": "generated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "provider_idx": { + "name": "provider_idx", + "columns": [ + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "provider_logs_created_at_idx": { + "name": "provider_logs_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "provider_logs_workspace_id_index": { + "name": "provider_logs_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "provider_logs_provider_id_provider_api_keys_id_fk": { + "name": "provider_logs_provider_id_provider_api_keys_id_fk", + "tableFrom": "provider_logs", + "tableTo": "provider_api_keys", + "schemaTo": "latitude", + "columnsFrom": [ + "provider_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + }, + "provider_logs_apiKeyId_api_keys_id_fk": { + "name": "provider_logs_apiKeyId_api_keys_id_fk", + "tableFrom": "provider_logs", + "tableTo": "api_keys", + "schemaTo": "latitude", + "columnsFrom": [ + "apiKeyId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "provider_logs_uuid_unique": { + "name": "provider_logs_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + } + }, + "latitude.datasets": { + "name": "datasets", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "csv_delimiter": { + "name": "csv_delimiter", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "author_id": { + "name": "author_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_key": { + "name": "file_key", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "file_metadata": { + "name": "file_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "datasets_workspace_idx": { + "name": "datasets_workspace_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "datasets_author_idx": { + "name": "datasets_author_idx", + "columns": [ + { + "expression": "author_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "datasets_workspace_id_name_index": { + "name": "datasets_workspace_id_name_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "datasets_workspace_id_workspaces_id_fk": { + "name": "datasets_workspace_id_workspaces_id_fk", + "tableFrom": "datasets", + "tableTo": "workspaces", + "schemaTo": "latitude", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "datasets_author_id_users_id_fk": { + "name": "datasets_author_id_users_id_fk", + "tableFrom": "datasets", + "tableTo": "users", + "schemaTo": "latitude", + "columnsFrom": [ + "author_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.evaluations": { + "name": "evaluations", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata_id": { + "name": "metadata_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "metadata_type": { + "name": "metadata_type", + "type": "metadata_type", + "typeSchema": "latitude", + "primaryKey": false, + "notNull": true + }, + "configuration": { + "name": "configuration", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "evaluation_workspace_idx": { + "name": "evaluation_workspace_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "evaluation_metadata_idx": { + "name": "evaluation_metadata_idx", + "columns": [ + { + "expression": "metadata_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "metadata_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "evaluations_deleted_at_idx": { + "name": "evaluations_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "evaluations_workspace_id_workspaces_id_fk": { + "name": "evaluations_workspace_id_workspaces_id_fk", + "tableFrom": "evaluations", + "tableTo": "workspaces", + "schemaTo": "latitude", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "evaluations_uuid_unique": { + "name": "evaluations_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + } + }, + "latitude.llm_as_judge_evaluation_metadatas": { + "name": "llm_as_judge_evaluation_metadatas", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "prompt": { + "name": "prompt", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "configuration": { + "name": "configuration", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "template_id": { + "name": "template_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "llm_as_judge_evaluation_metadatas_template_id_idx": { + "name": "llm_as_judge_evaluation_metadatas_template_id_idx", + "columns": [ + { + "expression": "template_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "llm_as_judge_evaluation_metadatas_template_id_evaluations_templates_id_fk": { + "name": "llm_as_judge_evaluation_metadatas_template_id_evaluations_templates_id_fk", + "tableFrom": "llm_as_judge_evaluation_metadatas", + "tableTo": "evaluations_templates", + "schemaTo": "latitude", + "columnsFrom": [ + "template_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.connected_evaluations": { + "name": "connected_evaluations", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "live": { + "name": "live", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "document_uuid": { + "name": "document_uuid", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "connected_evaluations_evaluation_idx": { + "name": "connected_evaluations_evaluation_idx", + "columns": [ + { + "expression": "evaluation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "connected_evaluations_evaluation_id_evaluations_id_fk": { + "name": "connected_evaluations_evaluation_id_evaluations_id_fk", + "tableFrom": "connected_evaluations", + "tableTo": "evaluations", + "schemaTo": "latitude", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "connected_evaluations_unique_idx": { + "name": "connected_evaluations_unique_idx", + "nullsNotDistinct": false, + "columns": [ + "document_uuid", + "evaluation_id" + ] + } + } + }, + "latitude.evaluation_results": { + "name": "evaluation_results", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "evaluation_id": { + "name": "evaluation_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "document_log_id": { + "name": "document_log_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "provider_log_id": { + "name": "provider_log_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "resultable_type": { + "name": "resultable_type", + "type": "evaluation_result_types", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "resultable_id": { + "name": "resultable_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "log_source", + "typeSchema": "latitude", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "evaluation_idx": { + "name": "evaluation_idx", + "columns": [ + { + "expression": "evaluation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "document_log_idx": { + "name": "document_log_idx", + "columns": [ + { + "expression": "document_log_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "provider_log_idx": { + "name": "provider_log_idx", + "columns": [ + { + "expression": "provider_log_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resultable_idx": { + "name": "resultable_idx", + "columns": [ + { + "expression": "resultable_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resultable_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "evaluation_results_created_at_idx": { + "name": "evaluation_results_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "evaluation_results_evaluation_id_evaluations_id_fk": { + "name": "evaluation_results_evaluation_id_evaluations_id_fk", + "tableFrom": "evaluation_results", + "tableTo": "evaluations", + "schemaTo": "latitude", + "columnsFrom": [ + "evaluation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "evaluation_results_document_log_id_document_logs_id_fk": { + "name": "evaluation_results_document_log_id_document_logs_id_fk", + "tableFrom": "evaluation_results", + "tableTo": "document_logs", + "schemaTo": "latitude", + "columnsFrom": [ + "document_log_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "evaluation_results_provider_log_id_provider_logs_id_fk": { + "name": "evaluation_results_provider_log_id_provider_logs_id_fk", + "tableFrom": "evaluation_results", + "tableTo": "provider_logs", + "schemaTo": "latitude", + "columnsFrom": [ + "provider_log_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "evaluation_results_uuid_unique": { + "name": "evaluation_results_uuid_unique", + "nullsNotDistinct": false, + "columns": [ + "uuid" + ] + } + } + }, + "latitude.evaluations_templates": { + "name": "evaluations_templates", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "category": { + "name": "category", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "configuration": { + "name": "configuration", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "prompt": { + "name": "prompt", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "evaluations_templates_category_evaluations_template_categories_id_fk": { + "name": "evaluations_templates_category_evaluations_template_categories_id_fk", + "tableFrom": "evaluations_templates", + "tableTo": "evaluations_template_categories", + "schemaTo": "latitude", + "columnsFrom": [ + "category" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.evaluations_template_categories": { + "name": "evaluations_template_categories", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.magic_link_tokens": { + "name": "magic_link_tokens", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "token": { + "name": "token", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "expired_at": { + "name": "expired_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "magic_link_tokens_user_id_users_id_fk": { + "name": "magic_link_tokens_user_id_users_id_fk", + "tableFrom": "magic_link_tokens", + "tableTo": "users", + "schemaTo": "latitude", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "magic_link_tokens_token_unique": { + "name": "magic_link_tokens_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + } + }, + "latitude.events": { + "name": "events", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(256)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "event_workspace_idx": { + "name": "event_workspace_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "event_type_idx": { + "name": "event_type_idx", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "events_workspace_id_workspaces_id_fk": { + "name": "events_workspace_id_workspaces_id_fk", + "tableFrom": "events", + "tableTo": "workspaces", + "schemaTo": "latitude", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.evaluation_resultable_numbers": { + "name": "evaluation_resultable_numbers", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "result": { + "name": "result", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.evaluation_resultable_texts": { + "name": "evaluation_resultable_texts", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "result": { + "name": "result", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "latitude.evaluation_resultable_booleans": { + "name": "evaluation_resultable_booleans", + "schema": "latitude", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "result": { + "name": "result", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": { + "latitude.subscription_plans": { + "name": "subscription_plans", + "schema": "latitude", + "values": [ + "hobby_v1", + "hobby_v2", + "team_v1", + "enterprise_v1" + ] + }, + "latitude.reward_types": { + "name": "reward_types", + "schema": "latitude", + "values": [ + "github_star", + "follow", + "post", + "github_issue", + "referral", + "signup_launch_day" + ] + }, + "latitude.provider": { + "name": "provider", + "schema": "latitude", + "values": [ + "openai", + "anthropic", + "groq", + "mistral", + "azure", + "google", + "custom" + ] + }, + "latitude.run_error_code_enum": { + "name": "run_error_code_enum", + "schema": "latitude", + "values": [ + "unknown_error", + "default_provider_exceeded_quota_error", + "document_config_error", + "missing_provider_error", + "chain_compile_error", + "ai_run_error", + "unsupported_provider_response_type_error", + "ai_provider_config_error", + "ev_run_missing_provider_log_error", + "ev_run_missing_workspace_error", + "ev_run_unsupported_result_type_error", + "ev_run_response_json_format_error", + "default_provider_invalid_model_error" + ] + }, + "latitude.run_error_entity_enum": { + "name": "run_error_entity_enum", + "schema": "latitude", + "values": [ + "document_log", + "evaluation_result" + ] + }, + "latitude.log_source": { + "name": "log_source", + "schema": "latitude", + "values": [ + "playground", + "api", + "evaluation" + ] + }, + "latitude.metadata_type": { + "name": "metadata_type", + "schema": "latitude", + "values": [ + "llm_as_judge" + ] + }, + "public.evaluation_result_types": { + "name": "evaluation_result_types", + "schema": "public", + "values": [ + "evaluation_resultable_booleans", + "evaluation_resultable_texts", + "evaluation_resultable_numbers" + ] + } + }, + "schemas": { + "latitude": "latitude" + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/packages/core/drizzle/meta/_journal.json b/packages/core/drizzle/meta/_journal.json index f2e285b08..bc18b4b30 100644 --- a/packages/core/drizzle/meta/_journal.json +++ b/packages/core/drizzle/meta/_journal.json @@ -596,6 +596,13 @@ "when": 1730106440291, "tag": "0085_tan_wilson_fisk", "breakpoints": true + }, + { + "idx": 86, + "version": "7", + "when": 1730111133542, + "tag": "0086_legacy_evaluations_part_1", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/core/src/assets/evaluationTemplates.ts b/packages/core/src/assets/evaluationLegacyTemplates.ts similarity index 99% rename from packages/core/src/assets/evaluationTemplates.ts rename to packages/core/src/assets/evaluationLegacyTemplates.ts index 03fb29727..6678b6e07 100644 --- a/packages/core/src/assets/evaluationTemplates.ts +++ b/packages/core/src/assets/evaluationLegacyTemplates.ts @@ -1,4 +1,4 @@ -export const evaluationTemplates = [ +export const evaluationLegacyTemplates = [ { title: 'Factuality', template: diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 73296fd42..8893bce44 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -162,7 +162,7 @@ export type ChainEvent = } export enum EvaluationMetadataType { - LlmAsJudge = 'llm_as_judge', + LlmAsJudgeLegacy = 'llm_as_judge', } export enum EvaluationMode { diff --git a/packages/core/src/data-access/evaluationTemplates.ts b/packages/core/src/data-access/evaluationLegacyTemplates.ts similarity index 65% rename from packages/core/src/data-access/evaluationTemplates.ts rename to packages/core/src/data-access/evaluationLegacyTemplates.ts index 29796b878..296a2bd9a 100644 --- a/packages/core/src/data-access/evaluationTemplates.ts +++ b/packages/core/src/data-access/evaluationLegacyTemplates.ts @@ -4,24 +4,27 @@ import { EvaluationTemplate, EvaluationTemplateWithCategory } from '../browser' import { database } from '../client' import { NotFoundError } from '../lib/errors' import { Result, TypedResult } from '../lib/Result' -import { evaluationTemplateCategories, evaluationTemplates } from '../schema' +import { + evaluationLegacyTemplates, + evaluationTemplateCategories, +} from '../schema' export async function findAllEvaluationTemplates(): Promise< TypedResult > { const result = await database .select({ - ...getTableColumns(evaluationTemplates), + ...getTableColumns(evaluationLegacyTemplates), category: evaluationTemplateCategories.name, }) - .from(evaluationTemplates) + .from(evaluationLegacyTemplates) .innerJoin( evaluationTemplateCategories, - eq(evaluationTemplates.categoryId, evaluationTemplateCategories.id), + eq(evaluationLegacyTemplates.categoryId, evaluationTemplateCategories.id), ) .orderBy( asc(evaluationTemplateCategories.name), - asc(evaluationTemplates.name), + asc(evaluationLegacyTemplates.name), ) return Result.ok(result) } @@ -30,8 +33,8 @@ export async function findEvaluationTemplateById( id: number, db = database, ): Promise> { - const result = await db.query.evaluationTemplates.findFirst({ - where: eq(evaluationTemplates.id, id), + const result = await db.query.evaluationLegacyTemplates.findFirst({ + where: eq(evaluationLegacyTemplates.id, id), }) if (!result) { @@ -46,18 +49,18 @@ export async function filterEvaluationTemplatesById( ): Promise> { const result = await database .select({ - ...getTableColumns(evaluationTemplates), + ...getTableColumns(evaluationLegacyTemplates), category: evaluationTemplateCategories.name, }) - .from(evaluationTemplates) + .from(evaluationLegacyTemplates) .innerJoin( evaluationTemplateCategories, - eq(evaluationTemplates.categoryId, evaluationTemplateCategories.id), + eq(evaluationLegacyTemplates.categoryId, evaluationTemplateCategories.id), ) - .where(inArray(evaluationTemplates.id, ids)) + .where(inArray(evaluationLegacyTemplates.id, ids)) .orderBy( asc(evaluationTemplateCategories.name), - asc(evaluationTemplates.name), + asc(evaluationLegacyTemplates.name), ) return Result.ok(result) diff --git a/packages/core/src/data-access/index.ts b/packages/core/src/data-access/index.ts index 83c5e4ffa..9bdd201ec 100644 --- a/packages/core/src/data-access/index.ts +++ b/packages/core/src/data-access/index.ts @@ -1,7 +1,7 @@ export * from './apiKeys' export * from './users' export * from './workspaces' -export * from './evaluationTemplates' +export * from './evaluationLegacyTemplates' export * from './evaluationTemplateCategories' export * from './memberships' export * from './magicLinkTokens' diff --git a/packages/core/src/repositories/evaluationsRepository.ts b/packages/core/src/repositories/evaluationsRepository.ts index 0f2bd7901..d62f4e0ac 100644 --- a/packages/core/src/repositories/evaluationsRepository.ts +++ b/packages/core/src/repositories/evaluationsRepository.ts @@ -7,8 +7,8 @@ import { EvaluationMetadataType } from '../constants' import { NotFoundError, PromisedResult, Result } from '../lib' import { connectedEvaluations, + evaluationMetadataLlmAsJudgeLegacy, evaluations, - llmAsJudgeEvaluationMetadatas, } from '../schema' import RepositoryLegacy from './repository' @@ -18,11 +18,15 @@ const tt = { id: sql`llm_as_judge_evaluation_metadatas.id`.as( 'metadata_metadata_id', ), - ...omit(getTableColumns(llmAsJudgeEvaluationMetadatas), [ + configuration: + sql`llm_as_judge_evaluation_metadatas.configuration`.as( + 'metadata_metadata_configuration', + ), + ...omit(getTableColumns(evaluationMetadataLlmAsJudgeLegacy), [ 'id', - 'metadataType', 'createdAt', 'updatedAt', + 'configuration', ]), }, } @@ -36,15 +40,15 @@ export class EvaluationsRepository extends RepositoryLegacy< .select(tt) .from(evaluations) .innerJoin( - llmAsJudgeEvaluationMetadatas, + evaluationMetadataLlmAsJudgeLegacy, and( isNull(evaluations.deletedAt), - eq(evaluations.metadataId, llmAsJudgeEvaluationMetadatas.id), - eq(evaluations.metadataType, EvaluationMetadataType.LlmAsJudge), + eq(evaluations.metadataId, evaluationMetadataLlmAsJudgeLegacy.id), + eq(evaluations.metadataType, EvaluationMetadataType.LlmAsJudgeLegacy), ), ) .where(eq(evaluations.workspaceId, this.workspaceId)) - .as('evaluationsScope') + .as('evaluations_scope') } async findByName(name: string) { @@ -57,7 +61,7 @@ export class EvaluationsRepository extends RepositoryLegacy< return Result.error(new NotFoundError('Evaluation not found')) } - return Result.ok(result[0]!) + return Result.ok(result[0]! as EvaluationDto) } async findByUuid(uuid: string) { @@ -72,7 +76,7 @@ export class EvaluationsRepository extends RepositoryLegacy< ) } - return Result.ok(result[0]!) + return Result.ok(result[0]! as EvaluationDto) } async findByDocumentUuid(documentUuid: string) { @@ -97,7 +101,7 @@ export class EvaluationsRepository extends RepositoryLegacy< .from(this.scope) .where(inArray(this.scope.uuid, uuids)) - return Result.ok(result) + return Result.ok(result as EvaluationDto[]) } async filterById(ids: number[]) { @@ -106,6 +110,6 @@ export class EvaluationsRepository extends RepositoryLegacy< .from(this.scope) .where(inArray(this.scope.id, ids)) - return Result.ok(result) + return Result.ok(result as EvaluationDto[]) } } diff --git a/packages/core/src/schema/index.ts b/packages/core/src/schema/index.ts index 1b3c42d43..a4c6f4d15 100644 --- a/packages/core/src/schema/index.ts +++ b/packages/core/src/schema/index.ts @@ -24,10 +24,10 @@ export * from './models/providerLogs' // Evaluations tables export * from './models/datasets' export * from './models/evaluations' -export * from './models/llmAsJudgeEvaluationMetadatas' +export * from './models/evaluationMetadataLlmAsJudgeLegacy' export * from './models/connectedEvaluations' export * from './models/evaluationResults' -export * from './models/evaluationTemplates' +export * from './models/evaluationLegacyTemplates' export * from './models/evaluationTemplateCategories' export * from './models/magicLinkTokens' diff --git a/packages/core/src/schema/models/evaluationTemplates.ts b/packages/core/src/schema/models/evaluationLegacyTemplates.ts similarity index 82% rename from packages/core/src/schema/models/evaluationTemplates.ts rename to packages/core/src/schema/models/evaluationLegacyTemplates.ts index e5fe5d32f..c9507aca2 100644 --- a/packages/core/src/schema/models/evaluationTemplates.ts +++ b/packages/core/src/schema/models/evaluationLegacyTemplates.ts @@ -5,7 +5,7 @@ import { evaluationTemplateCategories, latitudeSchema } from '..' import { timestamps } from '../schemaHelpers' import { EvaluationResultConfiguration } from '../types' -export const evaluationTemplates = latitudeSchema.table( +export const evaluationLegacyTemplates = latitudeSchema.table( 'evaluations_templates', { id: bigserial('id', { mode: 'number' }).notNull().primaryKey(), @@ -23,11 +23,11 @@ export const evaluationTemplates = latitudeSchema.table( }, ) -export const evaluationTemplatesRelations = relations( - evaluationTemplates, +export const evaluationLegacyTemplatesRelations = relations( + evaluationLegacyTemplates, ({ one }) => ({ category: one(evaluationTemplateCategories, { - fields: [evaluationTemplates.categoryId], + fields: [evaluationLegacyTemplates.categoryId], references: [evaluationTemplateCategories.id], }), }), diff --git a/packages/core/src/schema/models/llmAsJudgeEvaluationMetadatas.ts b/packages/core/src/schema/models/evaluationMetadataLlmAsJudgeLegacy.ts similarity index 54% rename from packages/core/src/schema/models/llmAsJudgeEvaluationMetadatas.ts rename to packages/core/src/schema/models/evaluationMetadataLlmAsJudgeLegacy.ts index 5e1decae8..cba666753 100644 --- a/packages/core/src/schema/models/llmAsJudgeEvaluationMetadatas.ts +++ b/packages/core/src/schema/models/evaluationMetadataLlmAsJudgeLegacy.ts @@ -1,22 +1,21 @@ -import { bigint, bigserial, index, text, varchar } from 'drizzle-orm/pg-core' +import { bigint, bigserial, index, jsonb, text } from 'drizzle-orm/pg-core' -import { EvaluationMetadataType } from '../../constants' import { latitudeSchema } from '../db-schema' import { timestamps } from '../schemaHelpers' -import { evaluationTemplates } from './evaluationTemplates' +import { EvaluationResultConfiguration } from '../types' +import { evaluationLegacyTemplates } from './evaluationLegacyTemplates' -export const llmAsJudgeEvaluationMetadatas = latitudeSchema.table( +export const evaluationMetadataLlmAsJudgeLegacy = latitudeSchema.table( 'llm_as_judge_evaluation_metadatas', { id: bigserial('id', { mode: 'number' }).notNull().primaryKey(), - metadataType: varchar('metadata_type', { length: 256 }) - .notNull() - .default(EvaluationMetadataType.LlmAsJudge), - ...timestamps(), prompt: text('prompt').notNull(), + configuration: + jsonb('configuration').$type(), templateId: bigint('template_id', { mode: 'number' }).references( - () => evaluationTemplates.id, + () => evaluationLegacyTemplates.id, ), + ...timestamps(), }, (table) => ({ llmAsJudgeEvaluationMetadatasTemplateIdIdx: index( diff --git a/packages/core/src/schema/models/evaluations.ts b/packages/core/src/schema/models/evaluations.ts index 9b6bc5d62..7fb844dea 100644 --- a/packages/core/src/schema/models/evaluations.ts +++ b/packages/core/src/schema/models/evaluations.ts @@ -16,7 +16,7 @@ import { timestamps } from '../schemaHelpers' import { EvaluationResultConfiguration } from '../types' export const metadataTypesEnum = latitudeSchema.enum('metadata_type', [ - EvaluationMetadataType.LlmAsJudge, + EvaluationMetadataType.LlmAsJudgeLegacy, ]) export const evaluations = latitudeSchema.table( @@ -27,10 +27,9 @@ export const evaluations = latitudeSchema.table( name: varchar('name', { length: 256 }).notNull(), description: text('description').notNull(), metadataId: bigint('metadata_id', { mode: 'number' }).notNull(), - configuration: jsonb('configuration') - .notNull() - .$type(), metadataType: metadataTypesEnum('metadata_type').notNull(), + configuration: + jsonb('configuration').$type(), workspaceId: bigint('workspace_id', { mode: 'number' }) .notNull() .references(() => workspaces.id, { onDelete: 'cascade' }), diff --git a/packages/core/src/schema/relations.ts b/packages/core/src/schema/relations.ts index 2847d1634..3a98c198e 100644 --- a/packages/core/src/schema/relations.ts +++ b/packages/core/src/schema/relations.ts @@ -1,6 +1,9 @@ import { relations } from 'drizzle-orm' -import { evaluationTemplates, llmAsJudgeEvaluationMetadatas } from '.' +import { + evaluationLegacyTemplates, + evaluationMetadataLlmAsJudgeLegacy, +} from '.' import { apiKeys } from './models/apiKeys' import { commits } from './models/commits' import { connectedEvaluations } from './models/connectedEvaluations' @@ -132,21 +135,18 @@ export const evaluationRelations = relations(evaluations, ({ one }) => ({ fields: [evaluations.workspaceId], references: [workspaces.id], }), - llmAsJudgeEvaluationMetadata: one(llmAsJudgeEvaluationMetadatas, { - fields: [evaluations.metadataId, evaluations.metadataType], - references: [ - llmAsJudgeEvaluationMetadatas.id, - llmAsJudgeEvaluationMetadatas.metadataType, - ], - }), })) export const llmAsJudgeEvaluationMetadataRelations = relations( - llmAsJudgeEvaluationMetadatas, + evaluationMetadataLlmAsJudgeLegacy, ({ one }) => ({ - template: one(evaluationTemplates, { - fields: [llmAsJudgeEvaluationMetadatas.templateId], - references: [evaluationTemplates.id], + template: one(evaluationLegacyTemplates, { + fields: [evaluationMetadataLlmAsJudgeLegacy.templateId], + references: [evaluationLegacyTemplates.id], + }), + evaluation: one(evaluations, { + fields: [evaluationMetadataLlmAsJudgeLegacy.id], + references: [evaluations.metadataId], }), }), ) diff --git a/packages/core/src/schema/types.ts b/packages/core/src/schema/types.ts index 2dd0c2130..c6ec30b48 100644 --- a/packages/core/src/schema/types.ts +++ b/packages/core/src/schema/types.ts @@ -8,11 +8,11 @@ import { connectedEvaluations } from './models/connectedEvaluations' import { datasets } from './models/datasets' import { documentLogs } from './models/documentLogs' import { documentVersions } from './models/documentVersions' +import { evaluationLegacyTemplates } from './models/evaluationLegacyTemplates' +import { evaluationMetadataLlmAsJudgeLegacy } from './models/evaluationMetadataLlmAsJudgeLegacy' import { evaluationResults } from './models/evaluationResults' import { evaluations } from './models/evaluations' import { evaluationTemplateCategories } from './models/evaluationTemplateCategories' -import { evaluationTemplates } from './models/evaluationTemplates' -import { llmAsJudgeEvaluationMetadatas } from './models/llmAsJudgeEvaluationMetadatas' import { magicLinkTokens } from './models/magicLinkTokens' import { memberships } from './models/memberships' import { projects } from './models/projects' @@ -44,18 +44,21 @@ export type RunErrorInsert = InferInsertModel export type Evaluation = InferSelectModel export type ConnectedEvaluation = InferSelectModel export type EvaluationResult = InferSelectModel -export type EvaluationTemplate = InferSelectModel +export type EvaluationTemplate = InferSelectModel< + typeof evaluationLegacyTemplates +> export type MagicLinkToken = InferSelectModel export type ClaimedReward = InferSelectModel export type EvaluationTemplateCategory = InferSelectModel< typeof evaluationTemplateCategories > export type LlmAsJudgeEvaluationMetadata = InferSelectModel< - typeof llmAsJudgeEvaluationMetadatas + typeof evaluationMetadataLlmAsJudgeLegacy > export type Subscription = InferSelectModel export type EvaluationDto = Evaluation & { + configuration?: LlmAsJudgeEvaluationMetadata['configuration'] metadata: Omit< LlmAsJudgeEvaluationMetadata, 'metadataType' | 'createdAt' | 'updatedAt' diff --git a/packages/core/src/services/evaluationTemplates/create.test.ts b/packages/core/src/services/evaluationLegacyTemplates/create.test.ts similarity index 100% rename from packages/core/src/services/evaluationTemplates/create.test.ts rename to packages/core/src/services/evaluationLegacyTemplates/create.test.ts diff --git a/packages/core/src/services/evaluationTemplates/create.ts b/packages/core/src/services/evaluationLegacyTemplates/create.ts similarity index 94% rename from packages/core/src/services/evaluationTemplates/create.ts rename to packages/core/src/services/evaluationLegacyTemplates/create.ts index dda1701d4..b9ff45b61 100644 --- a/packages/core/src/services/evaluationTemplates/create.ts +++ b/packages/core/src/services/evaluationLegacyTemplates/create.ts @@ -2,7 +2,7 @@ import { EvaluationResultConfiguration } from '../../browser' import { database } from '../../client' import { findEvaluationTemplateCategoryById } from '../../data-access/evaluationTemplateCategories' import { NotFoundError, Result, Transaction } from '../../lib' -import { evaluationTemplates } from '../../schema' +import { evaluationLegacyTemplates } from '../../schema' import { createEvaluationTemplateCategory } from '../evaluationTemplateCategories/create' const DEFAULT_CATEGORY_NAME = 'Default Category' @@ -41,7 +41,7 @@ export async function createEvaluationTemplate( } const result = await tx - .insert(evaluationTemplates) + .insert(evaluationLegacyTemplates) .values({ name, description, diff --git a/packages/core/src/services/evaluationTemplates/createDefaultTemplates.ts b/packages/core/src/services/evaluationLegacyTemplates/createDefaultTemplates.ts similarity index 89% rename from packages/core/src/services/evaluationTemplates/createDefaultTemplates.ts rename to packages/core/src/services/evaluationLegacyTemplates/createDefaultTemplates.ts index 6a77cb7f0..39693997c 100644 --- a/packages/core/src/services/evaluationTemplates/createDefaultTemplates.ts +++ b/packages/core/src/services/evaluationLegacyTemplates/createDefaultTemplates.ts @@ -1,4 +1,4 @@ -import { evaluationTemplates } from '../../assets/evaluationTemplates' +import { evaluationLegacyTemplates } from '../../assets/evaluationLegacyTemplates' import { database } from '../../client' import { EvaluationResultableType } from '../../constants' import { Result, Transaction } from '../../lib' @@ -12,7 +12,7 @@ export function createDefaultEvaluationTemplates(db = database) { } Transaction.call(async (tx) => { - const promises = evaluationTemplates.map((template) => { + const promises = evaluationLegacyTemplates.map((template) => { const type = mapTypes[ template.type as keyof typeof mapTypes ] as EvaluationResultableType diff --git a/packages/core/src/services/evaluationTemplates/destroy.ts b/packages/core/src/services/evaluationLegacyTemplates/destroy.ts similarity index 71% rename from packages/core/src/services/evaluationTemplates/destroy.ts rename to packages/core/src/services/evaluationLegacyTemplates/destroy.ts index c6613a7f5..2b92018ec 100644 --- a/packages/core/src/services/evaluationTemplates/destroy.ts +++ b/packages/core/src/services/evaluationLegacyTemplates/destroy.ts @@ -2,7 +2,7 @@ import { eq } from 'drizzle-orm' import { database } from '../../client' import { Result, Transaction } from '../../lib' -import { evaluationTemplates } from '../../schema' +import { evaluationLegacyTemplates } from '../../schema' export function destroyEvaluationTemplate( { id }: { id: number }, @@ -10,8 +10,8 @@ export function destroyEvaluationTemplate( ) { return Transaction.call(async (tx) => { const result = await tx - .delete(evaluationTemplates) - .where(eq(evaluationTemplates.id, id)) + .delete(evaluationLegacyTemplates) + .where(eq(evaluationLegacyTemplates.id, id)) .returning() const deleted = result[0] diff --git a/packages/core/src/services/evaluationResults/aggregations/meanValueQuery.ts b/packages/core/src/services/evaluationResults/aggregations/meanValueQuery.ts index a44ee3ce2..b7019e884 100644 --- a/packages/core/src/services/evaluationResults/aggregations/meanValueQuery.ts +++ b/packages/core/src/services/evaluationResults/aggregations/meanValueQuery.ts @@ -3,7 +3,7 @@ import { and, eq, sql } from 'drizzle-orm' import { getCommitFilter } from '../_createEvaluationResultQuery' import { Commit, - Evaluation, + EvaluationDto, EvaluationResultConfiguration, } from '../../../browser' import { database } from '../../../client' @@ -18,7 +18,7 @@ export async function getEvaluationMeanValueQuery( commit, }: { workspaceId: number - evaluation: Evaluation + evaluation: EvaluationDto documentUuid: string commit: Commit }, @@ -47,7 +47,8 @@ export async function getEvaluationMeanValueQuery( ), ) const value = results[0] - const config = evaluation.configuration as EvaluationResultConfiguration + const config = (evaluation.configuration ?? + evaluation.metadata.configuration)! as EvaluationResultConfiguration const { from: minValue, to: maxValue } = config.detail!.range return { minValue, diff --git a/packages/core/src/services/evaluationResults/create.ts b/packages/core/src/services/evaluationResults/create.ts index 13eed08c2..af376f1ae 100644 --- a/packages/core/src/services/evaluationResults/create.ts +++ b/packages/core/src/services/evaluationResults/create.ts @@ -1,6 +1,5 @@ import { DocumentLog, - Evaluation, EvaluationDto, EvaluationResultableType, ProviderLog, @@ -33,7 +32,7 @@ export type EvaluationResultObject = { } export type CreateEvaluationResultProps = { uuid: string - evaluation: Evaluation | EvaluationDto + evaluation: EvaluationDto documentLog: DocumentLog providerLog?: ProviderLog result: EvaluationResultObject | undefined @@ -52,13 +51,15 @@ export async function createEvaluationResult( }: CreateEvaluationResultProps, db = database, ) { - const resultableTable = getResultable(evaluation.configuration.type) + const resultableTable = getResultable( + (evaluation.configuration ?? evaluation.metadata.configuration)!.type, + ) let resultableId: number | undefined if (!resultableTable && result) { return Result.error( new BadRequestError( - `Unsupported result type: ${evaluation.configuration.type}`, + `Unsupported result type: ${(evaluation.configuration ?? evaluation.metadata.configuration)!.type}`, ), ) } @@ -81,7 +82,10 @@ export async function createEvaluationResult( evaluationId: evaluation.id, documentLogId: documentLog.id, providerLogId: providerLog?.id, - resultableType: result ? evaluation.configuration.type : null, + resultableType: result + ? (evaluation.configuration ?? evaluation.metadata.configuration)! + .type + : null, resultableId, source: documentLog.source, }) diff --git a/packages/core/src/services/evaluations/EvaluationRunChecker/index.ts b/packages/core/src/services/evaluations/EvaluationRunChecker/index.ts index b648a4b09..d0f237530 100644 --- a/packages/core/src/services/evaluations/EvaluationRunChecker/index.ts +++ b/packages/core/src/services/evaluations/EvaluationRunChecker/index.ts @@ -84,7 +84,10 @@ export class EvaluationRunChecker { } private async buildSchema() { - const resultSchema = getResultSchema(this.evaluation.configuration.type) + const resultSchema = getResultSchema( + (this.evaluation.configuration ?? this.evaluation.metadata.configuration)! + .type, + ) if (resultSchema.error) { await this.saveError(resultSchema.error) diff --git a/packages/core/src/services/evaluations/create.test.ts b/packages/core/src/services/evaluations/create.test.ts index bad9c079b..6a0227ffd 100644 --- a/packages/core/src/services/evaluations/create.test.ts +++ b/packages/core/src/services/evaluations/create.test.ts @@ -6,6 +6,7 @@ import { EvaluationResultableType, Providers, } from '../../constants' +import { EvaluationsRepository } from '../../repositories' import * as factories from '../../tests/factories' import { createEvaluation } from './create' @@ -26,7 +27,7 @@ describe('createEvaluation', () => { user, name: 'Test Evaluation', description: 'Test Description', - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: EvaluationResultableType.Text, detail: { @@ -63,7 +64,7 @@ describe('createEvaluation', () => { user, name: 'Test Evaluation', description: 'Test Description', - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: EvaluationResultableType.Text, detail: { @@ -100,7 +101,7 @@ describe('createEvaluation', () => { user, name: 'Test Evaluation', description: 'Test Description', - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: EvaluationResultableType.Text, detail: { @@ -135,7 +136,7 @@ describe('createEvaluation', () => { user, name: 'Test Evaluation', description: 'Test Description', - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: EvaluationResultableType.Number, detail: { @@ -172,7 +173,7 @@ describe('createEvaluation', () => { user, name, description, - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: EvaluationResultableType.Number, detail: { @@ -210,7 +211,6 @@ ${metadata.prompt} `.trim(), }, workspaceId: workspace.id, - metadataType: EvaluationMetadataType.LlmAsJudge, }) }) @@ -227,13 +227,18 @@ ${metadata.prompt} configuration: { type: EvaluationResultableType.Text, }, - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, metadata, }) expect(result.ok).toBe(true) - const evaluation = result.value! - expect(evaluation.configuration.type).toBe(EvaluationResultableType.Text) + const repo = new EvaluationsRepository(workspace.id) + const evaluation = await repo + .find(result.value!.id) + .then((r) => r.unwrap()) + expect( + (evaluation.configuration ?? evaluation.metadata.configuration)!.type, + ).toBe(EvaluationResultableType.Text) }) it('creates an LLM as Judge evaluation with boolean configuration', async () => { @@ -246,7 +251,7 @@ ${metadata.prompt} user, name, description, - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: EvaluationResultableType.Boolean, }, @@ -254,12 +259,14 @@ ${metadata.prompt} }) expect(result.ok).toBe(true) - if (result.ok) { - const evaluation = result.value! - expect(evaluation.configuration.type).toBe( - EvaluationResultableType.Boolean, - ) - } + const repo = new EvaluationsRepository(workspace.id) + const evaluation = await repo + .find(result.value!.id) + .then((r) => r.unwrap()) + + expect( + (evaluation.configuration ?? evaluation.metadata.configuration)!.type, + ).toBe(EvaluationResultableType.Boolean) }) it('returns an error for invalid evaluation type', async () => { @@ -296,7 +303,7 @@ ${metadata.prompt} user, name: 'Test Evaluation', description: 'Test Description', - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: EvaluationResultableType.Text, }, @@ -304,10 +311,11 @@ ${metadata.prompt} }) expect(result.ok).toBe(true) - if (result.ok) { - const evaluation = result.value! - expect(evaluation.metadata.templateId).toBe(template.id) - } + const repo = new EvaluationsRepository(workspace.id) + const evaluation = await repo + .find(result.value!.id) + .then((r) => r.unwrap()) + expect(evaluation.metadata.templateId).toBe(template.id) }) it('does not allow to create a number type evaluation without proper configuration', async () => { @@ -316,7 +324,7 @@ ${metadata.prompt} user, name: 'Test Evaluation', description: 'Test Description', - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: EvaluationResultableType.Number, }, @@ -337,7 +345,7 @@ ${metadata.prompt} user, name: 'Test Evaluation', description: 'Test Description', - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: EvaluationResultableType.Number, detail: { @@ -364,7 +372,7 @@ ${metadata.prompt} user, name: 'Test Evaluation', description: 'Test Description', - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: EvaluationResultableType.Number, detail: { diff --git a/packages/core/src/services/evaluations/create.ts b/packages/core/src/services/evaluations/create.ts index c4ff7e02a..66a8c67e3 100644 --- a/packages/core/src/services/evaluations/create.ts +++ b/packages/core/src/services/evaluations/create.ts @@ -16,8 +16,8 @@ import { BadRequestError, NotFoundError, Result, Transaction } from '../../lib' import { ProviderApiKeysRepository } from '../../repositories' import { connectedEvaluations, + evaluationMetadataLlmAsJudgeLegacy, evaluations, - llmAsJudgeEvaluationMetadatas, } from '../../schema' type Props = { @@ -66,12 +66,17 @@ ${meta.prompt} : meta.prompt return await Transaction.call(async (tx) => { + validateConfiguration(configuration) + let metadataTable switch (type) { - case EvaluationMetadataType.LlmAsJudge: + case EvaluationMetadataType.LlmAsJudgeLegacy: metadataTable = await tx - .insert(llmAsJudgeEvaluationMetadatas) - .values({ prompt: promptWithProvider, templateId: meta.templateId }) + .insert(evaluationMetadataLlmAsJudgeLegacy) + .values({ + prompt: promptWithProvider, + templateId: meta.templateId, + }) .returning() break @@ -81,8 +86,6 @@ ${meta.prompt} ) } - validateConfiguration(configuration) - const result = await tx .insert(evaluations) .values([ @@ -147,7 +150,7 @@ export async function importLlmAsJudgeEvaluation( workspace, name: template.name, description: template.description, - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: template.configuration, metadata: { prompt: template.prompt, diff --git a/packages/core/src/services/evaluations/run.test.ts b/packages/core/src/services/evaluations/run.test.ts index 7d0b25948..5c83b1057 100644 --- a/packages/core/src/services/evaluations/run.test.ts +++ b/packages/core/src/services/evaluations/run.test.ts @@ -29,8 +29,8 @@ import { Result } from '../../lib' import * as generateUUIDModule from '../../lib/generateUUID' import { documentLogs, + evaluationMetadataLlmAsJudgeLegacy, evaluationResults, - evaluations, providerApiKeys, providerLogs, runErrors, @@ -204,7 +204,8 @@ describe('run', () => { expect(evaluationResult).toMatchObject({ uuid: FAKE_GENERATED_UUID, - resultableType: evaluation.configuration.type, + resultableType: (evaluation.configuration ?? + evaluation.metadata.configuration)!.type, source: LogSources.API, }) }) @@ -324,7 +325,7 @@ describe('run', () => { it('fails evaluation type is not recognized', async () => { const evals = await database - .update(evaluations) + .update(evaluationMetadataLlmAsJudgeLegacy) .set({ configuration: { ...evaluation.configuration, @@ -332,7 +333,7 @@ describe('run', () => { type: 'unknown', }, }) - .where(eq(evaluations.id, evaluation.id)) + .where(eq(evaluationMetadataLlmAsJudgeLegacy.id, evaluation.metadataId)) .returning() const updatedEvaluation = evals[0]! @@ -342,7 +343,7 @@ describe('run', () => { evaluation: { ...updatedEvaluation, metadata: { prompt: 'foo' }, - } as EvaluationDto, + } as unknown as EvaluationDto, }) const error = await findError( RunErrorCodes.EvaluationRunUnsupportedResultTypeError, diff --git a/packages/core/src/services/evaluations/update.ts b/packages/core/src/services/evaluations/update.ts index 68a777290..19ce5cffb 100644 --- a/packages/core/src/services/evaluations/update.ts +++ b/packages/core/src/services/evaluations/update.ts @@ -6,7 +6,7 @@ import { EvaluationDto } from '../../browser' import { database } from '../../client' import { Result, Transaction } from '../../lib' import { compactObject } from '../../lib/compactObject' -import { evaluations, llmAsJudgeEvaluationMetadatas } from '../../schema' +import { evaluationMetadataLlmAsJudgeLegacy, evaluations } from '../../schema' export async function updateEvaluation( { @@ -37,9 +37,11 @@ export async function updateEvaluation( values = compactObject(metadata) if (!isEmpty(values)) { updatedMetadata = await tx - .update(llmAsJudgeEvaluationMetadatas) + .update(evaluationMetadataLlmAsJudgeLegacy) .set(values) - .where(eq(llmAsJudgeEvaluationMetadatas.id, evaluation.metadata.id)) + .where( + eq(evaluationMetadataLlmAsJudgeLegacy.id, evaluation.metadata.id), + ) .returning() } diff --git a/packages/core/src/tests/factories/connectedEvaluations.ts b/packages/core/src/tests/factories/connectedEvaluations.ts index b372462cb..7b16259a0 100644 --- a/packages/core/src/tests/factories/connectedEvaluations.ts +++ b/packages/core/src/tests/factories/connectedEvaluations.ts @@ -29,12 +29,12 @@ export async function createConnectedEvaluation({ workspace, name: faker.company.name(), description: faker.lorem.sentence(), - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, configuration: { type: EvaluationResultableType.Boolean, }, metadata: { - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, prompt: faker.lorem.sentence(), }, }).then((r) => r.unwrap()) diff --git a/packages/core/src/tests/factories/evaluationTemplates.ts b/packages/core/src/tests/factories/evaluationTemplates.ts index 78d21afe2..64f2da09c 100644 --- a/packages/core/src/tests/factories/evaluationTemplates.ts +++ b/packages/core/src/tests/factories/evaluationTemplates.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import { EvaluationResultableType } from '../../constants' -import { createEvaluationTemplate as createEvaluationTemplateService } from '../../services/evaluationTemplates/create' +import { createEvaluationTemplate as createEvaluationTemplateService } from '../../services/evaluationLegacyTemplates/create' export type IEvaluationTemplateData = { name?: string diff --git a/packages/core/src/tests/factories/evaluations.ts b/packages/core/src/tests/factories/evaluations.ts index f90db9e6b..383bbefcf 100644 --- a/packages/core/src/tests/factories/evaluations.ts +++ b/packages/core/src/tests/factories/evaluations.ts @@ -32,7 +32,7 @@ export async function createLlmAsJudgeEvaluation({ workspace, user, metadata: { prompt: prompt ?? faker.lorem.sentence() }, - type: EvaluationMetadataType.LlmAsJudge, + type: EvaluationMetadataType.LlmAsJudgeLegacy, name: name ?? faker.company.catchPhrase(), description: description ?? faker.lorem.sentence(), configuration,