Data Model Refactor + Better Parsing#277
Open
ekeilty17 wants to merge 2 commits into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reasons for Refactor
1. Fixing Critical Bugs
The previous iteration of the codebase contained a few bugs which were not easy to fix. Namely relating to how watsonx Assistant manages step variable IDs. When actions are duplicated, so are their variables. In many situations the same variable is reused. The previous code was conflating these duplicate variables across actions and thus conflating their metadata, leading to inaccurate reports.
2. More Complete Parsing
The previous iteration of the codebase made certain simplifications in its parsing of the wxa json. As a result, there are certain features that would be difficult to implement in the previous codebase. In particular, toggles related to step settings such as
Display optionsandRepeat response after the validation message. These toggles are not simple booleans, and must be computed based on other fields.3. Better Modularization and Documentation
Good code should be self-documenting. The previous iteration of the codebase was close, but not quite there. This is a must in the era of AI coding tools.
4. CLI Deficiencies
The previous iterating of the codebase had only moderate CLI documentation, and did not allow for packagage.
New Features
1. Strong Typing
All relevant objects in the assistant JSON are now parsed into a
dataclass. This makes the code easier to understand, easier to maintain, and ensures future-proofing.The other benefit of using dataclasses is LLMs are highly trained on them. So AI coding tools can easily navigate to the appropriate dataclass to get exactly the context they need. In the future, this will better enable a
skill.mdfile to be written, so the AI coding tool can utilize the SDK features for custom scripts.2. Complete Modelling of the Assistant JSON
All important fields in the assistant JSON have been parsed in the refactor. This includes several new fields not present in the previous code base, such as
handlersquestionresponse_type(all of them)system_settings3. Variables
Variable handling has been completely overhauled to account for duplications. Now, a
uidfield is present which can differentiate between duplicated variables which share anid.Additionally, there is better differentiation between all variable types (skill, step, result, and system). The user can now filter on these variable types.
4. Entities
Entities are now being extracted from conditions/context. Additionally, we are parsing in the
questionfield for entities and surfacing that to the user5. Action Conditions
Action conditions are being parsed and surfaced to the user.
6. Response Types
In the previous iteration, only text responses and option responses were being parsed. Now all response types have been added. Additionally, more metadata about the response types are being parsed.
7. Inferred Settings Toggles
Toggles in step settings such as
Display optionsandRepeat response after the validation messagemust be inferred based on fields inTextResponseand theQuestionobjects. This was difficult to do in the previous version of the code. Now these toggle values are being computed.8. Improved CLI
cli/folder--helpon any instruction and it will explain how to use the CLI and gives examples.DCO 1.1 Signed-off-by: Eric Keilty eric.keilty@ibm.com