Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support multi-modal moderations in openai_dart #576

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

davidmigloz
Copy link
Owner

@davidmigloz davidmigloz commented Oct 21, 2024

The moderations endpoint is a tool you can use to check whether an input is potentially harmful. Now it also supports image inputs:

final res = await client.createModeration(
  request: CreateModerationRequest(
    model: ModerationModel.model(ModerationModels.omniModerationLatest),
    input: ModerationInput.listModerationInputObject(
      [
        ModerationInputObject.imageUrl(
          imageUrl: ModerationInputObjectImageUrlImageUrl(
            url: 'https://upload.wikimedia.org/wikipedia/commons/9/92/95apple.jpeg',
          ),
        ),
        ModerationInputObject.text(
          text: 'I want to kill the apple.',
        ),
      ],
    ),
  ),
);
print(res.results.first.categories.violence);
// true

@davidmigloz davidmigloz self-assigned this Oct 21, 2024
@davidmigloz davidmigloz added t:enhancement New feature or request p:openai_dart openai_dart package. labels Oct 21, 2024
@davidmigloz davidmigloz added this to the v0.8.0 milestone Oct 21, 2024
@davidmigloz davidmigloz merged commit 45b9f42 into main Oct 21, 2024
3 checks passed
@davidmigloz davidmigloz deleted the multi-modal-moderations branch October 21, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p:openai_dart openai_dart package. t:enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant