pangea-sdk 5.5.0b1__py3-none-any.whl → 5.5.0b2__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/config.py +6 -4
- pangea/services/ai_guard.py +35 -3
- {pangea_sdk-5.5.0b1.dist-info → pangea_sdk-5.5.0b2.dist-info}/METADATA +4 -4
- {pangea_sdk-5.5.0b1.dist-info → pangea_sdk-5.5.0b2.dist-info}/RECORD +6 -6
- {pangea_sdk-5.5.0b1.dist-info → pangea_sdk-5.5.0b2.dist-info}/WHEEL +0 -0
pangea/__init__.py
CHANGED
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:
|
19
|
+
environment: Literal["production", "local"] = "production"
|
20
20
|
"""
|
21
|
-
|
22
|
-
|
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
|
pangea/services/ai_guard.py
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
from typing import Any, Dict, Generic, List, Optional, TypeVar, overload
|
3
|
+
from typing import Any, Dict, Generic, List, Literal, 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
|
+
|
9
11
|
|
10
12
|
class AnalyzerResponse(APIResponseModel):
|
11
13
|
analyzer: str
|
@@ -13,6 +15,7 @@ class AnalyzerResponse(APIResponseModel):
|
|
13
15
|
|
14
16
|
|
15
17
|
class PromptInjectionResult(APIResponseModel):
|
18
|
+
action: _DetectorAction
|
16
19
|
analyzer_responses: List[AnalyzerResponse]
|
17
20
|
"""Triggered prompt injection analyzers."""
|
18
21
|
|
@@ -20,7 +23,7 @@ class PromptInjectionResult(APIResponseModel):
|
|
20
23
|
class PiiEntity(APIResponseModel):
|
21
24
|
type: str
|
22
25
|
value: str
|
23
|
-
|
26
|
+
action: _DetectorAction
|
24
27
|
start_pos: Optional[int] = None
|
25
28
|
|
26
29
|
|
@@ -31,7 +34,7 @@ class PiiEntityResult(APIResponseModel):
|
|
31
34
|
class MaliciousEntity(APIResponseModel):
|
32
35
|
type: str
|
33
36
|
value: str
|
34
|
-
|
37
|
+
action: _DetectorAction
|
35
38
|
start_pos: Optional[int] = None
|
36
39
|
raw: Optional[Dict[str, Any]] = None
|
37
40
|
|
@@ -40,6 +43,28 @@ class MaliciousEntityResult(APIResponseModel):
|
|
40
43
|
entities: List[MaliciousEntity]
|
41
44
|
|
42
45
|
|
46
|
+
class SecretsEntity(APIResponseModel):
|
47
|
+
type: str
|
48
|
+
value: str
|
49
|
+
action: _DetectorAction
|
50
|
+
start_pos: Optional[int] = None
|
51
|
+
redacted_value: Optional[str] = None
|
52
|
+
|
53
|
+
|
54
|
+
class SecretsEntityResult(APIResponseModel):
|
55
|
+
entities: List[SecretsEntity]
|
56
|
+
|
57
|
+
|
58
|
+
class LanguageDetectionResult(APIResponseModel):
|
59
|
+
language: str
|
60
|
+
action: _DetectorAction
|
61
|
+
|
62
|
+
|
63
|
+
class CodeDetectionResult(APIResponseModel):
|
64
|
+
language: str
|
65
|
+
action: _DetectorAction
|
66
|
+
|
67
|
+
|
43
68
|
_T = TypeVar("_T")
|
44
69
|
|
45
70
|
|
@@ -52,6 +77,11 @@ class TextGuardDetectors(APIResponseModel):
|
|
52
77
|
prompt_injection: Optional[TextGuardDetector[PromptInjectionResult]] = None
|
53
78
|
pii_entity: Optional[TextGuardDetector[PiiEntityResult]] = None
|
54
79
|
malicious_entity: Optional[TextGuardDetector[MaliciousEntityResult]] = None
|
80
|
+
secrets_detection: Optional[TextGuardDetector[SecretsEntityResult]] = None
|
81
|
+
profanity_and_toxicity: Optional[TextGuardDetector[Any]] = None
|
82
|
+
custom_entity: Optional[TextGuardDetector[Any]] = None
|
83
|
+
language_detection: Optional[TextGuardDetector[LanguageDetectionResult]] = None
|
84
|
+
code_detection: Optional[TextGuardDetector[CodeDetectionResult]] = None
|
55
85
|
|
56
86
|
|
57
87
|
class TextGuardResult(PangeaResponseResult, Generic[_T]):
|
@@ -64,6 +94,8 @@ class TextGuardResult(PangeaResponseResult, Generic[_T]):
|
|
64
94
|
prompt_messages: Optional[_T] = None
|
65
95
|
"""Updated structured prompt, if applicable."""
|
66
96
|
|
97
|
+
blocked: bool
|
98
|
+
|
67
99
|
|
68
100
|
class AIGuard(ServiceBase):
|
69
101
|
"""AI Guard service client.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: pangea-sdk
|
3
|
-
Version: 5.5.
|
3
|
+
Version: 5.5.0b2
|
4
4
|
Summary: Pangea API SDK
|
5
5
|
License: MIT
|
6
6
|
Keywords: Pangea,SDK,Audit
|
@@ -14,7 +14,7 @@ Requires-Dist: cryptography (>=43.0.3,<44.0.0)
|
|
14
14
|
Requires-Dist: deprecated (>=1.2.15,<2.0.0)
|
15
15
|
Requires-Dist: google-crc32c (>=1.5.0,<2.0.0)
|
16
16
|
Requires-Dist: pydantic (>=2.10.5,<3.0.0)
|
17
|
-
Requires-Dist: python-dateutil (>=2.9.0,<3.0.0)
|
17
|
+
Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
|
18
18
|
Requires-Dist: requests (>=2.31.0,<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)
|
@@ -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.0b2
|
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.0b2
|
73
73
|
```
|
74
74
|
|
75
75
|
## Usage
|
@@ -1,4 +1,4 @@
|
|
1
|
-
pangea/__init__.py,sha256=
|
1
|
+
pangea/__init__.py,sha256=KVhhIk-3aH5cvqxWeNcQMIHkrdG5FrODbZ9AG2Sj8ds,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
|
@@ -17,7 +17,7 @@ pangea/asyncio/services/sanitize.py,sha256=EbSdq_v9yZWce9xEYWvZharE9bJcxw8cg5Pv8
|
|
17
17
|
pangea/asyncio/services/share.py,sha256=AXXtFtmbXud0dAAom7qqHVOK9zBfX5S10MFS_1DQvio,30767
|
18
18
|
pangea/asyncio/services/vault.py,sha256=VqrJGSEdq6MlZRI6cJpkthhIsqLClSQdgVxwYCbIwEk,77079
|
19
19
|
pangea/audit_logger.py,sha256=gRkCfUUT5LDNaycwxkhZUySgY47jDfn1ZeKOul4XCQI,3842
|
20
|
-
pangea/config.py,sha256=
|
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=
|
31
|
+
pangea/services/ai_guard.py,sha256=sx2OYRxxVim2br4UorPAYrT3paidqzvy-dSyept-6SA,7860
|
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
|
@@ -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.0b2.dist-info/METADATA,sha256=QyRMHqmhVmQzTmhzY604kC_A76ADHX3fQnXzhklMrPE,7017
|
59
|
+
pangea_sdk-5.5.0b2.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
60
|
+
pangea_sdk-5.5.0b2.dist-info/RECORD,,
|
File without changes
|