types.py
  1  # Copyright (c) 2024-2026 Tencent Zhuque Lab. All rights reserved.
  2  #
  3  # Licensed under the Apache License, Version 2.0 (the "License");
  4  # you may not use this file except in compliance with the License.
  5  # You may obtain a copy of the License at
  6  #
  7  #     http://www.apache.org/licenses/LICENSE-2.0
  8  #
  9  # Unless required by applicable law or agreed to in writing, software
 10  # distributed under the License is distributed on an "AS IS" BASIS,
 11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  # See the License for the specific language governing permissions and
 13  # limitations under the License.
 14  #
 15  # Requirement: Any integration or derivative work must explicitly attribute
 16  # Tencent Zhuque Lab (https://github.com/Tencent/AI-Infra-Guard) in its
 17  # documentation or user interface, as detailed in the NOTICE file.
 18  
 19  from typing import Union
 20  
 21  from deepteam.metrics.excessive_agency.template import ExcessiveAgencyTemplate
 22  from deepteam.metrics.intellectual_property.template import (
 23      IntellectualPropertyTemplate,
 24  )
 25  from deepteam.vulnerabilities.bias.template import BiasTemplate
 26  from deepteam.vulnerabilities.competition.template import CompetitionTemplate
 27  from deepteam.vulnerabilities.graphic_content.template import (
 28      GraphicContentTemplate,
 29  )
 30  from deepteam.vulnerabilities.illegal_activity.template import (
 31      IllegalActivityTemplate,
 32  )
 33  from deepteam.vulnerabilities.intellectual_property import (
 34      IntellectualPropertyType,
 35  )
 36  from deepteam.vulnerabilities.misinformation.template import (
 37      MisinformationTemplate,
 38  )
 39  from deepteam.vulnerabilities.personal_safety.template import (
 40      PersonalSafetyTemplate,
 41  )
 42  from deepteam.vulnerabilities.pii_leakage.template import PIILeakageTemplate
 43  from deepteam.vulnerabilities.prompt_leakage.template import (
 44      PromptLeakageTemplate,
 45  )
 46  from deepteam.vulnerabilities.robustness.template import RobustnessTemplate
 47  from deepteam.vulnerabilities.toxicity.template import ToxicityTemplate
 48  from deepteam.vulnerabilities.unauthorized_access import UnauthorizedAccessType
 49  from deepteam.vulnerabilities.illegal_activity import IllegalActivityType
 50  from deepteam.vulnerabilities.excessive_agency import ExcessiveAgencyType
 51  from deepteam.vulnerabilities.personal_safety import PersonalSafetyType
 52  from deepteam.vulnerabilities.graphic_content import GraphicContentType
 53  from deepteam.vulnerabilities.misinformation import MisinformationType
 54  from deepteam.vulnerabilities.prompt_leakage import PromptLeakageType
 55  from deepteam.vulnerabilities.competition import CompetitionType
 56  from deepteam.vulnerabilities.pii_leakage import PIILeakageType
 57  from deepteam.vulnerabilities.robustness import RobustnessType
 58  from deepteam.vulnerabilities.toxicity import ToxicityType
 59  from deepteam.vulnerabilities.bias import BiasType
 60  from deepteam.vulnerabilities.custom import CustomVulnerabilityType
 61  from deepteam.vulnerabilities.unauthorized_access.template import (
 62      UnauthorizedAccessTemplate,
 63  )
 64  
 65  # 导入我们的自定义漏洞类型
 66  from deepteam.vulnerabilities.custom_prompt import CustomPromptType
 67  from deepteam.vulnerabilities.multi_dataset import MultiDatasetVulnerabilityType
 68  
 69  VulnerabilityType = Union[
 70      UnauthorizedAccessType,
 71      IllegalActivityType,
 72      ExcessiveAgencyType,
 73      PersonalSafetyType,
 74      GraphicContentType,
 75      MisinformationType,
 76      PromptLeakageType,
 77      CompetitionType,
 78      PIILeakageType,
 79      RobustnessType,
 80      ToxicityType,
 81      BiasType,
 82      IntellectualPropertyType,
 83      CustomVulnerabilityType,
 84      # 添加我们的自定义类型
 85      CustomPromptType,
 86      MultiDatasetVulnerabilityType
 87  ]
 88  
 89  TemplateType = Union[
 90      BiasTemplate,
 91      CompetitionTemplate,
 92      ExcessiveAgencyTemplate,
 93      GraphicContentTemplate,
 94      IllegalActivityTemplate,
 95      IntellectualPropertyTemplate,
 96      MisinformationTemplate,
 97      PersonalSafetyTemplate,
 98      PIILeakageTemplate,
 99      PromptLeakageTemplate,
100      RobustnessTemplate,
101      ToxicityTemplate,
102      UnauthorizedAccessTemplate,
103  ]