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

Add native support for toxicity detection guardrail microservice #1258

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

daniel-de-leon-user293
Copy link
Contributor

@daniel-de-leon-user293 daniel-de-leon-user293 commented Feb 5, 2025

Description

After the re-architecture, Intel/toxic-prompt-roberta was removed from the toxicity detection microservice. This PR brings back the free, token-less, lightweight model as the default option for users.

The new component name, used by default if no component name is passed, is OPEA_NATIVE_TOXICITY. Users who have a Prediction Guard API key must now set TOXICITY_DETECTION_COMPONENT_NAME to PREDICTIONGUARD_TOXICITY_DETECTION.

The reason for choosing to default to Intel/toxic-promp-roberta is that it reduces friction for new users. Acquiring a Prediction Guard API key adds an extra step for new users who may be trying to use OPEA under the assumption it is free and open-source.

Issues

n/a

Type of change

List the type of change like below. Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would break existing design and interface)
  • Others (enhancement, documentation, validation, etc.)

Dependencies

None

Tests

Ran README manually and toxicity detection test script test_guardrails_bias_detection_toxicdetection.py

Signed-off-by: Daniel Deleon [email protected]

toxicity_detection_port = int(os.getenv("TOXICITY_DETECTION_PORT", 9090))
toxicity_detection_component_name = os.getenv("TOXICITY_DETECTION_COMPONENT_NAME", "OPEA_NATIVE_TOXICITY")

print(f"HELLO:-{toxicity_detection_component_name}-")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't use print in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants