-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into xtra-scorers
- Loading branch information
Showing
78 changed files
with
3,671 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...e-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectVersionOutputOf.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...src/components/PagePanelComponents/Home/Browse3/feedback/HumanFeedback/tsHumanFeedback.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
export type FeedbackTypeParts = { | ||
field: string; | ||
userDefinedType: string; | ||
feedbackType: string; | ||
displayName: string; | ||
}; | ||
|
||
export const parseFeedbackType = ( | ||
inputField: string | ||
): FeedbackTypeParts | null => { | ||
// input: summary.weave.feedback.wandb.annotation.Numerical-field-2.payload.value | ||
// or input: wandb.annotation.Numerical-field-2.payload.value | ||
// or input: feedback.[wandb.annotation.Numerical-field-2].payload.value | ||
// | ||
// output: | ||
// field: wandb.annotation.Numerical-field-2 | ||
// userDefinedType: Numerical-field-2 | ||
// type: annotation | ||
// displayName: Annotation.Numerical-field-2 | ||
|
||
// If the field is coming from the flattened table, remove the | ||
// summary portion | ||
const field = inputField.startsWith('summary.weave.feedback') | ||
? inputField.replace('summary.weave.feedback.', '') | ||
: inputField; | ||
const deBracketed = field.replace(/\[.*\]/g, ''); | ||
const split = deBracketed.split('.'); | ||
if (split.length !== 5) { | ||
return null; | ||
} | ||
const [w, type, userDefinedType, p, v] = split; | ||
|
||
if (v !== 'value') { | ||
throw new Error(`Expected 'value' prefix, got '${v}'`); | ||
} | ||
if (p !== 'payload') { | ||
throw new Error(`Expected 'payload' prefix, got '${p}'`); | ||
} | ||
if (w !== 'wandb') { | ||
return null; | ||
} | ||
return { | ||
field, | ||
feedbackType: type, | ||
userDefinedType, | ||
displayName: `${ | ||
type.charAt(0).toUpperCase() + type.slice(1) | ||
}.${userDefinedType}`, | ||
}; | ||
}; | ||
|
||
export const convertFeedbackFieldToBackendFilter = (field: string): string => { | ||
const parsed = parseFeedbackType(field); | ||
if (parsed === null) { | ||
return field; | ||
} | ||
const {feedbackType, userDefinedType} = parsed; | ||
return `feedback.[wandb.${feedbackType}.${userDefinedType}].payload.value`; | ||
}; |
Oops, something went wrong.