Source code for langchain_experimental.comprehend_moderation.base_moderation_exceptions
[docs]class ModerationPiiError(Exception):
"""如果检测到个人身份信息实体,则引发异常。
属性:
message -- 错误的解释"""
def __init__(
self, message: str = "The prompt contains PII entities and cannot be processed"
):
self.message = message
super().__init__(self.message)
[docs]class ModerationToxicityError(Exception):
"""如果检测到有害实体,则引发异常。
属性:
message -- 错误的解释"""
def __init__(
self, message: str = "The prompt contains toxic content and cannot be processed"
):
self.message = message
super().__init__(self.message)
[docs]class ModerationPromptSafetyError(Exception):
"""如果检测到不安全的提示,则引发异常。
属性:
message -- 错误的解释"""
def __init__(
self,
message: str = ("The prompt is unsafe and cannot be processed"),
):
self.message = message
super().__init__(self.message)