-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(model-manager): centralize model management and provider-scoped selection #312
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
Conversation
…hitects-toolkit/SmartHopper into refactor/0.6.0-model-manager
|
🏷️ This PR has been automatically assigned to milestone 0.6.0-alpha based on the version in |
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.
Pull Request Overview
This PR implements a comprehensive refactor of model management and selection across SmartHopper, centralizing authority in ModelManager while introducing provider-scoped selection. The changes establish a unified architecture where ModelManager serves as the single source of truth for model capabilities and selection logic, while providers expose models through a standardized RetrieveModels() interface and handle scoped selection via SelectModel().
Key changes:
- Centralized model management with ModelManager.SelectBestModel() as the single authority for selection decisions
- Provider-scoped selection through new IAIProvider.SelectModel() method that encapsulates model resolution while honoring provider settings
- Simplified selection policy using capability-first ordering with concrete models only (no wildcard resolution)
Reviewed Changes
Copilot reviewed 38 out of 39 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/SmartHopper.Providers.OpenAI/OpenAIProviderModels.cs | Replaced API-based model retrieval with hardcoded model definitions using new RetrieveModels() interface |
| src/SmartHopper.Providers.MistralAI/MistralAIProviderModels.cs | Converted from dynamic API calls to static model metadata using RetrieveModels() pattern |
| src/SmartHopper.Providers.DeepSeek/DeepSeekProviderModels.cs | Simplified to return concrete model capabilities via RetrieveModels() method |
| src/SmartHopper.Infrastructure/AIProviders/IAIProvider.cs | Added SelectModel() method for provider-scoped model selection |
| src/SmartHopper.Infrastructure/AIProviders/AIProviderModels.cs | Streamlined to single RetrieveModels() method, removing legacy retrieval patterns |
| src/SmartHopper.Infrastructure/AIProviders/AIProvider.cs | Implemented SelectModel() delegation to ModelManager and updated initialization flow |
| src/SmartHopper.Infrastructure/AIModels/ModelManager.cs | Added centralized SelectBestModel() logic and SetDefault() capability management |
| src/SmartHopper.Infrastructure/AIModels/IAIProviderModels.cs | Simplified interface to focus on RetrieveModels() for metadata retrieval |
| src/SmartHopper.Infrastructure/AIModels/AIModelCapabilityRegistry.cs | Removed wildcard matching, enforced exact name/alias matching with thread-safety |
| src/SmartHopper.Infrastructure/AIModels/AIModelCapabilities.cs | Extended with verification, ranking, streaming, and alias metadata fields |
| src/SmartHopper.Infrastructure/AIModels/AICapability.cs | Added Image2Image capability and cleaned up imports |
| src/SmartHopper.Infrastructure/AICall/AIRequestBase.cs | Refactored GetModelToUse() to delegate selection to provider.SelectModel() |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…n file is missing
…untime message schema
… and propagate them to ai-body and to ai-return
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Description
Implements the unified model management & selection architecture (formerly Suggestion 2) with a full refactor of model registration, capability storage, and selection flow.
Key changes:
docs/Providers/AIProvider*.md— guidance for provider-scoped selection.ModelManagerTestsandAdvancedConfigTestsupdated.Image2Imagecapability.Touched areas (non-exhaustive):
src/SmartHopper.Infrastructure/AIModels/{AIModelCapabilities.cs, AIModelCapabilityRegistry.cs, IAIProviderModels.cs}Breaking Changes
Aliasesfor alternative names.Testing Done
src/SmartHopper.Infrastructure.Tests/ModelManagerTests.cssrc/SmartHopper.Infrastructure.Tests/AdvancedConfigTests.csChecklist
docs/to reflect the new behaviorMotivation
Completes the unified model management & selection design by: