griptape icon indicating copy to clipboard operation
griptape copied to clipboard

Refactor RuleMixin

Open collindutter opened this issue 4 months ago • 1 comments

Describe your changes

This PR was originally to solve https://github.com/griptape-ai/griptape/issues/1155 but it revealed an odd quirk of RuleMixin. RuleMixin.structure was added so that framework components that implement this mixin could inherit rules/rulesets from a Structure. In practice this is only really relevant in Tasks that want to inherit from their Structure. But Tasks already have a structure field which lead to some weirdness duplicate fields.

This PR removes RuleMixin.structure and moves the inheritance logic to PromptTask. Additionally, inherited rules will be merged into the Structure's "Default Ruleset" instead of having a weird "Additional Ruleset". It also removes the restriction on passing both rules and rulesets. If you pass rules, they will just be added to a Default Ruleset.

Issue ticket number and link

Closes https://github.com/griptape-ai/griptape/issues/1155 Unblocks https://github.com/griptape-ai/griptape/issues/1154

collindutter avatar Oct 03 '24 22:10 collindutter