Skip to content

Commit

Permalink
Quick fix for relative values in Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
OAGr committed Jan 9, 2024
1 parent f8a3e45 commit ff5fafb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/hub/src/relative-values/values/ModelEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ function buildRelativeValue({
return { ok: false, value: result.value.toString() };
}
const dict = result.value.asJS();
if (!(dict instanceof Map)) {
return { ok: false, value: "Expected dict" };

if (!dict || typeof dict !== "object" || !("value" in dict)) {
return { ok: false, value: "Expected dict with 'value'" };
}

const rvSchema = z.object({
Expand All @@ -74,7 +75,7 @@ function buildRelativeValue({
uncertainty: z.number(),
});

const itemResult = rvSchema.safeParse(Object.fromEntries(dict.entries()));
const itemResult = rvSchema.safeParse(dict["value"]);
if (!itemResult.success) {
return {
ok: false,
Expand Down

2 comments on commit ff5fafb

@vercel
Copy link

@vercel vercel bot commented on ff5fafb Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

quri-ui – ./packages/ui

quri-ui-quantified-uncertainty.vercel.app
quri-ui-git-main-quantified-uncertainty.vercel.app
quri-ui.vercel.app

@vercel
Copy link

@vercel vercel bot commented on ff5fafb Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.