enkryptai-sdk 1.0.13__py3-none-any.whl → 1.0.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -243,6 +243,19 @@ class SystemPromptDetector(BaseDTO):
243
243
  }
244
244
 
245
245
 
246
+ class GuardrailDetectorsEnum(str, Enum):
247
+ TOPIC_DETECTOR = "topic_detector"
248
+ NSFW = "nsfw"
249
+ TOXICITY = "toxicity"
250
+ PII = "pii"
251
+ INJECTION_ATTACK = "injection_attack"
252
+ KEYWORD_DETECTOR = "keyword_detector"
253
+ POLICY_VIOLATION = "policy_violation"
254
+ BIAS = "bias"
255
+ COPYRIGHT_IP = "copyright_ip"
256
+ SYSTEM_PROMPT = "system_prompt"
257
+
258
+
246
259
  @dataclass
247
260
  class GuardrailDetectors(BaseDTO):
248
261
  topic_detector: TopicDetector = field(default_factory=TopicDetector)
@@ -39,6 +39,7 @@ class ModelProviders(str, Enum):
39
39
  ANTHROPIC_COMPATIBLE = "anthropic_compatible"
40
40
  CUSTOM = "custom"
41
41
  HR = "hr"
42
+ URL = "url"
42
43
 
43
44
 
44
45
  @dataclass
@@ -5,6 +5,19 @@ from typing import Dict, List, Optional, Any
5
5
  from dataclasses import dataclass, field, asdict
6
6
  from .datasets import DatasetConfig
7
7
  from .models import ModelConfig
8
+ from .guardrails import GuardrailDetectors
9
+
10
+ # The risk mitigation do not support all detectors, so we need to create a separate enum for them.
11
+ class RiskGuardrailDetectorsEnum(str, Enum):
12
+ NSFW = "nsfw"
13
+ TOXICITY = "toxicity"
14
+ INJECTION_ATTACK = "injection_attack"
15
+ POLICY_VIOLATION = "policy_violation"
16
+ BIAS = "bias"
17
+ # Topic, Keyword, PII are not supported by Risk Mitigation
18
+ # Below are not yet supported by Guardrails. So, also not supported by Risk Mitigation.
19
+ # COPYRIGHT_IP = "copyright_ip"
20
+ # SYSTEM_PROMPT = "system_prompt"
8
21
 
9
22
 
10
23
  @dataclass
@@ -114,6 +127,7 @@ class ResultSummary(BaseDTO):
114
127
  scenario: Dict[str, StatisticItem]
115
128
  category: Dict[str, StatisticItemWithTestType]
116
129
  attack_method: Dict[str, StatisticItem]
130
+ custom_test_category_risks: Dict[str, StatisticItem] = field(default_factory=dict)
117
131
  _extra_fields: Dict[str, Any] = field(default_factory=dict)
118
132
 
119
133
  @classmethod
@@ -146,6 +160,9 @@ class ResultSummary(BaseDTO):
146
160
  scenario=convert_stat_list(data.get("scenario", [])),
147
161
  category=convert_stat_test_type_list(data.get("category", [])),
148
162
  attack_method=convert_stat_list(data.get("attack_method", [])),
163
+ custom_test_category_risks=convert_stat_list(
164
+ data.get("custom_test_category_risks", [])
165
+ ),
149
166
  )
150
167
 
151
168
  def to_dict(self) -> Dict:
@@ -162,6 +179,9 @@ class ResultSummary(BaseDTO):
162
179
  d["scenario"] = convert_stat_dict(self.scenario)
163
180
  d["category"] = convert_stat_test_type_dict(self.category)
164
181
  d["attack_method"] = convert_stat_dict(self.attack_method)
182
+ d["custom_test_category_risks"] = convert_stat_dict(
183
+ self.custom_test_category_risks
184
+ )
165
185
  return d
166
186
 
167
187
 
@@ -578,6 +598,118 @@ class RedTeamTaskList(BaseDTO):
578
598
  def to_dataframe(self) -> pd.DataFrame:
579
599
  data = [task for task in self.tasks]
580
600
  return pd.DataFrame(data)
601
+
602
+
603
+ @dataclass
604
+ class RedTeamRiskMitigationGuardrailsPolicyConfig(BaseDTO):
605
+ required_detectors: List[RiskGuardrailDetectorsEnum] = field(default_factory=list)
606
+ redteam_summary: ResultSummary = field(default_factory=ResultSummary)
607
+ _extra_fields: Dict[str, Any] = field(default_factory=dict)
608
+
609
+ @classmethod
610
+ def from_dict(cls, data: dict):
611
+ data = data.copy()
612
+ summary = ResultSummary.from_dict(data.pop("redteam_summary", {}))
613
+ return cls(
614
+ required_detectors=[RiskGuardrailDetectorsEnum(detector) for detector in data.get("required_detectors", [])],
615
+ redteam_summary=summary,
616
+ _extra_fields=data,
617
+ )
618
+
619
+ def to_dict(self) -> dict:
620
+ return {
621
+ "required_detectors": [detector.value for detector in self.required_detectors],
622
+ "redteam_summary": self.redteam_summary.to_dict(),
623
+ }
624
+
625
+
626
+ @dataclass
627
+ class RedTeamRiskMitigationGuardrailsPolicyResponse(BaseDTO):
628
+ analysis: str = ""
629
+ guardrails_policy: GuardrailDetectors = field(default_factory=GuardrailDetectors)
630
+ message: str = ""
631
+ _extra_fields: Dict[str, Any] = field(default_factory=dict)
632
+
633
+ @classmethod
634
+ def from_dict(cls, data: dict):
635
+ policy_data = data.get("guardrails_policy", {})
636
+
637
+ return cls(
638
+ analysis=data.get("analysis", ""),
639
+ guardrails_policy=GuardrailDetectors.from_dict(policy_data),
640
+ message=data.get("message", ""),
641
+ )
642
+
643
+ def to_dict(self) -> dict:
644
+ policy_dict = self.guardrails_policy.to_dict()
645
+
646
+ # Remove detector entries that are disabled and have no other config
647
+ final_policy_dict = {}
648
+ for key, value in policy_dict.items():
649
+ if isinstance(value, dict):
650
+ # Check if 'enabled' is the only key and its value is False
651
+ if list(value.keys()) == ['enabled'] and not value['enabled']:
652
+ continue
653
+ # Check for empty detectors that only have 'enabled': False
654
+ if not value.get("enabled", True) and len(value) == 1:
655
+ continue
656
+ # check for other empty values
657
+ if not any(v for k, v in value.items() if k != 'enabled'):
658
+ if not value.get('enabled'):
659
+ continue
660
+ final_policy_dict[key] = value
661
+
662
+ return {
663
+ "analysis": self.analysis,
664
+ "guardrails_policy": final_policy_dict,
665
+ "message": self.message,
666
+ }
667
+
668
+
669
+ @dataclass
670
+ class RedTeamRiskMitigationSystemPromptConfig(BaseDTO):
671
+ system_prompt: str = "You are a helpful AI Assistant"
672
+ redteam_summary: ResultSummary = field(default_factory=ResultSummary)
673
+ _extra_fields: Dict[str, Any] = field(default_factory=dict)
674
+
675
+ @classmethod
676
+ def from_dict(cls, data: dict):
677
+ data = data.copy()
678
+ summary = ResultSummary.from_dict(data.pop("redteam_summary", {}))
679
+ return cls(
680
+ system_prompt=data.get("system_prompt", ""),
681
+ redteam_summary=summary,
682
+ _extra_fields=data,
683
+ )
684
+
685
+ def to_dict(self) -> dict:
686
+ return {
687
+ "system_prompt": self.system_prompt,
688
+ "redteam_summary": self.redteam_summary.to_dict(),
689
+ }
690
+
691
+
692
+ @dataclass
693
+ class RedTeamRiskMitigationSystemPromptResponse(BaseDTO):
694
+ analysis: str = ""
695
+ system_prompt: str = ""
696
+ message: str = ""
697
+ _extra_fields: Dict[str, Any] = field(default_factory=dict)
698
+
699
+ @classmethod
700
+ def from_dict(cls, data: dict):
701
+ return cls(
702
+ analysis=data.get("analysis", ""),
703
+ system_prompt=data.get("system_prompt", ""),
704
+ message=data.get("message", ""),
705
+ )
706
+
707
+ def to_dict(self) -> dict:
708
+ return {
709
+ "analysis": self.analysis,
710
+ "system_prompt": self.system_prompt,
711
+ "message": self.message,
712
+ }
581
713
 
582
714
 
583
715
  # Default configurations
enkryptai_sdk/red_team.py CHANGED
@@ -17,6 +17,10 @@ from .dto import (
17
17
  RedTeamTaskStatus,
18
18
  RedTeamTaskDetails,
19
19
  RedTeamTaskList,
20
+ RedTeamRiskMitigationGuardrailsPolicyConfig,
21
+ RedTeamRiskMitigationGuardrailsPolicyResponse,
22
+ RedTeamRiskMitigationSystemPromptConfig,
23
+ RedTeamRiskMitigationSystemPromptResponse,
20
24
  )
21
25
 
22
26
 
@@ -508,3 +512,27 @@ class RedTeamClient(BaseClient):
508
512
  if isinstance(response, dict) and response.get("error"):
509
513
  raise RedTeamClientError(f"API Error: {str(response)}")
510
514
  return RedTeamTaskList.from_dict(response)
515
+
516
+ def risk_mitigation_guardrails_policy(self, config: RedTeamRiskMitigationGuardrailsPolicyConfig):
517
+ """
518
+ Get the guardrails policy generated for risk mitigation.
519
+ """
520
+ config = RedTeamRiskMitigationGuardrailsPolicyConfig.from_dict(config)
521
+ payload = config.to_dict()
522
+
523
+ response = self._request("POST", "/redteam/risk-mitigation/guardrails-policy", json=payload)
524
+ if isinstance(response, dict) and response.get("error"):
525
+ raise RedTeamClientError(f"API Error: {str(response)}")
526
+ return RedTeamRiskMitigationGuardrailsPolicyResponse.from_dict(response)
527
+
528
+ def risk_mitigation_system_prompt(self, config: RedTeamRiskMitigationSystemPromptConfig):
529
+ """
530
+ Get the system prompt generated for risk mitigation.
531
+ """
532
+ config = RedTeamRiskMitigationSystemPromptConfig.from_dict(config)
533
+ payload = config.to_dict()
534
+
535
+ response = self._request("POST", "/redteam/risk-mitigation/system-prompt", json=payload)
536
+ if isinstance(response, dict) and response.get("error"):
537
+ raise RedTeamClientError(f"API Error: {str(response)}")
538
+ return RedTeamRiskMitigationSystemPromptResponse.from_dict(response)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: enkryptai-sdk
3
- Version: 1.0.13
3
+ Version: 1.0.15
4
4
  Summary: A Python SDK with guardrails and red teaming functionality for API interactions
5
5
  Home-page: https://github.com/enkryptai/enkryptai-sdk
6
6
  Author: Enkrypt AI Team
@@ -49,6 +49,8 @@ Also see the API documentation at [https://docs.enkryptai.com](https://docs.enkr
49
49
  - [Sample Redteam Model Config](#sample-redteam-model-config)
50
50
  - [Sample Custom Redteam Target Config](#sample-custom-redteam-target-config)
51
51
  - [Sample Custom Redteam Model Config](#sample-custom-redteam-model-config)
52
+ - [Sample Redteam Risk Mitigation Guardrails Policy Config](#sample-redteam-risk-mitigation-guardrails-policy-config)
53
+ - [Sample Redteam Risk Mitigation System Prompt Config](#sample-redteam-risk-mitigation-system-prompt-config)
52
54
  - [Health Checks](#health-checks)
53
55
  - [Guardrails Health](#guardrails-health)
54
56
  - [Guardrails Status](#guardrails-status)
@@ -124,6 +126,8 @@ Also see the API documentation at [https://docs.enkryptai.com](https://docs.enkr
124
126
  - [Get Redteam Task Results Summary of Test Type](#get-redteam-task-results-summary-of-test-type)
125
127
  - [Get Redteam Task Results Details](#get-redteam-task-results-details)
126
128
  - [Get Redteam Task Results Details of Test Type](#get-redteam-task-results-details-of-test-type)
129
+ - [Mitigate Risks with Guardrails Policy](#mitigate-risks-with-guardrails-policy)
130
+ - [Mitigate Risks with System Prompt](#mitigate-risks-with-system-prompt)
127
131
  - [Copyright, License, and Terms of Use](#copyright-license-and-terms-of-use)
128
132
 
129
133
  ## Installation
@@ -271,14 +275,7 @@ sample_detectors = {
271
275
  },
272
276
  "bias": {
273
277
  "enabled": False
274
- },
275
- "copyright_ip": {
276
- "enabled": False
277
- },
278
- "system_prompt": {
279
- "enabled": False,
280
- "index": "system"
281
- },
278
+ }
282
279
  }
283
280
  ```
284
281
 
@@ -525,6 +522,292 @@ sample_custom_redteam_model_config = {
525
522
  }
526
523
  ```
527
524
 
525
+ ### [Sample Redteam Risk Mitigation Guardrails Policy Config](https://docs.enkryptai.com/redteam-api-reference/endpoint/risk-mitigation-guardrails-policy)
526
+
527
+ ```python Python
528
+ sample_redteam_risk_mitigation_guardrails_policy_config = {
529
+ "required_detectors": [
530
+ "policy_violation"
531
+ ],
532
+ "redteam_summary": {
533
+ "category": [
534
+ {
535
+ "Biology": {
536
+ "total": 50,
537
+ "test_type": "cbrn_test",
538
+ "success(%)": 92
539
+ }
540
+ },
541
+ {
542
+ "Chemistry": {
543
+ "total": 50,
544
+ "test_type": "cbrn_test",
545
+ "success(%)": 98
546
+ }
547
+ },
548
+ {
549
+ "Fraud": {
550
+ "total": 100,
551
+ "test_type": "harmful_test",
552
+ "success(%)": 73
553
+ }
554
+ },
555
+ {
556
+ "Guns & Illegal Substances": {
557
+ "total": 100,
558
+ "test_type": "harmful_test",
559
+ "success(%)": 87
560
+ }
561
+ },
562
+ {
563
+ "Hate Speech and Discrimination": {
564
+ "total": 100,
565
+ "test_type": "harmful_test",
566
+ "success(%)": 53
567
+ }
568
+ },
569
+ {
570
+ "Nuclear Science": {
571
+ "total": 50,
572
+ "test_type": "cbrn_test",
573
+ "success(%)": 94
574
+ }
575
+ },
576
+ {
577
+ "Radiology": {
578
+ "total": 50,
579
+ "test_type": "cbrn_test",
580
+ "success(%)": 84
581
+ }
582
+ },
583
+ {
584
+ "Regulated or Controlled Substances": {
585
+ "total": 100,
586
+ "test_type": "harmful_test",
587
+ "success(%)": 74
588
+ }
589
+ },
590
+ {
591
+ "Sexual Content": {
592
+ "total": 100,
593
+ "test_type": "harmful_test",
594
+ "success(%)": 79
595
+ }
596
+ },
597
+ {
598
+ "Suicide & Self-Harm": {
599
+ "total": 100,
600
+ "test_type": "harmful_test",
601
+ "success(%)": 72
602
+ }
603
+ },
604
+ {
605
+ "Unethical Crimes": {
606
+ "total": 100,
607
+ "test_type": "harmful_test",
608
+ "success(%)": 83
609
+ }
610
+ },
611
+ {
612
+ "Violent Crimes": {
613
+ "total": 100,
614
+ "test_type": "harmful_test",
615
+ "success(%)": 70
616
+ }
617
+ }
618
+ ],
619
+ "scenario": [],
620
+ "test_date": "2020-01-01T17:14:33.607823+00:00",
621
+ "test_name": "Mistral Small Latest x Red Team",
622
+ "test_type": [
623
+ {
624
+ "cbrn_test": {
625
+ "total": 200,
626
+ "success(%)": 92
627
+ }
628
+ },
629
+ {
630
+ "harmful_test": {
631
+ "total": 800,
632
+ "success(%)": 73.88
633
+ }
634
+ }
635
+ ],
636
+ "model_name": "mistral-small-latest",
637
+ "risk_score": 82.9375,
638
+ "dataset_name": "Standard",
639
+ "model_source": "",
640
+ "attack_method": [
641
+ {
642
+ "Basic": {
643
+ "total": 1000,
644
+ "success(%)": 77.5
645
+ }
646
+ }
647
+ ],
648
+ "nist_category": [
649
+ {
650
+ "CBRN Information or Capabilities": {
651
+ "total": 200,
652
+ "success(%)": 92
653
+ }
654
+ },
655
+ {
656
+ "Dangerous, Violent, or Hateful Content": {
657
+ "total": 800,
658
+ "success(%)": 73.88
659
+ }
660
+ }
661
+ ],
662
+ "model_provider": "mistral",
663
+ "model_endpoint_url": "https://api.mistral.ai/v1/chat/completions",
664
+ "custom_test_category_risks": []
665
+ }
666
+ }
667
+ ```
668
+
669
+ ### [Sample Redteam Risk Mitigation System Prompt Config](https://docs.enkryptai.com/redteam-api-reference/endpoint/risk-mitigation-system-prompt)
670
+
671
+ ```python Python
672
+ sample_redteam_risk_mitigation_system_prompt_config = {
673
+ "system_prompt": "You are a helpful AI Assistant",
674
+ "redteam_summary": {
675
+ "category": [
676
+ {
677
+ "Biology": {
678
+ "total": 50,
679
+ "test_type": "cbrn_test",
680
+ "success(%)": 92
681
+ }
682
+ },
683
+ {
684
+ "Chemistry": {
685
+ "total": 50,
686
+ "test_type": "cbrn_test",
687
+ "success(%)": 98
688
+ }
689
+ },
690
+ {
691
+ "Fraud": {
692
+ "total": 100,
693
+ "test_type": "harmful_test",
694
+ "success(%)": 73
695
+ }
696
+ },
697
+ {
698
+ "Guns & Illegal Substances": {
699
+ "total": 100,
700
+ "test_type": "harmful_test",
701
+ "success(%)": 87
702
+ }
703
+ },
704
+ {
705
+ "Hate Speech and Discrimination": {
706
+ "total": 100,
707
+ "test_type": "harmful_test",
708
+ "success(%)": 53
709
+ }
710
+ },
711
+ {
712
+ "Nuclear Science": {
713
+ "total": 50,
714
+ "test_type": "cbrn_test",
715
+ "success(%)": 94
716
+ }
717
+ },
718
+ {
719
+ "Radiology": {
720
+ "total": 50,
721
+ "test_type": "cbrn_test",
722
+ "success(%)": 84
723
+ }
724
+ },
725
+ {
726
+ "Regulated or Controlled Substances": {
727
+ "total": 100,
728
+ "test_type": "harmful_test",
729
+ "success(%)": 74
730
+ }
731
+ },
732
+ {
733
+ "Sexual Content": {
734
+ "total": 100,
735
+ "test_type": "harmful_test",
736
+ "success(%)": 79
737
+ }
738
+ },
739
+ {
740
+ "Suicide & Self-Harm": {
741
+ "total": 100,
742
+ "test_type": "harmful_test",
743
+ "success(%)": 72
744
+ }
745
+ },
746
+ {
747
+ "Unethical Crimes": {
748
+ "total": 100,
749
+ "test_type": "harmful_test",
750
+ "success(%)": 83
751
+ }
752
+ },
753
+ {
754
+ "Violent Crimes": {
755
+ "total": 100,
756
+ "test_type": "harmful_test",
757
+ "success(%)": 70
758
+ }
759
+ }
760
+ ],
761
+ "scenario": [],
762
+ "test_date": "2020-01-01T17:14:33.607823+00:00",
763
+ "test_name": "Mistral Small Latest x Red Team",
764
+ "test_type": [
765
+ {
766
+ "cbrn_test": {
767
+ "total": 200,
768
+ "success(%)": 92
769
+ }
770
+ },
771
+ {
772
+ "harmful_test": {
773
+ "total": 800,
774
+ "success(%)": 73.88
775
+ }
776
+ }
777
+ ],
778
+ "model_name": "mistral-small-latest",
779
+ "risk_score": 82.9375,
780
+ "dataset_name": "Standard",
781
+ "model_source": "",
782
+ "attack_method": [
783
+ {
784
+ "Basic": {
785
+ "total": 1000,
786
+ "success(%)": 77.5
787
+ }
788
+ }
789
+ ],
790
+ "nist_category": [
791
+ {
792
+ "CBRN Information or Capabilities": {
793
+ "total": 200,
794
+ "success(%)": 92
795
+ }
796
+ },
797
+ {
798
+ "Dangerous, Violent, or Hateful Content": {
799
+ "total": 800,
800
+ "success(%)": 73.88
801
+ }
802
+ }
803
+ ],
804
+ "model_provider": "mistral",
805
+ "model_endpoint_url": "https://api.mistral.ai/v1/chat/completions",
806
+ "custom_test_category_risks": []
807
+ }
808
+ }
809
+ ```
810
+
528
811
  ## Health Checks
529
812
 
530
813
  ### [Guardrails Health](https://docs.enkryptai.com/guardrails-api-reference/endpoint/health-check)
@@ -701,8 +984,8 @@ print(batch_detect_response.to_dict())
701
984
  - `nsfw`: Filter inappropriate content
702
985
  - `toxicity`: Detect toxic language
703
986
  - `pii`: Detect personal information
704
- - `copyright_ip`: Check for copyright/IP violations
705
- - `system_prompt`: Detect system prompt leaks
987
+ - `copyright_ip`: Check for copyright/IP violations ***(Coming soon)***
988
+ - `system_prompt`: Detect system prompt leaks ***(Coming soon)***
706
989
  - `keyword_detector`: Check for specific keywords
707
990
 
708
991
  Each detector can be enabled/disabled and configured with specific options as documented in the [API docs](https://docs.enkryptai.com/guardrails-api-reference/introduction).
@@ -764,12 +1047,16 @@ guardrails_config = GuardrailsConfig.keyword(keywords=["secret", "password"])
764
1047
 
765
1048
  ### [Copyright IP](https://docs.enkryptai.com/guardrails-api-reference/Copyright_IP_Leak_Detector)
766
1049
 
1050
+ - ***(Coming soon)***
1051
+
767
1052
  ```python Python
768
1053
  guardrails_config = GuardrailsConfig.copyright_ip()
769
1054
  ```
770
1055
 
771
1056
  ### [System Prompt](https://docs.enkryptai.com/guardrails-api-reference/System_Prompt_Leak_Detector)
772
1057
 
1058
+ - ***(Coming soon)***
1059
+
773
1060
  ```python Python
774
1061
  guardrails_config = GuardrailsConfig.system_prompt(index="system")
775
1062
  ```
@@ -972,6 +1259,8 @@ print(relevancy_response.to_dict())
972
1259
 
973
1260
  ### [Check Hallucination](https://docs.enkryptai.com/guardrails-api-reference/Hallucination)
974
1261
 
1262
+ - ***(Coming soon)***
1263
+
975
1264
  Detect hallucinations in an LLM's response:
976
1265
 
977
1266
  ```python Python
@@ -1057,7 +1346,7 @@ print(atomize_response.to_dict())
1057
1346
  # Add a code of conduct policy
1058
1347
  add_policy_response = coc_client.add_policy(
1059
1348
  policy_name=test_coc_policy_name,
1060
- policy_rules=example_coc_policy_rules, # Can also be a list of rules
1349
+ policy_rules=example_coc_policy_rules, # Can also be a list of rules
1061
1350
  total_rules=4,
1062
1351
  policy_file="/path/to/your/policy.pdf"
1063
1352
  # policy_text=example_coc_policy_text, # Optional: Use this if you want to add a policy text instead of a file
@@ -1661,6 +1950,32 @@ print(redteam_results_details_test_type.task_status)
1661
1950
  print(redteam_results_details_test_type.to_dict())
1662
1951
  ```
1663
1952
 
1953
+ ### [Mitigate Risks with Guardrails Policy](https://docs.enkryptai.com/redteam-api-reference/endpoint/risk-mitigation-guardrails-policy)
1954
+
1955
+ ```python Python
1956
+ # Mitigate risks with guardrails policy
1957
+ risk_mitigation_guardrails_policy_response = redteam_client.risk_mitigation_guardrails_policy(config=copy.deepcopy(sample_redteam_risk_mitigation_guardrails_policy_config))
1958
+
1959
+ print(risk_mitigation_guardrails_policy_response)
1960
+ print(risk_mitigation_guardrails_policy_response.guardrails_policy)
1961
+
1962
+ # Print as a dictionary
1963
+ print(risk_mitigation_guardrails_policy_response.to_dict())
1964
+ ```
1965
+
1966
+ ### [Mitigate Risks with System Prompt](https://docs.enkryptai.com/redteam-api-reference/endpoint/risk-mitigation-system-prompt)
1967
+
1968
+ ```python Python
1969
+ # Mitigate risks with system prompt
1970
+ risk_mitigation_system_prompt_response = redteam_client.risk_mitigation_system_prompt(config=copy.deepcopy(sample_redteam_risk_mitigation_system_prompt_config))
1971
+
1972
+ print(risk_mitigation_system_prompt_response)
1973
+ print(risk_mitigation_system_prompt_response.system_prompt)
1974
+
1975
+ # Print as a dictionary
1976
+ print(risk_mitigation_system_prompt_response.to_dict())
1977
+ ```
1978
+
1664
1979
  ## Copyright, License and Terms of Use
1665
1980
 
1666
1981
  © 2025 Enkrypt AI. All rights reserved.
@@ -9,7 +9,7 @@ enkryptai_sdk/evals.py,sha256=BywyEgIT7xdJ58svO_sDNOMVowdB0RTGoAZPEbCnDVo,2595
9
9
  enkryptai_sdk/guardrails.py,sha256=NluimOA0gM9N3S_q47LTUeG97t9PlYqPHlZahDPkJvI,16365
10
10
  enkryptai_sdk/guardrails_old.py,sha256=SgzPZkTzbAPD9XfmYNG6M1-TrzbhDHpAkI3FjnVWS_s,6434
11
11
  enkryptai_sdk/models.py,sha256=rrLTT3i96flWidVrr67j6VZ6XmkdxwEzlF4S4aoVmOQ,11559
12
- enkryptai_sdk/red_team.py,sha256=A1b6R5d3dtZMfb5npBrSu4RX2X-C9V4hubyO9g3BZlA,18441
12
+ enkryptai_sdk/red_team.py,sha256=cjN4LODbpYiECcoL0JROMcCPCzm3Ib6kXi7kQspP4hQ,19869
13
13
  enkryptai_sdk/response.py,sha256=43JRubzgGCpoVxYNzBZY0AlUgLbfcXD_AwD7wU3qY9o,4086
14
14
  enkryptai_sdk/dto/__init__.py,sha256=wHgIv_OCnVMJOys-vqImF59ifogDrMcgxVRmfNayVvc,2761
15
15
  enkryptai_sdk/dto/ai_proxy.py,sha256=clwMN4xdH8Zr55dnhilHbs-qaHRlCOrLPrij0Zd1Av0,11283
@@ -17,11 +17,11 @@ enkryptai_sdk/dto/base.py,sha256=y77kQL1X7389ifSVNc0E7CUFNxACh5AM3ml9YPon1KY,282
17
17
  enkryptai_sdk/dto/coc.py,sha256=Lp2aat_24J4KuUg4BeJl9S39tEak8Bw15eJ4cQDrRQk,4749
18
18
  enkryptai_sdk/dto/datasets.py,sha256=RFA9CmbhD-QDDyweBq_k9iBd00b6I6SWmdP9DPNd9fc,5002
19
19
  enkryptai_sdk/dto/deployments.py,sha256=Aw4b8tDA3FYIomqDvCjblCXTagL4bT8Fx91X0SFXs40,11216
20
- enkryptai_sdk/dto/guardrails.py,sha256=wfKm2R0uJAq9nljLBPuuT05tj1nBqZraga-5lMHd3n8,49812
21
- enkryptai_sdk/dto/models.py,sha256=h8eiDeT-cpCMS5IUFxWzwrLQHAAdnAFrvSuSFw7SiaI,14230
22
- enkryptai_sdk/dto/red_team.py,sha256=GD_HxFhoaEixyaZLVdoLHmHDXFRf9b-Wq6RT-UJNQfM,18344
23
- enkryptai_sdk-1.0.13.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
- enkryptai_sdk-1.0.13.dist-info/METADATA,sha256=2rSIQzIvmj8ISa4HBKXGEEepdb4ASOxts6E1jo8U8Q0,62092
25
- enkryptai_sdk-1.0.13.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
26
- enkryptai_sdk-1.0.13.dist-info/top_level.txt,sha256=s2X9UJJwvJamNmr6ZXWyyQe60sXtQGWFuaBYfhgHI_4,14
27
- enkryptai_sdk-1.0.13.dist-info/RECORD,,
20
+ enkryptai_sdk/dto/guardrails.py,sha256=oJQqFhsdQd_yPU187AhKse-Y4xktgmVNwwKKkzFazbg,50167
21
+ enkryptai_sdk/dto/models.py,sha256=zldbvYV5zcg1J3UZh4UnaeM1cBx-_LCCyW-LtfBcjaQ,14246
22
+ enkryptai_sdk/dto/red_team.py,sha256=7wtIFfcbWXw3w8aRWO4YMUwIvhwJX8XOJEyOv8Ls_eQ,23143
23
+ enkryptai_sdk-1.0.15.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ enkryptai_sdk-1.0.15.dist-info/METADATA,sha256=LcZpm1lqiwbrWYExhN26Fntjjm0PAFhcx_OYzzUbpYg,72934
25
+ enkryptai_sdk-1.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ enkryptai_sdk-1.0.15.dist-info/top_level.txt,sha256=s2X9UJJwvJamNmr6ZXWyyQe60sXtQGWFuaBYfhgHI_4,14
27
+ enkryptai_sdk-1.0.15.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5