-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
content moderation and metaguideline
- Loading branch information
1 parent
b661354
commit 844e5e1
Showing
12 changed files
with
228 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 15 additions & 4 deletions
19
src/glue-common/glue/common/content_moderation/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
from glue.common.base_classes import SetupConfig | ||
from glue.common.content_moderation.aacs import AACSContentModeration | ||
from glue.common.content_moderation.base_class import ContentModeration | ||
|
||
class ByPassContentModeration(ContentModeration): | ||
def __init__(self, setup_config: SetupConfig): | ||
self.setup_config = setup_config | ||
self.include_metaprompt_guidelines = setup_config.content_moderation.include_metaprompt_guidelines | ||
|
||
def get_content_moderator_handle(setup_config: SetupConfig): | ||
content_moderator_handle = {} | ||
if setup_config.content_moderation.aacs: | ||
content_moderator_handle["aacs"] = AACSContentModeration(setup_config) | ||
def is_text_safe(self, text) -> bool: | ||
return True | ||
|
||
def get_content_moderator_handle(setup_config: SetupConfig) -> ContentModeration: | ||
content_moderator_handle = None | ||
if setup_config.content_moderation.enable_moderation: | ||
if setup_config.content_moderation.aacs: | ||
content_moderator_handle = AACSContentModeration(setup_config) | ||
if content_moderator_handle is None: | ||
content_moderator_handle = ByPassContentModeration(setup_config) | ||
|
||
return content_moderator_handle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.