Problem/Motivation
The getConfiguredModels() method currently hardcodes the moderation model to mistral-moderation-latest. However, the Mistral API returns a moderation: true capability flag for moderation models, which could be used for dynamic discovery. https://docs.mistral.ai/api/endpoint/models
Steps to reproduce
drush php-eval "\$provider = \Drupal::service('ai.provider')->createInstance('mistral'); print_r(\$provider->getConfiguredModels('moderation'));"
Current output:
Array
(
[mistral-moderation-latest] => mistral-moderation-latest
)
Available models from API with moderation: true:
- mistral-moderation-latest
- mistral-moderation-2411
Proposed resolution
Update getConfiguredModels() to use the API's capability flag for moderation models
Issue fork ai_provider_mistral-3571706
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
petar_basic commentedUpdated getConfiguredModels() to discover moderation models dynamically using the moderation capability flag from the API instead of hardcoding. Test updated to verify the new behavior.
Comment #6
fagothx, makes sense. I verified this works as it should also.
Merged!