pangea-sdk 5.3.0__py3-none-any.whl → 5.4.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/asyncio/request.py +12 -4
- pangea/asyncio/services/__init__.py +2 -0
- pangea/asyncio/services/ai_guard.py +75 -0
- pangea/asyncio/services/prompt_guard.py +76 -0
- pangea/asyncio/services/sanitize.py +1 -1
- pangea/request.py +9 -1
- pangea/services/__init__.py +2 -0
- pangea/services/ai_guard.py +128 -0
- pangea/services/prompt_guard.py +110 -0
- pangea/services/sanitize.py +1 -18
- {pangea_sdk-5.3.0.dist-info → pangea_sdk-5.4.0b2.dist-info}/METADATA +3 -3
- {pangea_sdk-5.3.0.dist-info → pangea_sdk-5.4.0b2.dist-info}/RECORD +14 -10
- {pangea_sdk-5.3.0.dist-info → pangea_sdk-5.4.0b2.dist-info}/WHEEL +0 -0
pangea/__init__.py
CHANGED
pangea/asyncio/request.py
CHANGED
@@ -5,11 +5,12 @@ from __future__ import annotations
|
|
5
5
|
import asyncio
|
6
6
|
import json
|
7
7
|
import time
|
8
|
-
from typing import
|
8
|
+
from typing import Dict, List, Optional, Sequence, Tuple, Type, Union, cast
|
9
9
|
|
10
10
|
import aiohttp
|
11
11
|
from aiohttp import FormData
|
12
12
|
from pydantic import BaseModel
|
13
|
+
from pydantic_core import to_jsonable_python
|
13
14
|
from typing_extensions import Any, TypeVar
|
14
15
|
|
15
16
|
import pangea.exceptions as pe
|
@@ -52,20 +53,27 @@ class PangeaRequestAsync(PangeaRequestBase):
|
|
52
53
|
if isinstance(data, BaseModel):
|
53
54
|
data = data.model_dump(exclude_none=True)
|
54
55
|
|
56
|
+
if isinstance(data, dict):
|
57
|
+
# Remove `None` values.
|
58
|
+
data = {k: v for k, v in data.items() if v is not None}
|
59
|
+
|
55
60
|
if data is None:
|
56
61
|
data = {}
|
57
62
|
|
63
|
+
# Normalize.
|
64
|
+
data = cast(dict[str, Any], to_jsonable_python(data))
|
65
|
+
|
58
66
|
if url is None:
|
59
67
|
url = self._url(endpoint)
|
60
68
|
|
61
69
|
# Set config ID if available
|
62
|
-
if self.config_id and data.get("config_id", None) is None:
|
63
|
-
data["config_id"] = self.config_id
|
70
|
+
if self.config_id and data.get("config_id", None) is None:
|
71
|
+
data["config_id"] = self.config_id
|
64
72
|
|
65
73
|
self.logger.debug(
|
66
74
|
json.dumps({"service": self.service, "action": "post", "url": url, "data": data}, default=default_encoder)
|
67
75
|
)
|
68
|
-
transfer_method = data.get("transfer_method", None)
|
76
|
+
transfer_method = data.get("transfer_method", None)
|
69
77
|
|
70
78
|
if files and type(data) is dict and (transfer_method == TransferMethod.POST_URL.value):
|
71
79
|
requests_response = await self._full_post_presigned_url(
|
@@ -1,9 +1,11 @@
|
|
1
|
+
from .ai_guard import AIGuardAsync
|
1
2
|
from .audit import AuditAsync
|
2
3
|
from .authn import AuthNAsync
|
3
4
|
from .authz import AuthZAsync
|
4
5
|
from .embargo import EmbargoAsync
|
5
6
|
from .file_scan import FileScanAsync
|
6
7
|
from .intel import DomainIntelAsync, FileIntelAsync, IpIntelAsync, UrlIntelAsync, UserIntelAsync
|
8
|
+
from .prompt_guard import PromptGuardAsync
|
7
9
|
from .redact import RedactAsync
|
8
10
|
from .sanitize import SanitizeAsync
|
9
11
|
from .share import ShareAsync
|
@@ -0,0 +1,75 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pangea.asyncio.services.base import ServiceBaseAsync
|
4
|
+
from pangea.config import PangeaConfig
|
5
|
+
from pangea.response import PangeaResponse
|
6
|
+
from pangea.services.ai_guard import TextGuardResult
|
7
|
+
|
8
|
+
|
9
|
+
class AIGuardAsync(ServiceBaseAsync):
|
10
|
+
"""AI Guard service client.
|
11
|
+
|
12
|
+
Provides methods to interact with Pangea's AI Guard service.
|
13
|
+
|
14
|
+
Examples:
|
15
|
+
from pangea import PangeaConfig
|
16
|
+
from pangea.asyncio.services import AIGuardAsync
|
17
|
+
|
18
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
19
|
+
ai_guard = AIGuardAsync(token="pangea_token", config=config)
|
20
|
+
"""
|
21
|
+
|
22
|
+
service_name = "ai-guard"
|
23
|
+
|
24
|
+
def __init__(
|
25
|
+
self, token: str, config: PangeaConfig | None = None, logger_name: str = "pangea", config_id: str | None = None
|
26
|
+
) -> None:
|
27
|
+
"""
|
28
|
+
AI Guard service client.
|
29
|
+
|
30
|
+
Initializes a new AI Guard client.
|
31
|
+
|
32
|
+
Args:
|
33
|
+
token: Pangea API token.
|
34
|
+
config: Pangea service configuration.
|
35
|
+
logger_name: Logger name.
|
36
|
+
config_id: Configuration ID.
|
37
|
+
|
38
|
+
Examples:
|
39
|
+
from pangea import PangeaConfig
|
40
|
+
from pangea.asyncio.services import AIGuardAsync
|
41
|
+
|
42
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
43
|
+
ai_guard = AIGuardAsync(token="pangea_token", config=config)
|
44
|
+
"""
|
45
|
+
|
46
|
+
super().__init__(token, config, logger_name, config_id)
|
47
|
+
|
48
|
+
async def guard_text(
|
49
|
+
self,
|
50
|
+
text: str,
|
51
|
+
*,
|
52
|
+
recipe: str = "pangea_prompt_guard",
|
53
|
+
debug: bool = False,
|
54
|
+
) -> PangeaResponse[TextGuardResult]:
|
55
|
+
"""
|
56
|
+
Text guard (Beta)
|
57
|
+
|
58
|
+
Guard text.
|
59
|
+
|
60
|
+
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
61
|
+
|
62
|
+
OperationId: ai_guard_post_v1beta_text_guard
|
63
|
+
|
64
|
+
Args:
|
65
|
+
text: Text.
|
66
|
+
recipe: Recipe.
|
67
|
+
debug: Debug.
|
68
|
+
|
69
|
+
Examples:
|
70
|
+
response = await ai_guard.guard_text("text")
|
71
|
+
"""
|
72
|
+
|
73
|
+
return await self.request.post(
|
74
|
+
"v1beta/text/guard", TextGuardResult, data={"text": text, "recipe": recipe, "debug": debug}
|
75
|
+
)
|
@@ -0,0 +1,76 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import TYPE_CHECKING
|
4
|
+
|
5
|
+
from pangea.asyncio.services.base import ServiceBaseAsync
|
6
|
+
from pangea.config import PangeaConfig
|
7
|
+
from pangea.services.prompt_guard import GuardResult, Message
|
8
|
+
|
9
|
+
if TYPE_CHECKING:
|
10
|
+
from collections.abc import Iterable
|
11
|
+
|
12
|
+
from pangea.response import PangeaResponse
|
13
|
+
|
14
|
+
|
15
|
+
class PromptGuardAsync(ServiceBaseAsync):
|
16
|
+
"""Prompt Guard service client.
|
17
|
+
|
18
|
+
Provides methods to interact with Pangea's Prompt Guard service.
|
19
|
+
|
20
|
+
Examples:
|
21
|
+
from pangea import PangeaConfig
|
22
|
+
from pangea.asyncio.services import PromptGuardAsync
|
23
|
+
|
24
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
25
|
+
prompt_guard = PromptGuardAsync(token="pangea_token", config=config)
|
26
|
+
"""
|
27
|
+
|
28
|
+
service_name = "prompt-guard"
|
29
|
+
|
30
|
+
def __init__(
|
31
|
+
self, token: str, config: PangeaConfig | None = None, logger_name: str = "pangea", config_id: str | None = None
|
32
|
+
) -> None:
|
33
|
+
"""
|
34
|
+
Prompt Guard service client.
|
35
|
+
|
36
|
+
Initializes a new Prompt Guard client.
|
37
|
+
|
38
|
+
Args:
|
39
|
+
token: Pangea API token.
|
40
|
+
config: Pangea service configuration.
|
41
|
+
logger_name: Logger name.
|
42
|
+
config_id: Configuration ID.
|
43
|
+
|
44
|
+
Examples:
|
45
|
+
from pangea import PangeaConfig
|
46
|
+
from pangea.asyncio.services import PromptGuardAsync
|
47
|
+
|
48
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
49
|
+
prompt_guard = PromptGuardAsync(token="pangea_token", config=config)
|
50
|
+
"""
|
51
|
+
|
52
|
+
super().__init__(token, config, logger_name, config_id)
|
53
|
+
|
54
|
+
async def guard(
|
55
|
+
self, messages: Iterable[Message], *, analyzers: Iterable[str] | None = None
|
56
|
+
) -> PangeaResponse[GuardResult]:
|
57
|
+
"""
|
58
|
+
Guard (Beta)
|
59
|
+
|
60
|
+
Guard messages.
|
61
|
+
|
62
|
+
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
63
|
+
|
64
|
+
OperationId: prompt_guard_post_v1beta_guard
|
65
|
+
|
66
|
+
Args:
|
67
|
+
messages: Messages.
|
68
|
+
analyzers: Specific analyzers to be used in the call.
|
69
|
+
|
70
|
+
Examples:
|
71
|
+
from pangea.asyncio.services.prompt_guard import Message
|
72
|
+
|
73
|
+
response = await prompt_guard.guard([Message(role="user", content="hello world")])
|
74
|
+
"""
|
75
|
+
|
76
|
+
return await self.request.post("v1beta/guard", GuardResult, data={"messages": messages, "analyzers": analyzers})
|
@@ -97,7 +97,7 @@ class SanitizeAsync(ServiceBaseAsync):
|
|
97
97
|
performed.
|
98
98
|
|
99
99
|
Examples:
|
100
|
-
with open("/path/to/file.
|
100
|
+
with open("/path/to/file.txt", "rb") as f:
|
101
101
|
response = await sanitize.sanitize(
|
102
102
|
file=f,
|
103
103
|
transfer_method=TransferMethod.POST_URL,
|
pangea/request.py
CHANGED
@@ -6,10 +6,11 @@ import copy
|
|
6
6
|
import json
|
7
7
|
import logging
|
8
8
|
import time
|
9
|
-
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Tuple, Type, Union
|
9
|
+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Tuple, Type, Union, cast
|
10
10
|
|
11
11
|
import requests
|
12
12
|
from pydantic import BaseModel
|
13
|
+
from pydantic_core import to_jsonable_python
|
13
14
|
from requests.adapters import HTTPAdapter, Retry
|
14
15
|
from requests_toolbelt import MultipartDecoder # type: ignore[import-untyped]
|
15
16
|
from typing_extensions import TypeVar
|
@@ -229,9 +230,16 @@ class PangeaRequest(PangeaRequestBase):
|
|
229
230
|
if isinstance(data, BaseModel):
|
230
231
|
data = data.model_dump(exclude_none=True)
|
231
232
|
|
233
|
+
if isinstance(data, dict):
|
234
|
+
# Remove `None` values.
|
235
|
+
data = {k: v for k, v in data.items() if v is not None}
|
236
|
+
|
232
237
|
if data is None:
|
233
238
|
data = {}
|
234
239
|
|
240
|
+
# Normalize.
|
241
|
+
data = cast(dict[str, Any], to_jsonable_python(data))
|
242
|
+
|
235
243
|
if url is None:
|
236
244
|
url = self._url(endpoint)
|
237
245
|
|
pangea/services/__init__.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
from .ai_guard import AIGuard
|
1
2
|
from .audit.audit import Audit
|
2
3
|
from .authn.authn import AuthN
|
3
4
|
from .authz import AuthZ
|
4
5
|
from .embargo import Embargo
|
5
6
|
from .file_scan import FileScan
|
6
7
|
from .intel import DomainIntel, FileIntel, IpIntel, UrlIntel, UserIntel
|
8
|
+
from .prompt_guard import PromptGuard
|
7
9
|
from .redact import Redact
|
8
10
|
from .sanitize import Sanitize
|
9
11
|
from .share.share import Share
|
@@ -0,0 +1,128 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Any, Dict, Generic, List, Optional, TypeVar
|
4
|
+
|
5
|
+
from pangea.config import PangeaConfig
|
6
|
+
from pangea.response import APIResponseModel, PangeaResponse, PangeaResponseResult
|
7
|
+
from pangea.services.base import ServiceBase
|
8
|
+
|
9
|
+
|
10
|
+
class AnalyzerResponse(APIResponseModel):
|
11
|
+
analyzer: str
|
12
|
+
confidence: float
|
13
|
+
|
14
|
+
|
15
|
+
class PromptInjectionResult(APIResponseModel):
|
16
|
+
analyzer_responses: List[AnalyzerResponse]
|
17
|
+
"""Triggered prompt injection analyzers."""
|
18
|
+
|
19
|
+
|
20
|
+
class PiiEntity(APIResponseModel):
|
21
|
+
type: str
|
22
|
+
value: str
|
23
|
+
redacted: bool
|
24
|
+
start_pos: Optional[int] = None
|
25
|
+
|
26
|
+
|
27
|
+
class PiiEntityResult(APIResponseModel):
|
28
|
+
entities: List[PiiEntity]
|
29
|
+
|
30
|
+
|
31
|
+
class MaliciousEntity(APIResponseModel):
|
32
|
+
type: str
|
33
|
+
value: str
|
34
|
+
redacted: Optional[bool] = None
|
35
|
+
start_pos: Optional[int] = None
|
36
|
+
raw: Optional[Dict[str, Any]] = None
|
37
|
+
|
38
|
+
|
39
|
+
class MaliciousEntityResult(APIResponseModel):
|
40
|
+
entities: List[MaliciousEntity]
|
41
|
+
|
42
|
+
|
43
|
+
T = TypeVar("T")
|
44
|
+
|
45
|
+
|
46
|
+
class TextGuardDetector(APIResponseModel, Generic[T]):
|
47
|
+
detected: bool
|
48
|
+
data: Optional[T] = None
|
49
|
+
|
50
|
+
|
51
|
+
class TextGuardDetectors(APIResponseModel):
|
52
|
+
prompt_injection: Optional[TextGuardDetector[PromptInjectionResult]] = None
|
53
|
+
pii_entity: Optional[TextGuardDetector[PiiEntityResult]] = None
|
54
|
+
malicious_entity: Optional[TextGuardDetector[MaliciousEntityResult]] = None
|
55
|
+
|
56
|
+
|
57
|
+
class TextGuardResult(PangeaResponseResult):
|
58
|
+
detectors: TextGuardDetectors
|
59
|
+
prompt: str
|
60
|
+
|
61
|
+
|
62
|
+
class AIGuard(ServiceBase):
|
63
|
+
"""AI Guard service client.
|
64
|
+
|
65
|
+
Provides methods to interact with Pangea's AI Guard service.
|
66
|
+
|
67
|
+
Examples:
|
68
|
+
from pangea import PangeaConfig
|
69
|
+
from pangea.services import AIGuard
|
70
|
+
|
71
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
72
|
+
ai_guard = AIGuard(token="pangea_token", config=config)
|
73
|
+
"""
|
74
|
+
|
75
|
+
service_name = "ai-guard"
|
76
|
+
|
77
|
+
def __init__(
|
78
|
+
self, token: str, config: PangeaConfig | None = None, logger_name: str = "pangea", config_id: str | None = None
|
79
|
+
) -> None:
|
80
|
+
"""
|
81
|
+
AI Guard service client.
|
82
|
+
|
83
|
+
Initializes a new AI Guard client.
|
84
|
+
|
85
|
+
Args:
|
86
|
+
token: Pangea API token.
|
87
|
+
config: Pangea service configuration.
|
88
|
+
logger_name: Logger name.
|
89
|
+
config_id: Configuration ID.
|
90
|
+
|
91
|
+
Examples:
|
92
|
+
from pangea import PangeaConfig
|
93
|
+
from pangea.services import AIGuard
|
94
|
+
|
95
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
96
|
+
ai_guard = AIGuard(token="pangea_token", config=config)
|
97
|
+
"""
|
98
|
+
|
99
|
+
super().__init__(token, config, logger_name, config_id)
|
100
|
+
|
101
|
+
def guard_text(
|
102
|
+
self,
|
103
|
+
text: str,
|
104
|
+
*,
|
105
|
+
recipe: str = "pangea_prompt_guard",
|
106
|
+
debug: bool = False,
|
107
|
+
) -> PangeaResponse[TextGuardResult]:
|
108
|
+
"""
|
109
|
+
Text guard (Beta)
|
110
|
+
|
111
|
+
Guard text.
|
112
|
+
|
113
|
+
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
114
|
+
|
115
|
+
OperationId: ai_guard_post_v1beta_text_guard
|
116
|
+
|
117
|
+
Args:
|
118
|
+
text: Text.
|
119
|
+
recipe: Recipe.
|
120
|
+
debug: Debug.
|
121
|
+
|
122
|
+
Examples:
|
123
|
+
response = ai_guard.guard_text("text")
|
124
|
+
"""
|
125
|
+
|
126
|
+
return self.request.post(
|
127
|
+
"v1beta/text/guard", TextGuardResult, data={"text": text, "recipe": recipe, "debug": debug}
|
128
|
+
)
|
@@ -0,0 +1,110 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import TYPE_CHECKING, Literal, Optional
|
4
|
+
|
5
|
+
from pangea.config import PangeaConfig
|
6
|
+
from pangea.response import APIRequestModel, APIResponseModel, PangeaResponse, PangeaResponseResult
|
7
|
+
from pangea.services.base import ServiceBase
|
8
|
+
|
9
|
+
if TYPE_CHECKING:
|
10
|
+
from collections.abc import Iterable
|
11
|
+
|
12
|
+
|
13
|
+
class Message(APIRequestModel):
|
14
|
+
role: str
|
15
|
+
content: str
|
16
|
+
|
17
|
+
|
18
|
+
class Classification(APIResponseModel):
|
19
|
+
category: str
|
20
|
+
"""Classification category"""
|
21
|
+
|
22
|
+
label: str
|
23
|
+
"""Classification label"""
|
24
|
+
|
25
|
+
confidence: float
|
26
|
+
"""Confidence score for the classification"""
|
27
|
+
|
28
|
+
|
29
|
+
class GuardResult(PangeaResponseResult):
|
30
|
+
detected: bool
|
31
|
+
"""Boolean response for if the prompt was considered malicious or not"""
|
32
|
+
|
33
|
+
type: Optional[Literal["direct", "indirect"]] = None
|
34
|
+
"""Type of analysis, either direct or indirect"""
|
35
|
+
|
36
|
+
analyzer: Optional[str] = None
|
37
|
+
"""Prompt Analyzers for identifying and rejecting properties of prompts"""
|
38
|
+
|
39
|
+
confidence: int
|
40
|
+
"""Percent of confidence in the detection result, ranging from 0 to 100"""
|
41
|
+
|
42
|
+
info: Optional[str] = None
|
43
|
+
"""Extra information about the detection result"""
|
44
|
+
|
45
|
+
classifications: list[Classification]
|
46
|
+
"""List of classification results with labels and confidence scores"""
|
47
|
+
|
48
|
+
|
49
|
+
class PromptGuard(ServiceBase):
|
50
|
+
"""Prompt Guard service client.
|
51
|
+
|
52
|
+
Provides methods to interact with Pangea's Prompt Guard service.
|
53
|
+
|
54
|
+
Examples:
|
55
|
+
from pangea import PangeaConfig
|
56
|
+
from pangea.services import PromptGuard
|
57
|
+
|
58
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
59
|
+
prompt_guard = PromptGuard(token="pangea_token", config=config)
|
60
|
+
"""
|
61
|
+
|
62
|
+
service_name = "prompt-guard"
|
63
|
+
|
64
|
+
def __init__(
|
65
|
+
self, token: str, config: PangeaConfig | None = None, logger_name: str = "pangea", config_id: str | None = None
|
66
|
+
) -> None:
|
67
|
+
"""
|
68
|
+
Prompt Guard service client.
|
69
|
+
|
70
|
+
Initializes a new Prompt Guard client.
|
71
|
+
|
72
|
+
Args:
|
73
|
+
token: Pangea API token.
|
74
|
+
config: Pangea service configuration.
|
75
|
+
logger_name: Logger name.
|
76
|
+
config_id: Configuration ID.
|
77
|
+
|
78
|
+
Examples:
|
79
|
+
from pangea import PangeaConfig
|
80
|
+
from pangea.services import PromptGuard
|
81
|
+
|
82
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
83
|
+
prompt_guard = PromptGuard(token="pangea_token", config=config)
|
84
|
+
"""
|
85
|
+
|
86
|
+
super().__init__(token, config, logger_name, config_id)
|
87
|
+
|
88
|
+
def guard(
|
89
|
+
self, messages: Iterable[Message], *, analyzers: Iterable[str] | None = None
|
90
|
+
) -> PangeaResponse[GuardResult]:
|
91
|
+
"""
|
92
|
+
Guard (Beta)
|
93
|
+
|
94
|
+
Guard messages.
|
95
|
+
|
96
|
+
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
97
|
+
|
98
|
+
OperationId: prompt_guard_post_v1beta_guard
|
99
|
+
|
100
|
+
Args:
|
101
|
+
messages: Prompt content and role array.
|
102
|
+
analyzers: Specific analyzers to be used in the call.
|
103
|
+
|
104
|
+
Examples:
|
105
|
+
from pangea.services.prompt_guard import Message
|
106
|
+
|
107
|
+
response = prompt_guard.guard([Message(role="user", content="hello world")])
|
108
|
+
"""
|
109
|
+
|
110
|
+
return self.request.post("v1beta/guard", GuardResult, data={"messages": messages, "analyzers": analyzers})
|
pangea/services/sanitize.py
CHANGED
@@ -46,12 +46,6 @@ class SanitizeContent(APIRequestModel):
|
|
46
46
|
analysis engine results. Only works if redact is enabled.
|
47
47
|
"""
|
48
48
|
|
49
|
-
remove_attachments: Optional[bool] = None
|
50
|
-
"""Remove file attachments (PDF only)."""
|
51
|
-
|
52
|
-
remove_interactive: Optional[bool] = None
|
53
|
-
"""Remove interactive content (PDF only)."""
|
54
|
-
|
55
49
|
|
56
50
|
class SanitizeShareOutput(APIRequestModel):
|
57
51
|
enabled: Optional[bool] = None
|
@@ -144,14 +138,6 @@ class RedactData(PangeaResponseResult):
|
|
144
138
|
"""The scoring result of a set of rules."""
|
145
139
|
|
146
140
|
|
147
|
-
class CDR(PangeaResponseResult):
|
148
|
-
file_attachments_removed: Optional[int] = None
|
149
|
-
"""Number of file attachments removed."""
|
150
|
-
|
151
|
-
interactive_contents_removed: Optional[int] = None
|
152
|
-
"""Number of interactive content items removed."""
|
153
|
-
|
154
|
-
|
155
141
|
class SanitizeData(PangeaResponseResult):
|
156
142
|
defang: Optional[DefangData] = None
|
157
143
|
"""Defang."""
|
@@ -162,9 +148,6 @@ class SanitizeData(PangeaResponseResult):
|
|
162
148
|
malicious_file: Optional[bool] = None
|
163
149
|
"""If the file scanned was malicious."""
|
164
150
|
|
165
|
-
cdr: Optional[CDR] = None
|
166
|
-
"""Content Disarm and Reconstruction."""
|
167
|
-
|
168
151
|
|
169
152
|
class SanitizeResult(PangeaResponseResult):
|
170
153
|
dest_url: Optional[str] = None
|
@@ -265,7 +248,7 @@ class Sanitize(ServiceBase):
|
|
265
248
|
performed.
|
266
249
|
|
267
250
|
Examples:
|
268
|
-
with open("/path/to/file.
|
251
|
+
with open("/path/to/file.txt", "rb") as f:
|
269
252
|
response = sanitize.sanitize(
|
270
253
|
file=f,
|
271
254
|
transfer_method=TransferMethod.POST_URL,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: pangea-sdk
|
3
|
-
Version: 5.
|
3
|
+
Version: 5.4.0b2
|
4
4
|
Summary: Pangea API SDK
|
5
5
|
License: MIT
|
6
6
|
Keywords: Pangea,SDK,Audit
|
@@ -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.
|
66
|
+
$ pip3 install pangea-sdk==5.4.0b2
|
67
67
|
```
|
68
68
|
|
69
69
|
Via poetry:
|
70
70
|
|
71
71
|
```bash
|
72
|
-
$ poetry add pangea-sdk==5.
|
72
|
+
$ poetry add pangea-sdk==5.4.0b2
|
73
73
|
```
|
74
74
|
|
75
75
|
## Usage
|
@@ -1,8 +1,9 @@
|
|
1
|
-
pangea/__init__.py,sha256=
|
1
|
+
pangea/__init__.py,sha256=D6T0FmtXtWk1W0BXPe9snPKzeo-dOtTEQHD3z5tFfxk,251
|
2
2
|
pangea/asyncio/__init__.py,sha256=kjEMkqMQ521LlMSu5jn3_WgweyArwVZ2C-s3x7mR6Pk,45
|
3
3
|
pangea/asyncio/file_uploader.py,sha256=wI7epib7Rc5jtZw4eJ1L1SlmutDG6CPv59C8N2UPhtY,1436
|
4
|
-
pangea/asyncio/request.py,sha256=
|
5
|
-
pangea/asyncio/services/__init__.py,sha256=
|
4
|
+
pangea/asyncio/request.py,sha256=lpLY-o405r3-VUfrAE5uxYxI8UjM4hjPqUzAUtOGE5o,18040
|
5
|
+
pangea/asyncio/services/__init__.py,sha256=L6Tdhjfx_ZECHskhLMPaCcOefi-r-imw6q_zlU4j-FY,464
|
6
|
+
pangea/asyncio/services/ai_guard.py,sha256=FxO8GRBztfOhpd7Kzj4-jWAiG0kb89-jVWL_AnbEou8,2142
|
6
7
|
pangea/asyncio/services/audit.py,sha256=rPaCx4cMzj-g9WFMRIysFCJAz6Btp6YrhcKe_exky8k,26283
|
7
8
|
pangea/asyncio/services/authn.py,sha256=rPeLJweL8mYH_t4ebcQn4n_Wglr3kClKNnCXNCimZU4,46622
|
8
9
|
pangea/asyncio/services/authz.py,sha256=B_0_nhDMJcjNpjpCx3Vi2LDRhlmfV9325GKbUZ8reos,10025
|
@@ -10,8 +11,9 @@ pangea/asyncio/services/base.py,sha256=vRFVcO_uEAGJte3OUUBLD43RoiiFB1vC7SPyN6yEM
|
|
10
11
|
pangea/asyncio/services/embargo.py,sha256=ctzj3kip6xos-Eu3JuOskrCGYC8T3JlsgAopZHiPSXM,3068
|
11
12
|
pangea/asyncio/services/file_scan.py,sha256=PLG1O-PL4Yk9uY9D6NbMrZ5LHg70Z311s7bFe46UMZA,7108
|
12
13
|
pangea/asyncio/services/intel.py,sha256=BcxGKSoZ1nJiEHyZM9yOwKSSPJUrB6ibJ19KR27VlgQ,40261
|
14
|
+
pangea/asyncio/services/prompt_guard.py,sha256=KMScsVybwQEwipN7CaC4AX4KRqlIkC8xZ2j7m-BDL9E,2349
|
13
15
|
pangea/asyncio/services/redact.py,sha256=JPJcmeKFloMZRpkjAHAZbpZJpO993WsTfEwA-S5ov18,7951
|
14
|
-
pangea/asyncio/services/sanitize.py,sha256=
|
16
|
+
pangea/asyncio/services/sanitize.py,sha256=EbSdq_v9yZWce9xEYWvZharE9bJcxw8cg5Pv8LVxdxc,8627
|
15
17
|
pangea/asyncio/services/share.py,sha256=AXXtFtmbXud0dAAom7qqHVOK9zBfX5S10MFS_1DQvio,30767
|
16
18
|
pangea/asyncio/services/vault.py,sha256=VqrJGSEdq6MlZRI6cJpkthhIsqLClSQdgVxwYCbIwEk,77079
|
17
19
|
pangea/audit_logger.py,sha256=gRkCfUUT5LDNaycwxkhZUySgY47jDfn1ZeKOul4XCQI,3842
|
@@ -23,9 +25,10 @@ pangea/dump_audit.py,sha256=IevqaUUh7GDepdIW7slSxeZbkPrWIVbcX3sr4DgpJXI,7090
|
|
23
25
|
pangea/exceptions.py,sha256=OBtzUECpNa6vNp8ySkHC-tm4QjFRCOAHBkMHqzAlOu8,5656
|
24
26
|
pangea/file_uploader.py,sha256=4RQ44xt-faApC61nn2PlwHT7XYrJ4GeQA8Ug4tySEAg,1227
|
25
27
|
pangea/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
|
-
pangea/request.py,sha256=
|
28
|
+
pangea/request.py,sha256=vGB8owXUiNQoeiiACFvfXvg44JJo_L6WfcHlF6ug8co,25082
|
27
29
|
pangea/response.py,sha256=lPAcYsF9Xg166CiyhCofVmQA-W4jevh0MQXxUa8Re68,7737
|
28
|
-
pangea/services/__init__.py,sha256
|
30
|
+
pangea/services/__init__.py,sha256=h36HzyIGaI5kO6l3UCwKHx_Kd-m_9mYVwn5MLRVzblI,408
|
31
|
+
pangea/services/ai_guard.py,sha256=-Ztyf9WUo1EB-gRzVH--OU62xzPoeVQ7BiFMTGUK5fI,3303
|
29
32
|
pangea/services/audit/audit.py,sha256=7-c9l7jyGtpG7SqRUMpqsAzcUDhMZ5izgPalxHXsUvM,39320
|
30
33
|
pangea/services/audit/exceptions.py,sha256=bhVuYe4ammacOVxwg98CChxvwZf5FKgR2DcgqILOcwc,471
|
31
34
|
pangea/services/audit/models.py,sha256=1h1B9eSYQMYG3f8WNi1UcDX2-impRrET_ErjJYUnj7M,14678
|
@@ -38,8 +41,9 @@ pangea/services/base.py,sha256=43pWQcR9CeT4sGzgctF3Sy4M_h7DaUzkuZD2Z7CcDUU,3845
|
|
38
41
|
pangea/services/embargo.py,sha256=9Wfku4td5ORaIENKmnGmS5jxJJIRfWp6Q51L36Jsy0I,3897
|
39
42
|
pangea/services/file_scan.py,sha256=QiO80uKqB_BnAOiYQKznXfxpa5j40qqETE3-zBRT_QE,7813
|
40
43
|
pangea/services/intel.py,sha256=y1EX2ctYIxQc52lmHp6-Q_UIDM--t3fOpXDssWiRPfo,56474
|
44
|
+
pangea/services/prompt_guard.py,sha256=k-b8ukyXaHruqC4S2NjFKhDLcvY5Wp8Ga0g_Ep3WFKY,3244
|
41
45
|
pangea/services/redact.py,sha256=ovIcT0jkXe57O7keGzSClWNCic8y-4NZoemXoSKjjww,12913
|
42
|
-
pangea/services/sanitize.py,sha256=
|
46
|
+
pangea/services/sanitize.py,sha256=eAN1HhObiKqygy6HHcfl0NmxYfPMvqSKepwEAVVIIEE,12936
|
43
47
|
pangea/services/share/file_format.py,sha256=1svO1ee_aenA9zoO_AaU-Rk5Ulp7kcPOc_KwNoluyQE,2797
|
44
48
|
pangea/services/share/share.py,sha256=b1Iuuog0XWXaI6rImoj0OeEx3DXbYqLWsLbCC_Zp6eg,52343
|
45
49
|
pangea/services/vault/models/asymmetric.py,sha256=vspijmEvHm5WXri_fjOWfQc4maYyZfhDkLuaTM8-PZo,4991
|
@@ -51,6 +55,6 @@ pangea/services/vault/vault.py,sha256=ow-Zm7PYzfWIfUcA4UNnpeL2DHfZM4C7inRDmNR3zQ
|
|
51
55
|
pangea/tools.py,sha256=2-Y4SAHWFv6Ocj42J_bWrVy27M5G3wi7a8LJn0dabHc,6427
|
52
56
|
pangea/utils.py,sha256=dZ6MwFVEWXUgXvvDg-k6JnvVfsgslvtaBd7ez7afrqk,4983
|
53
57
|
pangea/verify_audit.py,sha256=nSP17OzoSPdvezRExwfcf45H8ZPZnxZu-CbEp3qFJO0,17354
|
54
|
-
pangea_sdk-5.
|
55
|
-
pangea_sdk-5.
|
56
|
-
pangea_sdk-5.
|
58
|
+
pangea_sdk-5.4.0b2.dist-info/METADATA,sha256=7_vZ3tIafJ9-TdGTZphBcqHo0MQPqp-bNb4L870CwgU,6843
|
59
|
+
pangea_sdk-5.4.0b2.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
60
|
+
pangea_sdk-5.4.0b2.dist-info/RECORD,,
|
File without changes
|