From f5e95bbf18ce0f18468ccc6ddd0e4abc919529db Mon Sep 17 00:00:00 2001 From: gtarpenning Date: Mon, 18 Nov 2024 15:56:58 -0800 Subject: [PATCH] correct enum type --- .../pages/ScorersPage/AnnotationScorerForm.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse3/pages/ScorersPage/AnnotationScorerForm.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse3/pages/ScorersPage/AnnotationScorerForm.tsx index 471547fb121..a931c51885a 100644 --- a/weave-js/src/components/PagePanelComponents/Home/Browse3/pages/ScorersPage/AnnotationScorerForm.tsx +++ b/weave-js/src/components/PagePanelComponents/Home/Browse3/pages/ScorersPage/AnnotationScorerForm.tsx @@ -29,8 +29,8 @@ const AnnotationScorerFormSchema = z.object({ .describe('Optional maximum length of the string'), }), z.object({ - type: z.literal('array'), - options: z.array(z.string()).describe('List of options to choose from'), + type: z.literal('enum'), + enum: z.array(z.string()).describe('List of options to choose from'), }), ]), }); @@ -75,6 +75,10 @@ export const onAnnotationScorerSave = async ( data: z.infer, client: TraceServerClient ) => { + let type = data.Type.type; + if (type === 'enum') { + type = 'string'; + } return createBaseObjectInstance(client, 'AnnotationSpec', { obj: { project_id: projectIdFromParts({entity, project}), @@ -82,7 +86,10 @@ export const onAnnotationScorerSave = async ( val: { name: data.Name, description: data.Description, - json_schema: data.Type, + json_schema: { + ...data.Type, + type, + }, }, }, });