pangea-sdk 5.5.0b1__py3-none-any.whl → 5.5.0b3__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.
pangea/__init__.py CHANGED
@@ -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)
pangea/config.py CHANGED
@@ -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
  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
@@ -1,9 +1,9 @@
1
- pangea/__init__.py,sha256=wdTGmwo1JC7NzREP3iXJP02Jv2SYmmPLT543aYxuQeA,251
1
+ pangea/__init__.py,sha256=oR8inTyWgORDk9j8o76EPF3uU09SynZlOMqk3ZP36dk,251
2
2
  pangea/asyncio/__init__.py,sha256=kjEMkqMQ521LlMSu5jn3_WgweyArwVZ2C-s3x7mR6Pk,45
3
3
  pangea/asyncio/file_uploader.py,sha256=wI7epib7Rc5jtZw4eJ1L1SlmutDG6CPv59C8N2UPhtY,1436
4
4
  pangea/asyncio/request.py,sha256=lpLY-o405r3-VUfrAE5uxYxI8UjM4hjPqUzAUtOGE5o,18040
5
5
  pangea/asyncio/services/__init__.py,sha256=L6Tdhjfx_ZECHskhLMPaCcOefi-r-imw6q_zlU4j-FY,464
6
- pangea/asyncio/services/ai_guard.py,sha256=GNDXooxEvEkifNef9sPBaM6ymlwdogto6oLPf10gPgo,5601
6
+ pangea/asyncio/services/ai_guard.py,sha256=7Zr4jjCmOcPOFgHesM4MYgDosqfNjF_Foj5e_EyMZ70,5677
7
7
  pangea/asyncio/services/audit.py,sha256=rPaCx4cMzj-g9WFMRIysFCJAz6Btp6YrhcKe_exky8k,26283
8
8
  pangea/asyncio/services/authn.py,sha256=rPeLJweL8mYH_t4ebcQn4n_Wglr3kClKNnCXNCimZU4,46622
9
9
  pangea/asyncio/services/authz.py,sha256=B_0_nhDMJcjNpjpCx3Vi2LDRhlmfV9325GKbUZ8reos,10025
@@ -11,13 +11,13 @@ pangea/asyncio/services/base.py,sha256=vRFVcO_uEAGJte3OUUBLD43RoiiFB1vC7SPyN6yEM
11
11
  pangea/asyncio/services/embargo.py,sha256=ctzj3kip6xos-Eu3JuOskrCGYC8T3JlsgAopZHiPSXM,3068
12
12
  pangea/asyncio/services/file_scan.py,sha256=PLG1O-PL4Yk9uY9D6NbMrZ5LHg70Z311s7bFe46UMZA,7108
13
13
  pangea/asyncio/services/intel.py,sha256=BcxGKSoZ1nJiEHyZM9yOwKSSPJUrB6ibJ19KR27VlgQ,40261
14
- pangea/asyncio/services/prompt_guard.py,sha256=KMScsVybwQEwipN7CaC4AX4KRqlIkC8xZ2j7m-BDL9E,2349
14
+ pangea/asyncio/services/prompt_guard.py,sha256=rTFylG9zyMauhpzb6BsccmmMK3qRwtrsoMjemLDJ2Bs,2835
15
15
  pangea/asyncio/services/redact.py,sha256=JPJcmeKFloMZRpkjAHAZbpZJpO993WsTfEwA-S5ov18,7951
16
16
  pangea/asyncio/services/sanitize.py,sha256=EbSdq_v9yZWce9xEYWvZharE9bJcxw8cg5Pv8LVxdxc,8627
17
- pangea/asyncio/services/share.py,sha256=AXXtFtmbXud0dAAom7qqHVOK9zBfX5S10MFS_1DQvio,30767
17
+ pangea/asyncio/services/share.py,sha256=Qd2Oh4UsLwu7Zo4Xy1KABHuP4TJ9AtcN-XzldvilFVo,30773
18
18
  pangea/asyncio/services/vault.py,sha256=VqrJGSEdq6MlZRI6cJpkthhIsqLClSQdgVxwYCbIwEk,77079
19
19
  pangea/audit_logger.py,sha256=gRkCfUUT5LDNaycwxkhZUySgY47jDfn1ZeKOul4XCQI,3842
20
- pangea/config.py,sha256=mQUu8GX_6weIuv3vjNdG5plppXskXYASmxMWtFQh-hc,1662
20
+ pangea/config.py,sha256=qe1ZhvDxNQxNXUpAtzF6nPLjyRpPVG9sjhLZV6Pkyn8,1766
21
21
  pangea/crypto/rsa.py,sha256=mwSiNy571KAGr3F6oEM0CXWkl9D023ch8ldbZZeLj_4,4747
22
22
  pangea/deep_verify.py,sha256=ZGraaL7TCxwRBIDqjBFR0clKlhAC-Yce6kD-1LClhG8,8616
23
23
  pangea/deprecated.py,sha256=IjFYEVvY1E0ld0SMkEYC1o62MAleX3nnT1If2dFVbHo,608
@@ -28,7 +28,7 @@ pangea/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  pangea/request.py,sha256=vGB8owXUiNQoeiiACFvfXvg44JJo_L6WfcHlF6ug8co,25082
29
29
  pangea/response.py,sha256=lPAcYsF9Xg166CiyhCofVmQA-W4jevh0MQXxUa8Re68,7737
30
30
  pangea/services/__init__.py,sha256=h36HzyIGaI5kO6l3UCwKHx_Kd-m_9mYVwn5MLRVzblI,408
31
- pangea/services/ai_guard.py,sha256=Pe-j4WrMQg5fO8T6LkygQ1qwBWbN0Ha28aEHl4uw6dY,6905
31
+ pangea/services/ai_guard.py,sha256=jbXzcUaR7j-6ytW9QRCGn9WtlrCCcB6Ia_2J-3AY-X4,7763
32
32
  pangea/services/audit/audit.py,sha256=7-c9l7jyGtpG7SqRUMpqsAzcUDhMZ5izgPalxHXsUvM,39320
33
33
  pangea/services/audit/exceptions.py,sha256=bhVuYe4ammacOVxwg98CChxvwZf5FKgR2DcgqILOcwc,471
34
34
  pangea/services/audit/models.py,sha256=1h1B9eSYQMYG3f8WNi1UcDX2-impRrET_ErjJYUnj7M,14678
@@ -41,11 +41,11 @@ pangea/services/base.py,sha256=43pWQcR9CeT4sGzgctF3Sy4M_h7DaUzkuZD2Z7CcDUU,3845
41
41
  pangea/services/embargo.py,sha256=9Wfku4td5ORaIENKmnGmS5jxJJIRfWp6Q51L36Jsy0I,3897
42
42
  pangea/services/file_scan.py,sha256=QiO80uKqB_BnAOiYQKznXfxpa5j40qqETE3-zBRT_QE,7813
43
43
  pangea/services/intel.py,sha256=y1EX2ctYIxQc52lmHp6-Q_UIDM--t3fOpXDssWiRPfo,56474
44
- pangea/services/prompt_guard.py,sha256=k-b8ukyXaHruqC4S2NjFKhDLcvY5Wp8Ga0g_Ep3WFKY,3244
44
+ pangea/services/prompt_guard.py,sha256=5KqML4IleB_4a7_PDqWLk9WGQVJ0j4vOdqgVGGkQ6z8,3724
45
45
  pangea/services/redact.py,sha256=ovIcT0jkXe57O7keGzSClWNCic8y-4NZoemXoSKjjww,12913
46
46
  pangea/services/sanitize.py,sha256=eAN1HhObiKqygy6HHcfl0NmxYfPMvqSKepwEAVVIIEE,12936
47
47
  pangea/services/share/file_format.py,sha256=1svO1ee_aenA9zoO_AaU-Rk5Ulp7kcPOc_KwNoluyQE,2797
48
- pangea/services/share/share.py,sha256=b1Iuuog0XWXaI6rImoj0OeEx3DXbYqLWsLbCC_Zp6eg,52343
48
+ pangea/services/share/share.py,sha256=hlhkIr6ScJ5oMFUs9no4HtHNoUEbYU4KoLkiGLxex30,52343
49
49
  pangea/services/vault/models/asymmetric.py,sha256=vspijmEvHm5WXri_fjOWfQc4maYyZfhDkLuaTM8-PZo,4991
50
50
  pangea/services/vault/models/common.py,sha256=PSZRFqHTUtEMJJGwywEFM2AU3aV8S-sbcoo3LLQ6uTc,17981
51
51
  pangea/services/vault/models/keys.py,sha256=duAuTiOby_D7MloRvN4gNj0P-b-jx9sdtplAWFxsShw,2786
@@ -55,6 +55,6 @@ pangea/services/vault/vault.py,sha256=ow-Zm7PYzfWIfUcA4UNnpeL2DHfZM4C7inRDmNR3zQ
55
55
  pangea/tools.py,sha256=2-Y4SAHWFv6Ocj42J_bWrVy27M5G3wi7a8LJn0dabHc,6427
56
56
  pangea/utils.py,sha256=dZ6MwFVEWXUgXvvDg-k6JnvVfsgslvtaBd7ez7afrqk,4983
57
57
  pangea/verify_audit.py,sha256=nSP17OzoSPdvezRExwfcf45H8ZPZnxZu-CbEp3qFJO0,17354
58
- pangea_sdk-5.5.0b1.dist-info/METADATA,sha256=CHx5MOHw5eW7kRbPN0EzsggBDkqbcQApROvM-78tM1A,7011
59
- pangea_sdk-5.5.0b1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
60
- pangea_sdk-5.5.0b1.dist-info/RECORD,,
58
+ pangea_sdk-5.5.0b3.dist-info/METADATA,sha256=_fwk4xCZECycgGNKq8eWhvber6bDr2EWYt1lycQMyi4,7017
59
+ pangea_sdk-5.5.0b3.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
60
+ pangea_sdk-5.5.0b3.dist-info/RECORD,,