Add doc comments for widget *PromptJSON types#3454
Add doc comments for widget *PromptJSON types#3454benchristel wants to merge 28 commits intomainfrom
*PromptJSON types#3454Conversation
🗄️ Schema Change: No Changes ✅ |
🛠️ Item Splitting: No Changes ✅ |
|
Size Change: 0 B Total Size: 497 kB ℹ️ View Unchanged
|
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (15b2af7) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3454If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3454If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3454 |
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
| export type {CategorizerPromptJSON} from "./widget-ai-utils/categorizer/categorizer-ai-utils"; | ||
| export type {DefinitionPromptJSON} from "./widget-ai-utils/definition/definition-ai-utils"; | ||
| export type {DropdownPromptJSON} from "./widget-ai-utils/dropdown/dropdown-ai-utils"; | ||
| export type {UnsupportedWidgetPromptJSON} from "./widget-ai-utils/unsupported-widget"; |
There was a problem hiding this comment.
I need to add exports for the other types here!
|
I wonder if we also need to add a widget guidance to the comments? |
| * The current state of the widget user interface. Usually represents a | ||
| * learner's attempt to answer a question. |
There was a problem hiding this comment.
I'm trying to think... but are there situations where this isn't the learner's attempt?
| * 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. |
There was a problem hiding this comment.
The first item in the array (2) means the third category was selected, right (they're 0-based array indices). It becomes clear when I read to the end and see that the "third item is in category 0" but it is slightly confusing for me.
| hasNoneOfTheAbove: boolean; | ||
|
|
||
| /** | ||
| * The answer choices presented to the learner. |
There was a problem hiding this comment.
Are these guaranteed to be in the order that the learner saw them?
| type BaseGraphOptions = { | ||
| type: string; | ||
| }; |
There was a problem hiding this comment.
Thanks for migrating these types to embed a constant string for each type! That's a great improvement.
| import type React from "react"; | ||
|
|
||
| /** | ||
| * JSON describing an InputNumber widget. Intended for consumption by AI tools. |
There was a problem hiding this comment.
I'm not sure if there's benefits, but perhaps we describe this widget as being deprecated and that numeric-input is preferred?
| // TODO(LEMS-4033): render an intelligible string for simplify; the | ||
| // current values ("optional", "required", "enforced") aren't | ||
| // self-explanatory. | ||
| simplify: string; |
There was a problem hiding this comment.
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
These doc comments will appear in the Perseus API docs. The intended
audience is engineers on other KA teams who are feeding Perseus user
input data to LLMs.
Issue: LEMS-3893
Test plan:
None