-
Couldn't load subscription status.
- Fork 34
refactor: centralize model requirements logic per Issue #66 #69
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
refactor: centralize model requirements logic per Issue #66 #69
Conversation
|
@felixarntz The refractor is ready for review, in your hands |
|
@Ref34t Just spotting this has merge conflicts - would you be able to resolve these please? |
|
@felixarntz will tackle it today sure |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @mohamed.khaled@9hdigital.com. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
@felixarntz The merge conflicts have been resolved. kindly review now 🥇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ref34t This looks like a solid start!
There are a few areas where maintaining the original logic would be preferable from a performance and architecture perspective. Likely because that's not the case, there are currently a few problems that need to be addressed either way.
- Move ModelConfig::toRequiredOptions() → ModelRequirements::fromPromptData() - Move ModelMetadata::meetsRequirements() → ModelRequirements::areMetBy() - Remove PromptBuilder::getModelRequirements() method - Update all call sites to use centralized requirements logic - Add comprehensive test coverage for new methods - Remove unused optimization maps from ModelMetadata Fixes separation of concerns between core API components and model discovery. ModelConfig and ModelMetadata are now pure data holders while ModelRequirements handles all requirement analysis and validation logic.
These test methods were testing the toRequiredOptions() method that was removed as part of Issue WordPress#66 refactoring. The functionality has been moved to ModelRequirements::fromPromptData() method.
- Remove unused OptionEnum import - Fix class closing brace formatting
Update areMetBy() and fromPromptData() method @SInCE annotations from n.e.x.t to 0.2.0 to match the milestone.
196eb71 to
29c06c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ref34t This looks excellent - thank you for the iterations!
Summary
Implements Issue #66 by centralizing model requirements logic into the
ModelRequirementsclass, improving separation of concerns between core API components and model discovery functionality.Changes Made
Move methods to a centralized location:
ModelConfig::toRequiredOptions()→ModelRequirements::fromPromptData()ModelMetadata::meetsRequirements()→ModelRequirements::areMetBy()Remove
PromptBuilder::getModelRequirements()method per issue requirementsUpdate call sites:
PromptBuilder now calls
ModelRequirements::fromPromptData()directlyProviderRegistry now calls
ModelRequirements::areMetBy()Clean up data holder classes:
ModelConfig and ModelMetadata are now pure data holders
Removed unused optimization maps from ModelMetadata
Add comprehensive tests:
4 new tests for
areMetBy()method (matching, missing capability, unsupported values, empty requirements)4 new tests for
fromPromptData()method (text generation, chat history, multimodal input, config options)Architecture Impact
Improved separation of concerns: Core API components no longer depend on model discovery
Single Responsibility:
ModelRequirementshandles all requirements analysisFixes #66