enkryptai-sdk 1.0.18__tar.gz → 1.0.20__tar.gz

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.
Files changed (46) hide show
  1. {enkryptai_sdk-1.0.18/src/enkryptai_sdk.egg-info → enkryptai_sdk-1.0.20}/PKG-INFO +12 -2
  2. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/README.md +11 -1
  3. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/setup.py +1 -1
  4. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/config.py +10 -0
  5. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/dto/deployments.py +2 -0
  6. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/dto/guardrails.py +52 -6
  7. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/dto/red_team.py +37 -0
  8. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20/src/enkryptai_sdk.egg-info}/PKG-INFO +12 -2
  9. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_all_v2.py +3 -0
  10. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_guardrails.py +3 -0
  11. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/LICENSE +0 -0
  12. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/setup.cfg +0 -0
  13. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/__init__.py +0 -0
  14. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/ai_proxy.py +0 -0
  15. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/base.py +0 -0
  16. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/coc.py +0 -0
  17. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/datasets.py +0 -0
  18. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/deployments.py +0 -0
  19. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/dto/__init__.py +0 -0
  20. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/dto/ai_proxy.py +0 -0
  21. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/dto/base.py +0 -0
  22. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/dto/coc.py +0 -0
  23. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/dto/common.py +0 -0
  24. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/dto/datasets.py +0 -0
  25. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/dto/models.py +0 -0
  26. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/evals.py +0 -0
  27. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/guardrails.py +0 -0
  28. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/guardrails_old.py +0 -0
  29. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/models.py +0 -0
  30. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/red_team.py +0 -0
  31. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk/response.py +0 -0
  32. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk.egg-info/SOURCES.txt +0 -0
  33. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk.egg-info/dependency_links.txt +0 -0
  34. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/src/enkryptai_sdk.egg-info/top_level.txt +0 -0
  35. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_ai_proxy.py +0 -0
  36. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_all.py +0 -0
  37. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_basic.py +0 -0
  38. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_coc.py +0 -0
  39. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_datasets.py +0 -0
  40. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_deployments.py +0 -0
  41. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_detect_policy.py +0 -0
  42. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_injection_attack.py +0 -0
  43. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_model.py +0 -0
  44. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_openai.py +0 -0
  45. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_policy_violation.py +0 -0
  46. {enkryptai_sdk-1.0.18 → enkryptai_sdk-1.0.20}/tests/test_redteam.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: enkryptai-sdk
3
- Version: 1.0.18
3
+ Version: 1.0.20
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
@@ -275,6 +275,9 @@ sample_detectors = {
275
275
  },
276
276
  "bias": {
277
277
  "enabled": False
278
+ },
279
+ "sponge_attack": {
280
+ "enabled": False
278
281
  }
279
282
  }
280
283
  ```
@@ -984,6 +987,7 @@ print(batch_detect_response.to_dict())
984
987
  - `copyright_ip`: Check for copyright/IP violations ***(Coming soon)***
985
988
  - `system_prompt`: Detect system prompt leaks ***(Coming soon)***
986
989
  - `keyword_detector`: Check for specific keywords
990
+ - `sponge_attack`: Detect infinite loops
987
991
 
988
992
  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).
989
993
 
@@ -1058,6 +1062,12 @@ guardrails_config = GuardrailsConfig.copyright_ip()
1058
1062
  guardrails_config = GuardrailsConfig.system_prompt(index="system")
1059
1063
  ```
1060
1064
 
1065
+ ### [Sponge Attack](https://docs.enkryptai.com/guardrails-api-reference/Sponge_Attack_Detector)
1066
+
1067
+ ```python Python
1068
+ guardrails_config = GuardrailsConfig.sponge_attack()
1069
+ ```
1070
+
1061
1071
  ## [Detect with config](https://docs.enkryptai.com/guardrails-api-reference/Detect)
1062
1072
 
1063
1073
  ```python Python
@@ -1656,7 +1666,7 @@ custom_headers = {
1656
1666
 
1657
1667
  # Example of making a request with custom headers
1658
1668
  response = client.chat.completions.create(
1659
- model='gpt-4o',
1669
+ # model='gpt-4o', # Optional
1660
1670
  messages=[{'role': 'user', 'content': 'Hello!'}],
1661
1671
  extra_headers=custom_headers
1662
1672
  )
@@ -252,6 +252,9 @@ sample_detectors = {
252
252
  },
253
253
  "bias": {
254
254
  "enabled": False
255
+ },
256
+ "sponge_attack": {
257
+ "enabled": False
255
258
  }
256
259
  }
257
260
  ```
@@ -961,6 +964,7 @@ print(batch_detect_response.to_dict())
961
964
  - `copyright_ip`: Check for copyright/IP violations ***(Coming soon)***
962
965
  - `system_prompt`: Detect system prompt leaks ***(Coming soon)***
963
966
  - `keyword_detector`: Check for specific keywords
967
+ - `sponge_attack`: Detect infinite loops
964
968
 
965
969
  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).
966
970
 
@@ -1035,6 +1039,12 @@ guardrails_config = GuardrailsConfig.copyright_ip()
1035
1039
  guardrails_config = GuardrailsConfig.system_prompt(index="system")
1036
1040
  ```
1037
1041
 
1042
+ ### [Sponge Attack](https://docs.enkryptai.com/guardrails-api-reference/Sponge_Attack_Detector)
1043
+
1044
+ ```python Python
1045
+ guardrails_config = GuardrailsConfig.sponge_attack()
1046
+ ```
1047
+
1038
1048
  ## [Detect with config](https://docs.enkryptai.com/guardrails-api-reference/Detect)
1039
1049
 
1040
1050
  ```python Python
@@ -1633,7 +1643,7 @@ custom_headers = {
1633
1643
 
1634
1644
  # Example of making a request with custom headers
1635
1645
  response = client.chat.completions.create(
1636
- model='gpt-4o',
1646
+ # model='gpt-4o', # Optional
1637
1647
  messages=[{'role': 'user', 'content': 'Hello!'}],
1638
1648
  extra_headers=custom_headers
1639
1649
  )
@@ -9,7 +9,7 @@ with open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
9
9
  setup(
10
10
  name="enkryptai-sdk", # This is the name of your package on PyPI
11
11
  # NOTE: Also change this in .github/workflows/test.yaml
12
- version="1.0.18", # Update this for new versions
12
+ version="1.0.20", # Update this for new versions
13
13
  description="A Python SDK with guardrails and red teaming functionality for API interactions",
14
14
  long_description=long_description,
15
15
  long_description_content_type="text/markdown",
@@ -16,6 +16,7 @@ DEFAULT_GUARDRAILS_CONFIG = {
16
16
  "bias": {"enabled": False},
17
17
  "copyright_ip": {"enabled": False},
18
18
  "system_prompt": {"enabled": False, "index": "system"},
19
+ "sponge_attack": {"enabled": False},
19
20
  }
20
21
 
21
22
 
@@ -151,6 +152,15 @@ class GuardrailsConfig:
151
152
  config = copy.deepcopy(DEFAULT_GUARDRAILS_CONFIG)
152
153
  config["system_prompt"] = {"enabled": True, "index": index}
153
154
  return cls(config)
155
+
156
+ @classmethod
157
+ def sponge_attack(cls):
158
+ """
159
+ Returns a configuration instance pre-configured for sponge attack detection.
160
+ """
161
+ config = copy.deepcopy(DEFAULT_GUARDRAILS_CONFIG)
162
+ config["sponge_attack"] = {"enabled": True}
163
+ return cls(config)
154
164
 
155
165
  def update(self, **kwargs):
156
166
  """
@@ -15,6 +15,7 @@ class InputGuardrailBlockType(str, Enum):
15
15
  BIAS = "bias"
16
16
  SYSTEM_PROMPT = "system_prompt"
17
17
  COPYRIGHT_IP = "copyright_ip"
18
+ SPONGE_ATTACK = "sponge_attack"
18
19
 
19
20
 
20
21
  class OutputGuardrailBlockType(str, Enum):
@@ -28,6 +29,7 @@ class OutputGuardrailBlockType(str, Enum):
28
29
  BIAS = "bias"
29
30
  SYSTEM_PROMPT = "system_prompt"
30
31
  COPYRIGHT_IP = "copyright_ip"
32
+ SPONGE_ATTACK = "sponge_attack"
31
33
  HALLUCINATION = "hallucination"
32
34
  ADHERENCE = "adherence"
33
35
  RELEVANCY = "relevancy"
@@ -243,6 +243,23 @@ class SystemPromptDetector(BaseDTO):
243
243
  }
244
244
 
245
245
 
246
+ @dataclass
247
+ class SpongeAttackDetector(BaseDTO):
248
+ enabled: bool = False
249
+ _extra_fields: Dict[str, Any] = field(default_factory=dict)
250
+
251
+ @classmethod
252
+ def from_dict(cls, data: Dict[str, Any]) -> "SpongeAttackDetector":
253
+ return cls(
254
+ enabled=data.get("enabled", False)
255
+ )
256
+
257
+ def to_dict(self) -> Dict[str, Any]:
258
+ return {
259
+ "enabled": self.enabled
260
+ }
261
+
262
+
246
263
  class GuardrailDetectorsEnum(str, Enum):
247
264
  TOPIC_DETECTOR = "topic_detector"
248
265
  NSFW = "nsfw"
@@ -254,6 +271,7 @@ class GuardrailDetectorsEnum(str, Enum):
254
271
  BIAS = "bias"
255
272
  COPYRIGHT_IP = "copyright_ip"
256
273
  SYSTEM_PROMPT = "system_prompt"
274
+ SPONGE_ATTACK = "sponge_attack"
257
275
 
258
276
 
259
277
  @dataclass
@@ -268,6 +286,7 @@ class GuardrailDetectors(BaseDTO):
268
286
  bias: BiasDetector = field(default_factory=BiasDetector)
269
287
  copyright_ip: CopyrightIPDetector = field(default_factory=CopyrightIPDetector)
270
288
  system_prompt: SystemPromptDetector = field(default_factory=SystemPromptDetector)
289
+ sponge_attack: SpongeAttackDetector = field(default_factory=SpongeAttackDetector)
271
290
  _extra_fields: Dict[str, Any] = field(default_factory=dict)
272
291
 
273
292
  @classmethod
@@ -282,7 +301,8 @@ class GuardrailDetectors(BaseDTO):
282
301
  policy_violation=PolicyViolationDetector.from_dict(data.get("policy_violation", {})),
283
302
  bias=BiasDetector.from_dict(data.get("bias", {})),
284
303
  copyright_ip=CopyrightIPDetector.from_dict(data.get("copyright_ip", {})),
285
- system_prompt=SystemPromptDetector.from_dict(data.get("system_prompt", {}))
304
+ system_prompt=SystemPromptDetector.from_dict(data.get("system_prompt", {})),
305
+ sponge_attack=SpongeAttackDetector.from_dict(data.get("sponge_attack", {}))
286
306
  )
287
307
 
288
308
  def to_dict(self) -> Dict[str, Any]:
@@ -296,7 +316,8 @@ class GuardrailDetectors(BaseDTO):
296
316
  "policy_violation": self.policy_violation.to_dict(),
297
317
  "bias": self.bias.to_dict(),
298
318
  "copyright_ip": self.copyright_ip.to_dict(),
299
- "system_prompt": self.system_prompt.to_dict()
319
+ "system_prompt": self.system_prompt.to_dict(),
320
+ "sponge_attack": self.sponge_attack.to_dict()
300
321
  }
301
322
 
302
323
 
@@ -608,6 +629,25 @@ class SystemPromptDetail(BaseDTO):
608
629
  return result
609
630
 
610
631
 
632
+ @dataclass
633
+ class SpongeAttackDetail(BaseDTO):
634
+ sponge_attack_detected: bool = False
635
+ _extra_fields: Dict[str, Any] = field(default_factory=dict)
636
+
637
+ @classmethod
638
+ def from_dict(cls, data: Dict[str, Any]) -> "SpongeAttackDetail":
639
+ return cls(
640
+ sponge_attack_detected=data.get("sponge_attack_detected", False)
641
+ )
642
+
643
+ def to_dict(self) -> Dict[str, Any]:
644
+ result = {
645
+ "sponge_attack_detected": self.sponge_attack_detected
646
+ }
647
+ result.update(self._extra_fields)
648
+ return result
649
+
650
+
611
651
  @dataclass
612
652
  class DetectResponseSummary(BaseDTO):
613
653
  on_topic: int = 0
@@ -620,6 +660,7 @@ class DetectResponseSummary(BaseDTO):
620
660
  bias: int = 0
621
661
  copyright_ip_similarity: int = 0
622
662
  system_prompt_similarity: int = 0
663
+ sponge_attack: int = 0
623
664
  _extra_fields: Dict[str, Any] = field(default_factory=dict)
624
665
 
625
666
  @classmethod
@@ -634,7 +675,8 @@ class DetectResponseSummary(BaseDTO):
634
675
  policy_violation=data.get("policy_violation", 0),
635
676
  bias=data.get("bias", 0),
636
677
  copyright_ip_similarity=data.get("copyright_ip_similarity", 0),
637
- system_prompt_similarity=data.get("system_prompt_similarity", 0)
678
+ system_prompt_similarity=data.get("system_prompt_similarity", 0),
679
+ sponge_attack=data.get("sponge_attack", 0)
638
680
  )
639
681
 
640
682
  def to_dict(self) -> Dict[str, Any]:
@@ -648,7 +690,8 @@ class DetectResponseSummary(BaseDTO):
648
690
  "policy_violation": self.policy_violation,
649
691
  "bias": self.bias,
650
692
  "copyright_ip_similarity": self.copyright_ip_similarity,
651
- "system_prompt_similarity": self.system_prompt_similarity
693
+ "system_prompt_similarity": self.system_prompt_similarity,
694
+ "sponge_attack": self.sponge_attack
652
695
  }
653
696
  result.update(self._extra_fields)
654
697
  return result
@@ -666,6 +709,7 @@ class DetectResponseDetails(BaseDTO):
666
709
  bias: BiasDetail = field(default_factory=BiasDetail)
667
710
  copyright_ip: CopyrightIPDetail = field(default_factory=CopyrightIPDetail)
668
711
  system_prompt: SystemPromptDetail = field(default_factory=SystemPromptDetail)
712
+ sponge_attack: SpongeAttackDetail = field(default_factory=SpongeAttackDetail)
669
713
  _extra_fields: Dict[str, Any] = field(default_factory=dict)
670
714
 
671
715
  @classmethod
@@ -680,7 +724,8 @@ class DetectResponseDetails(BaseDTO):
680
724
  policy_violation=PolicyViolationDetail.from_dict(data.get("policy_violation", {})),
681
725
  bias=BiasDetail.from_dict(data.get("bias", {})),
682
726
  copyright_ip=CopyrightIPDetail.from_dict(data.get("copyright_ip", {})),
683
- system_prompt=SystemPromptDetail.from_dict(data.get("system_prompt", {}))
727
+ system_prompt=SystemPromptDetail.from_dict(data.get("system_prompt", {})),
728
+ sponge_attack=SpongeAttackDetail.from_dict(data.get("sponge_attack", {}))
684
729
  )
685
730
 
686
731
  def to_dict(self) -> Dict[str, Any]:
@@ -694,7 +739,8 @@ class DetectResponseDetails(BaseDTO):
694
739
  "policy_violation": self.policy_violation.to_dict(),
695
740
  "bias": self.bias.to_dict(),
696
741
  "copyright_ip": self.copyright_ip.to_dict(),
697
- "system_prompt": self.system_prompt.to_dict()
742
+ "system_prompt": self.system_prompt.to_dict(),
743
+ "sponge_attack": self.sponge_attack.to_dict()
698
744
  }
699
745
  result.update(self._extra_fields)
700
746
  return result
@@ -20,6 +20,7 @@ class RiskGuardrailDetectorsEnum(str, Enum):
20
20
  # Below are not yet supported by Guardrails. So, also not supported by Risk Mitigation.
21
21
  # COPYRIGHT_IP = "copyright_ip"
22
22
  # SYSTEM_PROMPT = "system_prompt"
23
+ # SPONGE_ATTACK = "sponge_attack"
23
24
 
24
25
 
25
26
  @dataclass
@@ -360,6 +361,28 @@ class TestConfig(BaseDTO):
360
361
  return cls(**data, attack_methods=attack_methods)
361
362
 
362
363
 
364
+ @dataclass
365
+ class CompetitorTestConfig(BaseDTO):
366
+ system_description: str
367
+ competitors_list: List[str]
368
+ sample_percentage: int = 1
369
+ attack_methods: AttackMethods = field(default_factory=AttackMethods)
370
+
371
+ def to_dict(self) -> dict:
372
+ return {
373
+ "sample_percentage": self.sample_percentage,
374
+ "competitors_list": self.competitors_list,
375
+ "system_description": self.system_description,
376
+ "attack_methods": self.attack_methods.to_dict(),
377
+ }
378
+
379
+ @classmethod
380
+ def from_dict(cls, data: dict):
381
+ data = data.copy()
382
+ attack_methods = AttackMethods.from_dict(data.pop("attack_methods", {}))
383
+ return cls(**data, attack_methods=attack_methods)
384
+
385
+
363
386
  @dataclass
364
387
  class RedTeamTestConfigurations(BaseDTO):
365
388
  # Basic tests
@@ -368,6 +391,12 @@ class RedTeamTestConfigurations(BaseDTO):
368
391
  insecure_code_test: TestConfig = field(default=None)
369
392
  toxicity_test: TestConfig = field(default=None)
370
393
  harmful_test: TestConfig = field(default=None)
394
+ pii_test: TestConfig = field(default=None)
395
+ copyright_test: TestConfig = field(default=None)
396
+ misinformation_test: TestConfig = field(default=None)
397
+ system_prompt_extractions_test: TestConfig = field(default=None)
398
+ sponge_test: TestConfig = field(default=None)
399
+ competitor_test: CompetitorTestConfig = field(default=None)
371
400
  # Advanced tests
372
401
  adv_info_test: TestConfig = field(default=None)
373
402
  adv_bias_test: TestConfig = field(default=None)
@@ -386,6 +415,14 @@ class RedTeamTestConfigurations(BaseDTO):
386
415
  access_control_test: TestConfig = field(default=None)
387
416
  physical_and_actuation_safety_test: TestConfig = field(default=None)
388
417
  reliability_and_monitoring_test: TestConfig = field(default=None)
418
+ governance_test: TestConfig = field(default=None)
419
+ agent_output_quality_test: TestConfig = field(default=None)
420
+ tool_misuse_test: TestConfig = field(default=None)
421
+ privacy_test: TestConfig = field(default=None)
422
+ reliability_and_observability_test: TestConfig = field(default=None)
423
+ agent_behaviour_test: TestConfig = field(default=None)
424
+ access_control_and_permissions_test: TestConfig = field(default=None)
425
+ tool_extraction_test: TestConfig = field(default=None)
389
426
  _extra_fields: Dict[str, Any] = field(default_factory=dict)
390
427
 
391
428
  @classmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: enkryptai-sdk
3
- Version: 1.0.18
3
+ Version: 1.0.20
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
@@ -275,6 +275,9 @@ sample_detectors = {
275
275
  },
276
276
  "bias": {
277
277
  "enabled": False
278
+ },
279
+ "sponge_attack": {
280
+ "enabled": False
278
281
  }
279
282
  }
280
283
  ```
@@ -984,6 +987,7 @@ print(batch_detect_response.to_dict())
984
987
  - `copyright_ip`: Check for copyright/IP violations ***(Coming soon)***
985
988
  - `system_prompt`: Detect system prompt leaks ***(Coming soon)***
986
989
  - `keyword_detector`: Check for specific keywords
990
+ - `sponge_attack`: Detect infinite loops
987
991
 
988
992
  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).
989
993
 
@@ -1058,6 +1062,12 @@ guardrails_config = GuardrailsConfig.copyright_ip()
1058
1062
  guardrails_config = GuardrailsConfig.system_prompt(index="system")
1059
1063
  ```
1060
1064
 
1065
+ ### [Sponge Attack](https://docs.enkryptai.com/guardrails-api-reference/Sponge_Attack_Detector)
1066
+
1067
+ ```python Python
1068
+ guardrails_config = GuardrailsConfig.sponge_attack()
1069
+ ```
1070
+
1061
1071
  ## [Detect with config](https://docs.enkryptai.com/guardrails-api-reference/Detect)
1062
1072
 
1063
1073
  ```python Python
@@ -1656,7 +1666,7 @@ custom_headers = {
1656
1666
 
1657
1667
  # Example of making a request with custom headers
1658
1668
  response = client.chat.completions.create(
1659
- model='gpt-4o',
1669
+ # model='gpt-4o', # Optional
1660
1670
  messages=[{'role': 'user', 'content': 'Hello!'}],
1661
1671
  extra_headers=custom_headers
1662
1672
  )
@@ -156,6 +156,9 @@ def sample_detectors():
156
156
  "enabled": False,
157
157
  "index": "system"
158
158
  },
159
+ "sponge_attack": {
160
+ "enabled": False
161
+ },
159
162
  }
160
163
 
161
164
 
@@ -75,6 +75,9 @@ def sample_detectors():
75
75
  "enabled": False,
76
76
  "index": "system"
77
77
  },
78
+ "sponge_attack": {
79
+ "enabled": False
80
+ },
78
81
  }
79
82
 
80
83
 
File without changes
File without changes