pangea-sdk 5.5.0b2__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 +1 -1
- pangea/asyncio/services/ai_guard.py +3 -0
- pangea/asyncio/services/prompt_guard.py +17 -4
- pangea/asyncio/services/share.py +2 -2
- pangea/services/ai_guard.py +10 -9
- pangea/services/prompt_guard.py +19 -6
- pangea/services/share/share.py +1 -1
- {pangea_sdk-5.5.0b2.dist-info → pangea_sdk-5.5.0b3.dist-info}/METADATA +7 -7
- {pangea_sdk-5.5.0b2.dist-info → pangea_sdk-5.5.0b3.dist-info}/RECORD +10 -10
- {pangea_sdk-5.5.0b2.dist-info → pangea_sdk-5.5.0b3.dist-info}/WHEEL +0 -0
pangea/__init__.py
CHANGED
@@ -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,
|
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:
|
68
|
-
|
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(
|
85
|
+
return await self.request.post(
|
86
|
+
"v1beta/guard",
|
87
|
+
GuardResult,
|
88
|
+
data={"messages": messages, "analyzers": analyzers, "classify": classify, "threshold": threshold},
|
89
|
+
)
|
pangea/asyncio/services/share.py
CHANGED
@@ -34,7 +34,7 @@ class ShareAsync(ServiceBaseAsync):
|
|
34
34
|
|
35
35
|
Examples:
|
36
36
|
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
37
|
-
|
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/services/ai_guard.py
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
from typing import Any, Dict, Generic, List,
|
3
|
+
from typing import Any, Dict, Generic, List, Optional, TypeVar, overload
|
4
4
|
|
5
5
|
from pangea.config import PangeaConfig
|
6
6
|
from pangea.response import APIResponseModel, PangeaResponse, PangeaResponseResult
|
7
7
|
from pangea.services.base import ServiceBase
|
8
8
|
|
9
|
-
_DetectorAction = Literal["detected", "redacted", "defanged", "reported", "blocked"]
|
10
|
-
|
11
9
|
|
12
10
|
class AnalyzerResponse(APIResponseModel):
|
13
11
|
analyzer: str
|
@@ -15,7 +13,7 @@ class AnalyzerResponse(APIResponseModel):
|
|
15
13
|
|
16
14
|
|
17
15
|
class PromptInjectionResult(APIResponseModel):
|
18
|
-
action:
|
16
|
+
action: str
|
19
17
|
analyzer_responses: List[AnalyzerResponse]
|
20
18
|
"""Triggered prompt injection analyzers."""
|
21
19
|
|
@@ -23,7 +21,7 @@ class PromptInjectionResult(APIResponseModel):
|
|
23
21
|
class PiiEntity(APIResponseModel):
|
24
22
|
type: str
|
25
23
|
value: str
|
26
|
-
action:
|
24
|
+
action: str
|
27
25
|
start_pos: Optional[int] = None
|
28
26
|
|
29
27
|
|
@@ -34,7 +32,7 @@ class PiiEntityResult(APIResponseModel):
|
|
34
32
|
class MaliciousEntity(APIResponseModel):
|
35
33
|
type: str
|
36
34
|
value: str
|
37
|
-
action:
|
35
|
+
action: str
|
38
36
|
start_pos: Optional[int] = None
|
39
37
|
raw: Optional[Dict[str, Any]] = None
|
40
38
|
|
@@ -46,7 +44,7 @@ class MaliciousEntityResult(APIResponseModel):
|
|
46
44
|
class SecretsEntity(APIResponseModel):
|
47
45
|
type: str
|
48
46
|
value: str
|
49
|
-
action:
|
47
|
+
action: str
|
50
48
|
start_pos: Optional[int] = None
|
51
49
|
redacted_value: Optional[str] = None
|
52
50
|
|
@@ -57,12 +55,12 @@ class SecretsEntityResult(APIResponseModel):
|
|
57
55
|
|
58
56
|
class LanguageDetectionResult(APIResponseModel):
|
59
57
|
language: str
|
60
|
-
action:
|
58
|
+
action: str
|
61
59
|
|
62
60
|
|
63
61
|
class CodeDetectionResult(APIResponseModel):
|
64
62
|
language: str
|
65
|
-
action:
|
63
|
+
action: str
|
66
64
|
|
67
65
|
|
68
66
|
_T = TypeVar("_T")
|
@@ -228,6 +226,9 @@ class AIGuard(ServiceBase):
|
|
228
226
|
are to be applied to the text, such as defang malicious URLs.
|
229
227
|
debug: Setting this value to true will provide a detailed analysis
|
230
228
|
of the text data
|
229
|
+
|
230
|
+
Examples:
|
231
|
+
response = ai_guard.guard_text("text")
|
231
232
|
"""
|
232
233
|
|
233
234
|
return self.request.post(
|
pangea/services/prompt_guard.py
CHANGED
@@ -19,8 +19,8 @@ class Classification(APIResponseModel):
|
|
19
19
|
category: str
|
20
20
|
"""Classification category"""
|
21
21
|
|
22
|
-
|
23
|
-
"""Classification
|
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,
|
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
|
-
|
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(
|
119
|
+
return self.request.post(
|
120
|
+
"v1beta/guard",
|
121
|
+
GuardResult,
|
122
|
+
data={"messages": messages, "analyzers": analyzers, "classify": classify, "threshold": threshold},
|
123
|
+
)
|
pangea/services/share/share.py
CHANGED
@@ -762,7 +762,7 @@ class Share(ServiceBase):
|
|
762
762
|
|
763
763
|
Examples:
|
764
764
|
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
765
|
-
|
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.
|
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
|
-
Requires-Dist: google-crc32c (>=1.
|
16
|
-
Requires-Dist: pydantic (>=2.10.
|
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
17
|
Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
|
18
|
-
Requires-Dist: requests (>=2.
|
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.
|
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.
|
72
|
+
$ poetry add pangea-sdk==5.5.0b3
|
73
73
|
```
|
74
74
|
|
75
75
|
## Usage
|
@@ -1,9 +1,9 @@
|
|
1
|
-
pangea/__init__.py,sha256=
|
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=
|
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,10 +11,10 @@ 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=
|
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=
|
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
20
|
pangea/config.py,sha256=qe1ZhvDxNQxNXUpAtzF6nPLjyRpPVG9sjhLZV6Pkyn8,1766
|
@@ -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=
|
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=
|
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=
|
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.
|
59
|
-
pangea_sdk-5.5.
|
60
|
-
pangea_sdk-5.5.
|
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,,
|
File without changes
|