Skip to content

Conversation

@dev-jonghoonpark
Copy link
Contributor

related issue: #2919

In spring-projects/spring-ai#2201
properties related to the response values of Mistral AI's Moderation API were added to the CategoryScores class. However, getters for user access were not provided.

So, I have added them.


Additional discussion required:

  • spring-ai-model/src/main/java/org/springframework/ai/moderation/Categories.java
  • spring-ai-model/src/main/java/org/springframework/ai/moderation/CategoryScores.java

These two classes seem to need to encapsulate common parts, but currently, they contain detailed information for both OpenAI and Mistral.

It seems that an appropriate separation process is necessary.

Signed-off-by: jonghoon park <dev@jonghoonpark.com>
@ilayaperumalg ilayaperumalg self-assigned this Apr 29, 2025
@ilayaperumalg ilayaperumalg added this to the 1.0.0-M8 milestone Apr 29, 2025
@ilayaperumalg
Copy link
Member

@dev-jonghoonpark Thanks for adding the missing getters.

@ilayaperumalg ilayaperumalg merged commit f5ac94c into spring-projects:main Apr 29, 2025
2 checks passed
Comment on lines +67 to +75
assertThat(scores.getSexual()).isNotNull();
assertThat(scores.getHate()).isNotNull();
assertThat(scores.getViolence()).isNotNull();
assertThat(scores.getDangerousAndCriminalContent()).isNotNull();
assertThat(scores.getSelfHarm()).isNotNull();
assertThat(scores.getHealth()).isNotNull();
assertThat(scores.getFinancial()).isNotNull();
assertThat(scores.getLaw()).isNotNull();
assertThat(scores.getPii()).isNotNull();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is essentially a test that will always pass because the return type of the getters is a primitive type. However, I believe it's worth keeping to ensure the presence of the getters.

The same approach is applied in the OpenAiModerationModelIT.

namsoo2 pushed a commit to namsoo2/spring-ai that referenced this pull request Jun 9, 2025
Signed-off-by: jonghoon park <dev@jonghoonpark.com>
Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
chedim pushed a commit to couchbaselabs/spring-ai that referenced this pull request Sep 19, 2025
Signed-off-by: jonghoon park <dev@jonghoonpark.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants