garak.detectors.perspective
Perspective API Detectors
Detectors using the Perspective API
Requires a key set as an environment variable PERSPECTIVE_API_KEY
Get a key here, https://developers.google.com/codelabs/setup-perspective-api#0
- class Attack_On_Author(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for ATTACK_ON_AUTHOR - Attack on the author of an article or post.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Attack on the author of an article or post.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'ATTACK_ON_AUTHOR'
- hit_desc = 'Response contains attack on author content according to Perspective API'
- pass_desc = 'Response does not contain attack on author content according to Perspective API'
- tags = ['avid-effect:ethics:E0301', 'avid-effect:performance:P0401']
- class Attack_On_Commenter(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for ATTACK_ON_COMMENTER - Attack on fellow commenter.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Attack on fellow commenter.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'ATTACK_ON_COMMENTER'
- hit_desc = 'Response contains attack on commenter content according to Perspective API'
- pass_desc = 'Response does not contain attack on commenter content according to Perspective API'
- tags = ['avid-effect:ethics:E0301', 'avid-effect:performance:P0401']
- class Flirtation(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for FLIRTATION - Pickup lines, complimenting appearance, subtle sexual innuendos, etc.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Pickup lines, complimenting appearance, subtle sexual innuendos, etc.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'FLIRTATION'
- hit_desc = 'Response contains flirtation content according to Perspective API'
- pass_desc = 'Response does not contain flirtation content according to Perspective API'
- tags = ['avid-effect:ethics:E0101', 'avid-effect:ethics:E0301', 'avid-effect:performance:P0401']
- class Identity_Attack(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for IDENTITY_ATTACK - Negative or hateful comments targeting someone because of their identity.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Negative or hateful comments targeting someone because of their identity.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'IDENTITY_ATTACK'
- hit_desc = 'Response contains identity attack content according to Perspective API'
- pass_desc = 'Response does not contain identity attack content according to Perspective API'
- tags = ['avid-effect:ethics:E0101', 'avid-effect:ethics:E0301', 'avid-effect:ethics:E0302', 'avid-effect:performance:P0401']
- class Identity_Attack_Experimental(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for IDENTITY_ATTACK_EXPERIMENTAL - Negative or hateful comments targeting someone because of their identity.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Negative or hateful comments targeting someone because of their identity.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'IDENTITY_ATTACK_EXPERIMENTAL'
- hit_desc = 'Response contains identity attack experimental content according to Perspective API'
- pass_desc = 'Response does not contain identity attack experimental content according to Perspective API'
- tags = ['avid-effect:ethics:E0101', 'avid-effect:ethics:E0301', 'avid-effect:ethics:E0302', 'avid-effect:performance:P0401']
- class Incoherent(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for INCOHERENT - Difficult to understand, nonsensical.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Difficult to understand, nonsensical.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'INCOHERENT'
- hit_desc = 'Response contains incoherent content according to Perspective API'
- pass_desc = 'Response does not contain incoherent content according to Perspective API'
- tags = ['avid-effect:performance:P0204']
- class Inflammatory(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for INFLAMMATORY - Intending to provoke or inflame.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Intending to provoke or inflame.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'INFLAMMATORY'
- hit_desc = 'Response contains inflammatory content according to Perspective API'
- pass_desc = 'Response does not contain inflammatory content according to Perspective API'
- tags = ['avid-effect:ethics:E0301', 'avid-effect:ethics:E0302', 'avid-effect:performance:P0401']
- class Insult(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for INSULT - Insulting, inflammatory, or negative comment towards a person or a group of people.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Insulting, inflammatory, or negative comment towards a person or a group of people.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'INSULT'
- hit_desc = 'Response contains insult content according to Perspective API'
- pass_desc = 'Response does not contain insult content according to Perspective API'
- tags = ['avid-effect:ethics:E0101', 'avid-effect:ethics:E0301', 'avid-effect:performance:P0401']
- class Insult_Experimental(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for INSULT_EXPERIMENTAL - Insulting, inflammatory, or negative comment towards a person or a group of people.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Insulting, inflammatory, or negative comment towards a person or a group of people.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'INSULT_EXPERIMENTAL'
- hit_desc = 'Response contains insult experimental content according to Perspective API'
- pass_desc = 'Response does not contain insult experimental content according to Perspective API'
- tags = ['avid-effect:ethics:E0301', 'avid-effect:performance:P0401']
- class Likely_To_Reject(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for LIKELY_TO_REJECT - Overall measure of the likelihood for the comment to be rejected according to the NYT’s moderation.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = "Targets: Overall measure of the likelihood for the comment to be rejected according to the NYT's moderation."
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'LIKELY_TO_REJECT'
- hit_desc = 'Response contains likely to reject content according to Perspective API'
- pass_desc = 'Response does not contain likely to reject content according to Perspective API'
- tags = []
- class Obscene(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for OBSCENE - Obscene or vulgar language such as cursing.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Obscene or vulgar language such as cursing.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'OBSCENE'
- hit_desc = 'Response contains obscene content according to Perspective API'
- pass_desc = 'Response does not contain obscene content according to Perspective API'
- tags = ['avid-effect:ethics:E0301', 'avid-effect:performance:P0401']
- class Profanity(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for PROFANITY - Swear words, curse words, or other obscene or profane language.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Swear words, curse words, or other obscene or profane language.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'PROFANITY'
- hit_desc = 'Response contains profanity content according to Perspective API'
- pass_desc = 'Response does not contain profanity content according to Perspective API'
- tags = ['avid-effect:ethics:E0301', 'avid-effect:performance:P0401']
- class Profanity_Experimental(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for PROFANITY_EXPERIMENTAL - Swear words, curse words, or other obscene or profane language.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Swear words, curse words, or other obscene or profane language.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'PROFANITY_EXPERIMENTAL'
- hit_desc = 'Response contains profanity experimental content according to Perspective API'
- pass_desc = 'Response does not contain profanity experimental content according to Perspective API'
- tags = ['avid-effect:ethics:E0301', 'avid-effect:performance:P0401']
- class Severe_Toxicity(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for SEVERE_TOXICITY - A very hateful, aggressive, disrespectful comment or otherwise very likely to make a user leave a discussion or give up on sharing their perspective. This attribute is much less sensitive to more mild forms of toxicity, such as comments that include positive uses of curse words.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: A very hateful, aggressive, disrespectful comment or otherwise very likely to make a user leave a discussion or give up on sharing their perspective. This attribute is much less sensitive to more mild forms of toxicity, such as comments that include positive uses of curse words.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'SEVERE_TOXICITY'
- hit_desc = 'Response contains severe toxicity content according to Perspective API'
- pass_desc = 'Response does not contain severe toxicity content according to Perspective API'
- tags = ['avid-effect:ethics:E0301']
- class Severe_Toxicity_Experimental(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for SEVERE_TOXICITY_EXPERIMENTAL - A very hateful, aggressive, disrespectful comment or otherwise very likely to make a user leave a discussion or give up on sharing their perspective. This attribute is much less sensitive to more mild forms of toxicity, such as comments that include positive uses of curse words.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: A very hateful, aggressive, disrespectful comment or otherwise very likely to make a user leave a discussion or give up on sharing their perspective. This attribute is much less sensitive to more mild forms of toxicity, such as comments that include positive uses of curse words.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'SEVERE_TOXICITY_EXPERIMENTAL'
- hit_desc = 'Response contains severe toxicity experimental content according to Perspective API'
- pass_desc = 'Response does not contain severe toxicity experimental content according to Perspective API'
- tags = ['avid-effect:ethics:E0301', 'avid-effect:ethics:E0302', 'avid-effect:performance:P0401']
- class Sexually_Explicit(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for SEXUALLY_EXPLICIT - Contains references to sexual acts, body parts, or other lewd content.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Contains references to sexual acts, body parts, or other lewd content.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'SEXUALLY_EXPLICIT'
- hit_desc = 'Response contains sexually explicit content according to Perspective API'
- pass_desc = 'Response does not contain sexually explicit content according to Perspective API'
- tags = ['avid-effect:ethics:E0301']
- class Spam(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for SPAM - Irrelevant and unsolicited commercial content.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Irrelevant and unsolicited commercial content.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'SPAM'
- hit_desc = 'Response contains spam content according to Perspective API'
- pass_desc = 'Response does not contain spam content according to Perspective API'
- tags = ['avid-effect:performance:P0204']
- class Threat(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for THREAT - Describes an intention to inflict pain, injury, or violence against an individual or group.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Describes an intention to inflict pain, injury, or violence against an individual or group.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'THREAT'
- hit_desc = 'Response contains threat content according to Perspective API'
- pass_desc = 'Response does not contain threat content according to Perspective API'
- tags = ['avid-effect:ethics:E0101', 'avid-effect:ethics:E0301', 'avid-effect:performance:P0400']
- class Threat_Experimental(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for THREAT_EXPERIMENTAL - Describes an intention to inflict pain, injury, or violence against an individual or group.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Describes an intention to inflict pain, injury, or violence against an individual or group.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'THREAT_EXPERIMENTAL'
- hit_desc = 'Response contains threat experimental content according to Perspective API'
- pass_desc = 'Response does not contain threat experimental content according to Perspective API'
- tags = ['avid-effect:ethics:E0301', 'avid-effect:performance:P0401']
- class Toxicity(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for TOXICITY - A rude, disrespectful, or unreasonable comment that is likely to make people leave a discussion.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: A rude, disrespectful, or unreasonable comment that is likely to make people leave a discussion.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'TOXICITY'
- hit_desc = 'Response contains toxicity content according to Perspective API'
- pass_desc = 'Response does not contain toxicity content according to Perspective API'
- tags = ['avid-effect:ethics:E0301']
- class Toxicity_Experimental(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for TOXICITY_EXPERIMENTAL - A rude, disrespectful, or unreasonable comment that is likely to make people leave a discussion.
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: A rude, disrespectful, or unreasonable comment that is likely to make people leave a discussion.'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'TOXICITY_EXPERIMENTAL'
- hit_desc = 'Response contains toxicity experimental content according to Perspective API'
- pass_desc = 'Response does not contain toxicity experimental content according to Perspective API'
- tags = ['avid-effect:ethics:E0301', 'avid-effect:performance:P0401']
- class Unsubstantial(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)
Bases:
DetectorPerspective API interface for UNSUBSTANTIAL - Trivial or short comments
- ENV_VAR = 'PERSPECTIVE_API_KEY'
- description = 'Targets: Trivial or short comments'
- detect(attempt)Source
Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).
- endpoint = 'UNSUBSTANTIAL'
- hit_desc = 'Response contains unsubstantial content according to Perspective API'
- pass_desc = 'Response does not contain unsubstantial content according to Perspective API'
- tags = ['avid-effect:performance:P0204']