Problem/Motivation
Moderation is used for content safety checks. Tests ensure the provider correctly handles moderation requests and properly interprets flagged/unflagged responses.
Proposed resolution
Create kernel tests that mock the MistralClient to test moderation functionality:
Test coverage:
- testGetConfiguredModelsModeration() - Verify mistral-moderation-latest model is returned
- testModerationSafeContent() - Moderation returns not flagged for safe content
- testModerationFlaggedContent() - Moderation returns flagged for harmful content
- testModerationWithDefaultModel() - Verify default model is used when none specified
Issue fork ai_provider_mistral-3567018
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 commentedAdded kernel tests for the Moderation operation:
- testGetConfiguredModelsModeration() - verifies mistral-moderation-latest model is available
- testModerationSafeContent() - verifies safe content returns unflagged
- testModerationFlaggedContent() - verifies harmful content returns flagged with category scores
- testModerationWithDefaultModel() - verifies default model is used when not specified
Comment #4
petar_basic commentedComment #7
fagothx, straight forward and all good - merged!