-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary: [There was discussion around the names of things in the AI folder being confusing.](https://khanacademy.slack.com/archives/C01AZ9H8TTQ/p1731537082583919) What this PR does: 1. renames `prompt-utils.ts` files to `[widget]-ai-utils.ts` 2. most of these directories had two test files (1) testing `getPromptJSON` directly and (2) testing `getPromptJSON` on the widget export; I just combined these test files and renamed them to `[widget]-ai-utils.test.ts` 3. updates the REAME No real logic changes, just code shoveling. Author: handeyeco Reviewers: SonicScrewdriver, handeyeco Required Reviewers: Approved By: SonicScrewdriver Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald Pull Request URL: #1860
- Loading branch information
Showing
122 changed files
with
1,755 additions
and
1,665 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@khanacademy/perseus": patch | ||
--- | ||
|
||
Rename AI util files |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
# What are these utilities for? | ||
# Widget AI utils | ||
|
||
We want to have a representation of Perseus widgets that LLMs can understand. | ||
They understand JSON pretty well! This is a set of utility functions for each | ||
widget that get the minimum amount of data for an LLM to understand the state | ||
of the widget, as well as the current user input. | ||
> [!CAUTION] | ||
> This code is not meant to be interwoven with Perseus' core logic. | ||
> We want to keep it as isolated as possible from the rest of Perseus. | ||
> [!CAUTION] | ||
> Please be cautious making changes within this folder, | ||
> it's an external API consumed by the team working on Khanmigo. | ||
## Motivation | ||
|
||
1. The team working on Khanmigo needed access to Perseus data for prompt engineering - including both external-facing things (like the ItemData and UserInput) and internal things (like RenderProps) | ||
2. The Perseus team didn't want to write a blank check exposing all of our internal data because that would make it difficult for us to safely make internal changes | ||
3. The goal of the helpers in this folder is to have a set of functions that can take _all_ the information the Khanmigo team could possibly want and return only the pieces the Khanmigo team needs | ||
|
||
## What are these utilities for? | ||
|
||
We want to have a representation of Perseus widgets that LLMs can understand. They understand JSON pretty well! This is a set of utility functions for each widget that get the minimum amount of data for an LLM to understand the state of the widget, as well as the current user input. | ||
|
||
|
||
### Why don't we just pass the raw widget json? | ||
|
||
We do not want to have the an external API relying on the internal | ||
representation of Perseus widgets. That would couple the widgets implementation | ||
to an external API, which would be subject to breakage. This approach balances | ||
having an explicit API, while keeping Perseus widgets mostly unaware of the | ||
LLM prompt requirements. | ||
We do not want to have the external API relying on the internal | ||
representation of Perseus widgets. That would couple the widgets implementation to an external API, which would be subject to breakage. This approach balances having an explicit API, while keeping Perseus widgets mostly unaware of the LLM prompt requirements. |
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
File renamed without changes.
30 changes: 0 additions & 30 deletions
30
packages/perseus/src/widget-ai-utils/categorizer/prompt-utils.test.ts
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
13 changes: 0 additions & 13 deletions
13
packages/perseus/src/widget-ai-utils/cs-program/prompt-utils.test.ts
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
18 changes: 0 additions & 18 deletions
18
packages/perseus/src/widget-ai-utils/definition/prompt-utils.test.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.