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

Command icon 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

petar_basic created an issue. See original summary.

petar_basic’s picture

Assigned: petar_basic » Unassigned
Status: Needs work » Needs review

Updated getConfiguredModels() to discover moderation models dynamically using the moderation capability flag from the API instead of hardcoding. Test updated to verify the new behavior.

fago made their first commit to this issue’s fork.

  • fago committed e1fcd316 on 1.1.x authored by petar_basic
    fix: #3571706 Use API capability flag to discover moderation models...
fago’s picture

Status: Needs review » Fixed

thx, makes sense. I verified this works as it should also.

Merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.