-
Notifications
You must be signed in to change notification settings - Fork 364
Add doc comments for widget *PromptJSON types
#3454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 27 commits
0c74b67
8378681
755254c
8e7ffff
7767fc8
5df1486
b7b215c
2f39fd2
d8da863
24de8fd
a6547c8
712a8a0
250d23e
006f86c
17f3aec
ace123f
54636cf
c07788b
b79590c
83b9f41
758eb5c
bde7295
6bfff0c
85203e1
e0693a2
2ed2de1
15b2af7
782be05
f35f71b
06da644
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,44 @@ | ||
| import type categorizer from "../../widgets/categorizer/categorizer"; | ||
| import type React from "react"; | ||
|
|
||
| /** | ||
| * JSON describing a categorizer widget. Intended for consumption by AI tools. | ||
| * A categorizer displays a table where each row represents an item to be | ||
| * categorized, and each column represents a category. Each table cell contains | ||
| * a bubble that the learner can fill to indicate that that item belongs in | ||
| * that category. Only one bubble in each row can be filled. Learners fill | ||
| * bubbles by clicking on them. | ||
| */ | ||
| export type CategorizerPromptJSON = { | ||
| type: "categorizer"; | ||
|
|
||
| /** | ||
| * The configuration of the widget, set by the content creator. | ||
| */ | ||
| options: { | ||
| /** | ||
| * The items for the learner to categorize. | ||
| */ | ||
| items: ReadonlyArray<string>; | ||
|
|
||
| /** | ||
| * Categories to which items can be assigned. | ||
| */ | ||
| categories: ReadonlyArray<string>; | ||
| }; | ||
|
|
||
| /** | ||
| * The current state of the widget user interface. Usually represents a | ||
| * learner's attempt to answer a question. | ||
|
Comment on lines
+31
to
+32
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm trying to think... but are there situations where this isn't the learner's attempt?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the editors? I guess not all widgets use I'm trying to cover all the bases because we don't control how Perseus is used, only its behavior. |
||
| */ | ||
| userInput: { | ||
| /** | ||
| * The category indices for each item. Elements in this array | ||
| * correspond to elements of `options.items`, and refer to indices of | ||
| * the `categories` array. For example, a value of `[2, null, 0]` means | ||
| * that the first item is in category 2, the second item has not been | ||
| * assigned to a category, and the third item is in category 0. | ||
|
||
| */ | ||
| itemToCategoryMapping: ReadonlyArray<number | null | undefined>; | ||
| }; | ||
| }; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,13 +1,40 @@ | ||||
| import type inputNumber from "../../widgets/input-number/input-number"; | ||||
| import type React from "react"; | ||||
|
|
||||
| /** | ||||
| * JSON describing an InputNumber widget. Intended for consumption by AI tools. | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if there's benefits, but perhaps we describe this widget as being deprecated and that |
||||
| * An InputNumber displays a text field where users can enter numbers in a | ||||
| * variety of formats: decimals, integers, fractions, mixed numbers, | ||||
| * percentages, and multiples of pi. The allowed formats are configurable by | ||||
| * the content creator. | ||||
| */ | ||||
| export type InputNumberPromptJSON = { | ||||
| type: "input-number"; | ||||
|
|
||||
| /** The configuration of the widget, set by the content creator. */ | ||||
| options: { | ||||
| /** | ||||
| * Indicates how answers in unsimplified form are scored. | ||||
| * | ||||
| * - "optional" means the answer can be unsimplified. | ||||
| * - "required" means an unsimplified answer is considered invalid, | ||||
| * and the learner can try again without penalty. | ||||
| * - "enforced" means unsimplified answers are counted as incorrect. | ||||
| */ | ||||
| // TODO(LEMS-4033): render an intelligible string for simplify; the | ||||
| // current values ("optional", "required", "enforced") aren't | ||||
| // self-explanatory. | ||||
| simplify: string; | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not directly related, but can this be a union of the actual string values this can be? It is for the main widget options: perseus/packages/perseus-core/src/data-schema.ts Line 2132 in 669ed4e
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's technically a breaking change, since client code could be instantiating this type with other string values, but I don't think anyone is actually doing that.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I'm not going to change this type at the moment, because it will change again when we resolve this TODO comment: Since we're passing this data to an LLM, we should use descriptive English strings, not enum values. |
||||
| /** The expected numeric form, e.g. "rational", "decimal" */ | ||||
| answerType: string; | ||||
| }; | ||||
|
|
||||
| /** | ||||
| * The current state of the widget user interface. Usually represents a | ||||
| * learner's attempt to answer a question. | ||||
| */ | ||||
| userInput: { | ||||
| /** The text input by the user */ | ||||
| value: string; | ||||
| }; | ||||
| }; | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.