pangea-sdk 5.5.0b1__tar.gz → 5.5.0b3__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 (60) hide show
  1. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/PKG-INFO +8 -8
  2. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/README.md +2 -2
  3. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/__init__.py +1 -1
  4. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/ai_guard.py +3 -0
  5. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/prompt_guard.py +17 -4
  6. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/share.py +2 -2
  7. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/config.py +6 -4
  8. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/ai_guard.py +35 -2
  9. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/prompt_guard.py +19 -6
  10. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/share/share.py +1 -1
  11. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pyproject.toml +8 -8
  12. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/__init__.py +0 -0
  13. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/file_uploader.py +0 -0
  14. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/request.py +0 -0
  15. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/__init__.py +0 -0
  16. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/audit.py +0 -0
  17. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/authn.py +0 -0
  18. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/authz.py +0 -0
  19. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/base.py +0 -0
  20. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/embargo.py +0 -0
  21. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/file_scan.py +0 -0
  22. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/intel.py +0 -0
  23. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/redact.py +0 -0
  24. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/sanitize.py +0 -0
  25. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/asyncio/services/vault.py +0 -0
  26. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/audit_logger.py +0 -0
  27. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/crypto/rsa.py +0 -0
  28. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/deep_verify.py +0 -0
  29. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/deprecated.py +0 -0
  30. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/dump_audit.py +0 -0
  31. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/exceptions.py +0 -0
  32. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/file_uploader.py +0 -0
  33. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/py.typed +0 -0
  34. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/request.py +0 -0
  35. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/response.py +0 -0
  36. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/__init__.py +0 -0
  37. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/audit/audit.py +0 -0
  38. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/audit/exceptions.py +0 -0
  39. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/audit/models.py +0 -0
  40. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/audit/signing.py +0 -0
  41. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/audit/util.py +0 -0
  42. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/authn/authn.py +0 -0
  43. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/authn/models.py +0 -0
  44. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/authz.py +0 -0
  45. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/base.py +0 -0
  46. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/embargo.py +0 -0
  47. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/file_scan.py +0 -0
  48. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/intel.py +0 -0
  49. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/redact.py +0 -0
  50. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/sanitize.py +0 -0
  51. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/share/file_format.py +0 -0
  52. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/vault/models/asymmetric.py +0 -0
  53. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/vault/models/common.py +0 -0
  54. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/vault/models/keys.py +0 -0
  55. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/vault/models/secret.py +0 -0
  56. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/vault/models/symmetric.py +0 -0
  57. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/services/vault/vault.py +0 -0
  58. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/tools.py +0 -0
  59. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/utils.py +0 -0
  60. {pangea_sdk-5.5.0b1 → pangea_sdk-5.5.0b3}/pangea/verify_audit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pangea-sdk
3
- Version: 5.5.0b1
3
+ Version: 5.5.0b3
4
4
  Summary: Pangea API SDK
5
5
  License: MIT
6
6
  Keywords: Pangea,SDK,Audit
@@ -11,11 +11,11 @@ Classifier: Topic :: Software Development
11
11
  Classifier: Topic :: Software Development :: Libraries
12
12
  Requires-Dist: aiohttp (>=3.11.11,<4.0.0)
13
13
  Requires-Dist: cryptography (>=43.0.3,<44.0.0)
14
- Requires-Dist: deprecated (>=1.2.15,<2.0.0)
15
- Requires-Dist: google-crc32c (>=1.5.0,<2.0.0)
16
- Requires-Dist: pydantic (>=2.10.5,<3.0.0)
17
- Requires-Dist: python-dateutil (>=2.9.0,<3.0.0)
18
- Requires-Dist: requests (>=2.31.0,<3.0.0)
14
+ Requires-Dist: deprecated (>=1.2.18,<2.0.0)
15
+ Requires-Dist: google-crc32c (>=1.6.0,<2.0.0)
16
+ Requires-Dist: pydantic (>=2.10.6,<3.0.0)
17
+ Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
18
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
19
19
  Requires-Dist: requests-toolbelt (>=1.0.0,<2.0.0)
20
20
  Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
21
21
  Description-Content-Type: text/markdown
@@ -63,13 +63,13 @@ the same compatibility guarantees as stable releases.
63
63
  Via pip:
64
64
 
65
65
  ```bash
66
- $ pip3 install pangea-sdk==5.5.0b1
66
+ $ pip3 install pangea-sdk==5.5.0b3
67
67
  ```
68
68
 
69
69
  Via poetry:
70
70
 
71
71
  ```bash
72
- $ poetry add pangea-sdk==5.5.0b1
72
+ $ poetry add pangea-sdk==5.5.0b3
73
73
  ```
74
74
 
75
75
  ## Usage
@@ -41,13 +41,13 @@ the same compatibility guarantees as stable releases.
41
41
  Via pip:
42
42
 
43
43
  ```bash
44
- $ pip3 install pangea-sdk==5.5.0b1
44
+ $ pip3 install pangea-sdk==5.5.0b3
45
45
  ```
46
46
 
47
47
  Via poetry:
48
48
 
49
49
  ```bash
50
- $ poetry add pangea-sdk==5.5.0b1
50
+ $ poetry add pangea-sdk==5.5.0b3
51
51
  ```
52
52
 
53
53
  ## Usage
@@ -1,4 +1,4 @@
1
- __version__ = "5.5.0beta1"
1
+ __version__ = "5.5.0beta3"
2
2
 
3
3
  from pangea.asyncio.request import PangeaRequestAsync
4
4
  from pangea.config import PangeaConfig
@@ -143,6 +143,9 @@ class AIGuardAsync(ServiceBaseAsync):
143
143
  are to be applied to the text, such as defang malicious URLs.
144
144
  debug: Setting this value to true will provide a detailed analysis
145
145
  of the text data
146
+
147
+ Examples:
148
+ response = await ai_guard.guard_text("text")
146
149
  """
147
150
 
148
151
  return await self.request.post(
@@ -52,7 +52,12 @@ class PromptGuardAsync(ServiceBaseAsync):
52
52
  super().__init__(token, config, logger_name, config_id)
53
53
 
54
54
  async def guard(
55
- self, messages: Iterable[Message], *, analyzers: Iterable[str] | None = None
55
+ self,
56
+ messages: Iterable[Message],
57
+ *,
58
+ analyzers: Iterable[str] | None = None,
59
+ classify: bool | None = None,
60
+ threshold: float | None = None,
56
61
  ) -> PangeaResponse[GuardResult]:
57
62
  """
58
63
  Guard (Beta)
@@ -64,8 +69,12 @@ class PromptGuardAsync(ServiceBaseAsync):
64
69
  OperationId: prompt_guard_post_v1beta_guard
65
70
 
66
71
  Args:
67
- messages: Messages.
68
- analyzers: Specific analyzers to be used in the call.
72
+ messages: Prompt content and role array in JSON format. The
73
+ `content` is the text that will be analyzed for redaction.
74
+ analyzers: Specific analyzers to be used in the call
75
+ classify: Boolean to enable classification of the content
76
+ threshold: Threshold for the confidence score to consider the prompt
77
+ as malicious
69
78
 
70
79
  Examples:
71
80
  from pangea.asyncio.services.prompt_guard import Message
@@ -73,4 +82,8 @@ class PromptGuardAsync(ServiceBaseAsync):
73
82
  response = await prompt_guard.guard([Message(role="user", content="hello world")])
74
83
  """
75
84
 
76
- return await self.request.post("v1beta/guard", GuardResult, data={"messages": messages, "analyzers": analyzers})
85
+ return await self.request.post(
86
+ "v1beta/guard",
87
+ GuardResult,
88
+ data={"messages": messages, "analyzers": analyzers, "classify": classify, "threshold": threshold},
89
+ )
@@ -34,7 +34,7 @@ class ShareAsync(ServiceBaseAsync):
34
34
 
35
35
  Examples:
36
36
  config = PangeaConfig(domain="aws.us.pangea.cloud")
37
- authz = ShareAsync(token="pangea_token", config=config)
37
+ share = ShareAsync(token="pangea_token", config=config)
38
38
  """
39
39
 
40
40
  super().__init__(token, config, logger_name, config_id=config_id)
@@ -51,7 +51,7 @@ class ShareAsync(ServiceBaseAsync):
51
51
  A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
52
52
 
53
53
  Examples:
54
- response = share.buckets()
54
+ response = await share.buckets()
55
55
  """
56
56
 
57
57
  return await self.request.post("v1/buckets", m.BucketsResult)
@@ -2,7 +2,7 @@
2
2
  # Author: Pangea Cyber Corporation
3
3
 
4
4
  from dataclasses import dataclass
5
- from typing import Optional
5
+ from typing import Literal, Optional
6
6
 
7
7
 
8
8
  @dataclass
@@ -16,10 +16,12 @@ class PangeaConfig:
16
16
  scheme (http:// or https://), subdomain, domain and port.
17
17
  """
18
18
 
19
- environment: str = "production"
19
+ environment: Literal["production", "local"] = "production"
20
20
  """
21
- Used to generate service url.
22
- It should be only 'production' or 'local' in cases of particular services that can run locally as Redact.
21
+ Pangea environment, used to construct service URLs.
22
+
23
+ If set to "local", then `domain` must be the full host (i.e., hostname and
24
+ port) for the Pangea service that this `PangeaConfig` will be used for.
23
25
  """
24
26
 
25
27
  config_id: Optional[str] = None
@@ -13,6 +13,7 @@ class AnalyzerResponse(APIResponseModel):
13
13
 
14
14
 
15
15
  class PromptInjectionResult(APIResponseModel):
16
+ action: str
16
17
  analyzer_responses: List[AnalyzerResponse]
17
18
  """Triggered prompt injection analyzers."""
18
19
 
@@ -20,7 +21,7 @@ class PromptInjectionResult(APIResponseModel):
20
21
  class PiiEntity(APIResponseModel):
21
22
  type: str
22
23
  value: str
23
- redacted: bool
24
+ action: str
24
25
  start_pos: Optional[int] = None
25
26
 
26
27
 
@@ -31,7 +32,7 @@ class PiiEntityResult(APIResponseModel):
31
32
  class MaliciousEntity(APIResponseModel):
32
33
  type: str
33
34
  value: str
34
- redacted: Optional[bool] = None
35
+ action: str
35
36
  start_pos: Optional[int] = None
36
37
  raw: Optional[Dict[str, Any]] = None
37
38
 
@@ -40,6 +41,28 @@ class MaliciousEntityResult(APIResponseModel):
40
41
  entities: List[MaliciousEntity]
41
42
 
42
43
 
44
+ class SecretsEntity(APIResponseModel):
45
+ type: str
46
+ value: str
47
+ action: str
48
+ start_pos: Optional[int] = None
49
+ redacted_value: Optional[str] = None
50
+
51
+
52
+ class SecretsEntityResult(APIResponseModel):
53
+ entities: List[SecretsEntity]
54
+
55
+
56
+ class LanguageDetectionResult(APIResponseModel):
57
+ language: str
58
+ action: str
59
+
60
+
61
+ class CodeDetectionResult(APIResponseModel):
62
+ language: str
63
+ action: str
64
+
65
+
43
66
  _T = TypeVar("_T")
44
67
 
45
68
 
@@ -52,6 +75,11 @@ class TextGuardDetectors(APIResponseModel):
52
75
  prompt_injection: Optional[TextGuardDetector[PromptInjectionResult]] = None
53
76
  pii_entity: Optional[TextGuardDetector[PiiEntityResult]] = None
54
77
  malicious_entity: Optional[TextGuardDetector[MaliciousEntityResult]] = None
78
+ secrets_detection: Optional[TextGuardDetector[SecretsEntityResult]] = None
79
+ profanity_and_toxicity: Optional[TextGuardDetector[Any]] = None
80
+ custom_entity: Optional[TextGuardDetector[Any]] = None
81
+ language_detection: Optional[TextGuardDetector[LanguageDetectionResult]] = None
82
+ code_detection: Optional[TextGuardDetector[CodeDetectionResult]] = None
55
83
 
56
84
 
57
85
  class TextGuardResult(PangeaResponseResult, Generic[_T]):
@@ -64,6 +92,8 @@ class TextGuardResult(PangeaResponseResult, Generic[_T]):
64
92
  prompt_messages: Optional[_T] = None
65
93
  """Updated structured prompt, if applicable."""
66
94
 
95
+ blocked: bool
96
+
67
97
 
68
98
  class AIGuard(ServiceBase):
69
99
  """AI Guard service client.
@@ -196,6 +226,9 @@ class AIGuard(ServiceBase):
196
226
  are to be applied to the text, such as defang malicious URLs.
197
227
  debug: Setting this value to true will provide a detailed analysis
198
228
  of the text data
229
+
230
+ Examples:
231
+ response = ai_guard.guard_text("text")
199
232
  """
200
233
 
201
234
  return self.request.post(
@@ -19,8 +19,8 @@ class Classification(APIResponseModel):
19
19
  category: str
20
20
  """Classification category"""
21
21
 
22
- label: str
23
- """Classification label"""
22
+ detected: bool
23
+ """Classification detection result"""
24
24
 
25
25
  confidence: float
26
26
  """Confidence score for the classification"""
@@ -86,7 +86,12 @@ class PromptGuard(ServiceBase):
86
86
  super().__init__(token, config, logger_name, config_id)
87
87
 
88
88
  def guard(
89
- self, messages: Iterable[Message], *, analyzers: Iterable[str] | None = None
89
+ self,
90
+ messages: Iterable[Message],
91
+ *,
92
+ analyzers: Iterable[str] | None = None,
93
+ classify: bool | None = None,
94
+ threshold: float | None = None,
90
95
  ) -> PangeaResponse[GuardResult]:
91
96
  """
92
97
  Guard (Beta)
@@ -98,8 +103,12 @@ class PromptGuard(ServiceBase):
98
103
  OperationId: prompt_guard_post_v1beta_guard
99
104
 
100
105
  Args:
101
- messages: Prompt content and role array.
102
- analyzers: Specific analyzers to be used in the call.
106
+ messages: Prompt content and role array in JSON format. The
107
+ `content` is the text that will be analyzed for redaction.
108
+ analyzers: Specific analyzers to be used in the call
109
+ classify: Boolean to enable classification of the content
110
+ threshold: Threshold for the confidence score to consider the prompt
111
+ as malicious
103
112
 
104
113
  Examples:
105
114
  from pangea.services.prompt_guard import Message
@@ -107,4 +116,8 @@ class PromptGuard(ServiceBase):
107
116
  response = prompt_guard.guard([Message(role="user", content="hello world")])
108
117
  """
109
118
 
110
- return self.request.post("v1beta/guard", GuardResult, data={"messages": messages, "analyzers": analyzers})
119
+ return self.request.post(
120
+ "v1beta/guard",
121
+ GuardResult,
122
+ data={"messages": messages, "analyzers": analyzers, "classify": classify, "threshold": threshold},
123
+ )
@@ -762,7 +762,7 @@ class Share(ServiceBase):
762
762
 
763
763
  Examples:
764
764
  config = PangeaConfig(domain="aws.us.pangea.cloud")
765
- authz = Share(token="pangea_token", config=config)
765
+ share = Share(token="pangea_token", config=config)
766
766
  """
767
767
 
768
768
  super().__init__(token, config, logger_name, config_id=config_id)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pangea-sdk"
3
- version = "5.5.0beta1"
3
+ version = "5.5.0beta3"
4
4
  description = "Pangea API SDK"
5
5
  authors = [
6
6
  {name = "Glenn Gallien", email = "glenn.gallien@pangea.cloud"}
@@ -18,11 +18,11 @@ requires-python = ">=3.9,<4.0.0"
18
18
  dependencies = [
19
19
  "aiohttp (>=3.11.11,<4.0.0)",
20
20
  "cryptography (>=43.0.3,<44.0.0)",
21
- "deprecated (>=1.2.15,<2.0.0)",
22
- "google-crc32c (>=1.5.0,<2.0.0)",
23
- "pydantic (>=2.10.5,<3.0.0)",
24
- "python-dateutil (>=2.9.0,<3.0.0)",
25
- "requests (>=2.31.0,<3.0.0)",
21
+ "deprecated (>=1.2.18,<2.0.0)",
22
+ "google-crc32c (>=1.6.0,<2.0.0)",
23
+ "pydantic (>=2.10.6,<3.0.0)",
24
+ "python-dateutil (>=2.9.0.post0,<3.0.0)",
25
+ "requests (>=2.32.3,<3.0.0)",
26
26
  "requests-toolbelt (>=1.0.0,<2.0.0)",
27
27
  "typing-extensions (>=4.12.2,<5.0.0)"
28
28
  ]
@@ -33,9 +33,9 @@ packages = [
33
33
  ]
34
34
 
35
35
  [tool.poetry.group.dev.dependencies]
36
- black = "^24.10.0"
36
+ black = "^25.1.0"
37
37
  docstring-parser = "^0.15"
38
- isort = "^5.13.2"
38
+ isort = "^6.0.0"
39
39
  mypy = "1.14.1"
40
40
  types-Deprecated = "^1.2.9.3"
41
41
  types-python-dateutil = "^2.8.19.14"