spring-projects / spring-projects/spring-ai

Support image moderation in OpenAI

Open
#2,832 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

moderation openai
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

OpenAI's moderation API currently offers two models:

  • text-moderation-latest (Legacy) - Supports only text moderation
  • omni-moderation-latest - Supports both text and image moderation

(See https://platform.openai.com/docs/guides/moderation)

While both of these work with Spring AI, Spring AI currently defaults to use text-moderation-latest.

I suggest two things:

  • Default to omni-moderation-latest
  • Apply changes to support moderation of images as well as text, if supported by the chosen model.

AFAICT, Mistral (the only other provider that Spring AI has a moderation model implementation for) only has one model: mistral-moderation-latest. (But they do have two separate endpoints, one for raw-text moderation and another for conversational moderation.)

When this issue has been resolved, I'd expect that text moderation would continue to work as-is. Image moderation would also work by default if using OpenAI (and fail appropriate if using the "text-moderation-latest" model or Mistral.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating Spring AI's existing OpenAI and Mistral moderation model implementations and their moderation API tests. Verify how the default model is selected and how text inputs are represented, then define coverage for image moderation with OpenAI while preserving text behavior and appropriate failures for unsupported models.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
ai, api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.