pangea-sdk 5.2.0b1__py3-none-any.whl → 5.2.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/services/__init__.py +2 -0
- pangea/asyncio/services/ai_guard.py +75 -0
- pangea/asyncio/services/base.py +6 -1
- pangea/asyncio/services/prompt_guard.py +38 -4
- pangea/services/__init__.py +1 -1
- pangea/services/{data_guard.py → ai_guard.py} +42 -32
- pangea/services/base.py +2 -1
- pangea/services/prompt_guard.py +40 -5
- pangea/utils.py +8 -9
- {pangea_sdk-5.2.0b1.dist-info → pangea_sdk-5.2.0b2.dist-info}/METADATA +6 -5
- {pangea_sdk-5.2.0b1.dist-info → pangea_sdk-5.2.0b2.dist-info}/RECORD +13 -13
- pangea/asyncio/services/data_guard.py +0 -65
- {pangea_sdk-5.2.0b1.dist-info → pangea_sdk-5.2.0b2.dist-info}/WHEEL +0 -0
pangea/__init__.py
CHANGED
@@ -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
|
+
)
|
pangea/asyncio/services/base.py
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# Copyright 2022 Pangea Cyber Corporation
|
2
2
|
# Author: Pangea Cyber Corporation
|
3
|
+
from __future__ import annotations
|
3
4
|
|
4
5
|
from typing import Dict, Optional, Type, Union
|
5
6
|
|
7
|
+
from typing_extensions import override
|
8
|
+
|
6
9
|
from pangea.asyncio.request import PangeaRequestAsync
|
7
10
|
from pangea.exceptions import AcceptedRequestException
|
8
11
|
from pangea.response import AttachedFile, PangeaResponse, PangeaResponseResult
|
@@ -23,6 +26,7 @@ class ServiceBaseAsync(ServiceBase):
|
|
23
26
|
|
24
27
|
return self._request
|
25
28
|
|
29
|
+
@override
|
26
30
|
async def poll_result( # type: ignore[override]
|
27
31
|
self,
|
28
32
|
exception: Optional[AcceptedRequestException] = None,
|
@@ -36,7 +40,8 @@ class ServiceBaseAsync(ServiceBase):
|
|
36
40
|
Returns request's result that has been accepted by the server
|
37
41
|
|
38
42
|
Args:
|
39
|
-
exception
|
43
|
+
exception: Exception that was previously raised by the SDK on a call
|
44
|
+
that is being processed.
|
40
45
|
|
41
46
|
Returns:
|
42
47
|
PangeaResponse
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
3
3
|
from typing import TYPE_CHECKING
|
4
4
|
|
5
5
|
from pangea.asyncio.services.base import ServiceBaseAsync
|
6
|
+
from pangea.config import PangeaConfig
|
6
7
|
from pangea.services.prompt_guard import GuardResult, Message
|
7
8
|
|
8
9
|
if TYPE_CHECKING:
|
@@ -11,14 +12,45 @@ if TYPE_CHECKING:
|
|
11
12
|
from pangea.response import PangeaResponse
|
12
13
|
|
13
14
|
|
14
|
-
class
|
15
|
+
class PromptGuardAsync(ServiceBaseAsync):
|
15
16
|
"""Prompt Guard service client.
|
16
17
|
|
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)
|
18
26
|
"""
|
19
27
|
|
20
28
|
service_name = "prompt-guard"
|
21
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
|
+
|
22
54
|
async def guard(self, messages: Iterable[Message]) -> PangeaResponse[GuardResult]:
|
23
55
|
"""
|
24
56
|
Guard (Beta)
|
@@ -27,13 +59,15 @@ class PromptGuard(ServiceBaseAsync):
|
|
27
59
|
|
28
60
|
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
29
61
|
|
30
|
-
OperationId:
|
62
|
+
OperationId: prompt_guard_post_v1beta_guard
|
31
63
|
|
32
64
|
Args:
|
33
|
-
messages: Messages
|
65
|
+
messages: Messages.
|
34
66
|
|
35
67
|
Examples:
|
68
|
+
from pangea.asyncio.services.prompt_guard import Message
|
69
|
+
|
36
70
|
response = await prompt_guard.guard([Message(role="user", content="hello world")])
|
37
71
|
"""
|
38
72
|
|
39
|
-
return await self.request.post("
|
73
|
+
return await self.request.post("v1beta/guard", GuardResult, data={"messages": messages})
|
pangea/services/__init__.py
CHANGED
@@ -1,7 +1,7 @@
|
|
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
|
-
from .data_guard import DataGuard
|
5
5
|
from .embargo import Embargo
|
6
6
|
from .file_scan import FileScan
|
7
7
|
from .intel import DomainIntel, FileIntel, IpIntel, UrlIntel, UserIntel
|
@@ -4,6 +4,7 @@ from typing import List, Optional
|
|
4
4
|
|
5
5
|
from typing_extensions import Literal
|
6
6
|
|
7
|
+
from pangea.config import PangeaConfig
|
7
8
|
from pangea.response import PangeaResponse, PangeaResponseResult
|
8
9
|
from pangea.services.base import ServiceBase
|
9
10
|
from pangea.services.intel import UserBreachedData
|
@@ -14,12 +15,12 @@ class TextGuardSecurityIssues(PangeaResponseResult):
|
|
14
15
|
malicious_domain_count: int
|
15
16
|
malicious_ip_count: int
|
16
17
|
malicious_url_count: int
|
17
|
-
|
18
|
+
redact_rule_match_count: int
|
18
19
|
|
19
20
|
|
20
21
|
class TextGuardFindings(PangeaResponseResult):
|
21
|
-
artifact_count: int
|
22
|
-
malicious_count: int
|
22
|
+
artifact_count: Optional[int] = None
|
23
|
+
malicious_count: Optional[int] = None
|
23
24
|
security_issues: TextGuardSecurityIssues
|
24
25
|
|
25
26
|
|
@@ -87,13 +88,44 @@ class TextGuardResult(PangeaResponseResult):
|
|
87
88
|
report: Optional[TextGuardReport] = None
|
88
89
|
|
89
90
|
|
90
|
-
class
|
91
|
-
"""
|
91
|
+
class AIGuard(ServiceBase):
|
92
|
+
"""AI Guard service client.
|
92
93
|
|
93
|
-
Provides methods to interact with Pangea's
|
94
|
+
Provides methods to interact with Pangea's AI Guard service.
|
95
|
+
|
96
|
+
Examples:
|
97
|
+
from pangea import PangeaConfig
|
98
|
+
from pangea.services import AIGuard
|
99
|
+
|
100
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
101
|
+
ai_guard = AIGuard(token="pangea_token", config=config)
|
94
102
|
"""
|
95
103
|
|
96
|
-
service_name = "
|
104
|
+
service_name = "ai-guard"
|
105
|
+
|
106
|
+
def __init__(
|
107
|
+
self, token: str, config: PangeaConfig | None = None, logger_name: str = "pangea", config_id: str | None = None
|
108
|
+
) -> None:
|
109
|
+
"""
|
110
|
+
AI Guard service client.
|
111
|
+
|
112
|
+
Initializes a new AI Guard client.
|
113
|
+
|
114
|
+
Args:
|
115
|
+
token: Pangea API token.
|
116
|
+
config: Pangea service configuration.
|
117
|
+
logger_name: Logger name.
|
118
|
+
config_id: Configuration ID.
|
119
|
+
|
120
|
+
Examples:
|
121
|
+
from pangea import PangeaConfig
|
122
|
+
from pangea.services import AIGuard
|
123
|
+
|
124
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
125
|
+
ai_guard = AIGuard(token="pangea_token", config=config)
|
126
|
+
"""
|
127
|
+
|
128
|
+
super().__init__(token, config, logger_name, config_id)
|
97
129
|
|
98
130
|
def guard_text(
|
99
131
|
self,
|
@@ -109,7 +141,7 @@ class DataGuard(ServiceBase):
|
|
109
141
|
|
110
142
|
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
111
143
|
|
112
|
-
OperationId:
|
144
|
+
OperationId: ai_guard_post_v1beta_text_guard
|
113
145
|
|
114
146
|
Args:
|
115
147
|
text: Text.
|
@@ -117,31 +149,9 @@ class DataGuard(ServiceBase):
|
|
117
149
|
debug: Debug.
|
118
150
|
|
119
151
|
Examples:
|
120
|
-
response =
|
152
|
+
response = ai_guard.guard_text("text")
|
121
153
|
"""
|
122
154
|
|
123
155
|
return self.request.post(
|
124
|
-
"
|
156
|
+
"v1beta/text/guard", TextGuardResult, data={"text": text, "recipe": recipe, "debug": debug}
|
125
157
|
)
|
126
|
-
|
127
|
-
def guard_file(
|
128
|
-
self,
|
129
|
-
file_url: str,
|
130
|
-
) -> PangeaResponse[PangeaResponseResult]:
|
131
|
-
"""
|
132
|
-
File guard (Beta)
|
133
|
-
|
134
|
-
Guard a file URL.
|
135
|
-
|
136
|
-
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
137
|
-
|
138
|
-
OperationId: data_guard_post_v1_file_guard
|
139
|
-
|
140
|
-
Args:
|
141
|
-
file_url: File URL.
|
142
|
-
|
143
|
-
Examples:
|
144
|
-
response = data_guard.guard_file("https://example.org/file.txt")
|
145
|
-
"""
|
146
|
-
|
147
|
-
return self.request.post("v1/file/guard", PangeaResponseResult, data={"file_url": file_url})
|
pangea/services/base.py
CHANGED
@@ -80,7 +80,8 @@ class ServiceBase(object):
|
|
80
80
|
Returns request's result that has been accepted by the server
|
81
81
|
|
82
82
|
Args:
|
83
|
-
exception
|
83
|
+
exception: Exception that was previously raised by the SDK on a call
|
84
|
+
that is being processed.
|
84
85
|
|
85
86
|
Returns:
|
86
87
|
PangeaResponse
|
pangea/services/prompt_guard.py
CHANGED
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
from typing import TYPE_CHECKING, Optional
|
4
4
|
|
5
|
+
from pangea.config import PangeaConfig
|
5
6
|
from pangea.response import APIRequestModel, PangeaResponse, PangeaResponseResult
|
6
7
|
from pangea.services.base import ServiceBase
|
7
8
|
|
@@ -15,19 +16,51 @@ class Message(APIRequestModel):
|
|
15
16
|
|
16
17
|
|
17
18
|
class GuardResult(PangeaResponseResult):
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
detected: bool
|
20
|
+
type: Optional[str] = None
|
21
|
+
detector: Optional[str] = None
|
22
|
+
confidence: int
|
21
23
|
|
22
24
|
|
23
25
|
class PromptGuard(ServiceBase):
|
24
26
|
"""Prompt Guard service client.
|
25
27
|
|
26
28
|
Provides methods to interact with Pangea's Prompt Guard service.
|
29
|
+
|
30
|
+
Examples:
|
31
|
+
from pangea import PangeaConfig
|
32
|
+
from pangea.services import PromptGuard
|
33
|
+
|
34
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
35
|
+
prompt_guard = PromptGuard(token="pangea_token", config=config)
|
27
36
|
"""
|
28
37
|
|
29
38
|
service_name = "prompt-guard"
|
30
39
|
|
40
|
+
def __init__(
|
41
|
+
self, token: str, config: PangeaConfig | None = None, logger_name: str = "pangea", config_id: str | None = None
|
42
|
+
) -> None:
|
43
|
+
"""
|
44
|
+
Prompt Guard service client.
|
45
|
+
|
46
|
+
Initializes a new Prompt Guard client.
|
47
|
+
|
48
|
+
Args:
|
49
|
+
token: Pangea API token.
|
50
|
+
config: Pangea service configuration.
|
51
|
+
logger_name: Logger name.
|
52
|
+
config_id: Configuration ID.
|
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
|
+
super().__init__(token, config, logger_name, config_id)
|
63
|
+
|
31
64
|
def guard(self, messages: Iterable[Message]) -> PangeaResponse[GuardResult]:
|
32
65
|
"""
|
33
66
|
Guard (Beta)
|
@@ -36,13 +69,15 @@ class PromptGuard(ServiceBase):
|
|
36
69
|
|
37
70
|
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
38
71
|
|
39
|
-
OperationId:
|
72
|
+
OperationId: prompt_guard_post_v1beta_guard
|
40
73
|
|
41
74
|
Args:
|
42
75
|
messages: Messages.
|
43
76
|
|
44
77
|
Examples:
|
78
|
+
from pangea.services.prompt_guard import Message
|
79
|
+
|
45
80
|
response = prompt_guard.guard([Message(role="user", content="hello world")])
|
46
81
|
"""
|
47
82
|
|
48
|
-
return self.request.post("
|
83
|
+
return self.request.post("v1beta/guard", GuardResult, data={"messages": messages})
|
pangea/utils.py
CHANGED
@@ -6,7 +6,6 @@ import datetime
|
|
6
6
|
import io
|
7
7
|
import json
|
8
8
|
from hashlib import md5, new, sha1, sha256, sha512
|
9
|
-
from typing import Union
|
10
9
|
|
11
10
|
from google_crc32c import Checksum as CRC32C
|
12
11
|
from pydantic import BaseModel
|
@@ -67,7 +66,7 @@ def canonicalize(data: dict) -> str:
|
|
67
66
|
return str(data)
|
68
67
|
|
69
68
|
|
70
|
-
def hash_sha256(input:
|
69
|
+
def hash_sha256(input: str | io.BufferedReader) -> str:
|
71
70
|
# Return SHA256 hash in hex format
|
72
71
|
hash = sha256()
|
73
72
|
if isinstance(input, io.BufferedReader):
|
@@ -80,12 +79,12 @@ def hash_sha256(input: Union[str, io.BufferedReader]) -> str:
|
|
80
79
|
|
81
80
|
input.seek(0) # restart reading
|
82
81
|
else:
|
83
|
-
hash.update(input)
|
82
|
+
hash.update(input.encode("utf-8"))
|
84
83
|
|
85
84
|
return hash.hexdigest()
|
86
85
|
|
87
86
|
|
88
|
-
def hash_sha1(input:
|
87
|
+
def hash_sha1(input: str | io.BufferedReader) -> str:
|
89
88
|
# Return SHA1 hash in hex format
|
90
89
|
hash = sha1()
|
91
90
|
if isinstance(input, io.BufferedReader):
|
@@ -98,12 +97,12 @@ def hash_sha1(input: Union[str, io.BufferedReader]) -> str:
|
|
98
97
|
|
99
98
|
input.seek(0) # restart reading
|
100
99
|
else:
|
101
|
-
hash.update(input)
|
100
|
+
hash.update(input.encode("utf-8"))
|
102
101
|
|
103
102
|
return hash.hexdigest()
|
104
103
|
|
105
104
|
|
106
|
-
def hash_sha512(input:
|
105
|
+
def hash_sha512(input: str | io.BufferedReader) -> str:
|
107
106
|
# Return SHA512 hash in hex format
|
108
107
|
hash = sha512()
|
109
108
|
if isinstance(input, io.BufferedReader):
|
@@ -116,7 +115,7 @@ def hash_sha512(input: Union[str, io.BufferedReader]) -> str:
|
|
116
115
|
|
117
116
|
input.seek(0) # restart reading
|
118
117
|
else:
|
119
|
-
hash.update(input)
|
118
|
+
hash.update(input.encode("utf-8"))
|
120
119
|
|
121
120
|
return hash.hexdigest()
|
122
121
|
|
@@ -126,7 +125,7 @@ def hash_ntlm(data: str) -> str:
|
|
126
125
|
return new("md4", data.encode("utf-16le")).hexdigest()
|
127
126
|
|
128
127
|
|
129
|
-
def hash_md5(input:
|
128
|
+
def hash_md5(input: str | io.BufferedReader) -> str:
|
130
129
|
# Return MD5 hash in hex format
|
131
130
|
hash = md5()
|
132
131
|
if isinstance(input, io.BufferedReader):
|
@@ -140,7 +139,7 @@ def hash_md5(input: Union[str, io.BufferedReader]) -> str:
|
|
140
139
|
|
141
140
|
input.seek(0) # restart reading
|
142
141
|
else:
|
143
|
-
hash.update(input)
|
142
|
+
hash.update(input.encode("utf-8"))
|
144
143
|
|
145
144
|
return hash.hexdigest()
|
146
145
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pangea-sdk
|
3
|
-
Version: 5.2.
|
3
|
+
Version: 5.2.0b2
|
4
4
|
Summary: Pangea API SDK
|
5
5
|
Home-page: https://pangea.cloud/docs/sdk/python/
|
6
6
|
License: MIT
|
@@ -18,7 +18,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
18
18
|
Classifier: Topic :: Software Development
|
19
19
|
Classifier: Topic :: Software Development :: Libraries
|
20
20
|
Requires-Dist: aiohttp (>=3.10.10,<4.0.0)
|
21
|
-
Requires-Dist: cryptography (>=43.0.
|
21
|
+
Requires-Dist: cryptography (>=43.0.3,<44.0.0)
|
22
22
|
Requires-Dist: deprecated (>=1.2.14,<2.0.0)
|
23
23
|
Requires-Dist: google-crc32c (>=1.5.0,<2.0.0)
|
24
24
|
Requires-Dist: pydantic (>=2.9.2,<3.0.0)
|
@@ -64,9 +64,10 @@ $ poetry add pangea-sdk
|
|
64
64
|
#### Beta releases
|
65
65
|
|
66
66
|
Pre-release versions may be available with the `b` (beta) denotation in the
|
67
|
-
version number. These releases serve to preview
|
68
|
-
Semantic Versioning, they are considered unstable and do not carry
|
69
|
-
compatibility guarantees as stable releases.
|
67
|
+
version number. These releases serve to preview Beta and Early Access services
|
68
|
+
and APIs. Per Semantic Versioning, they are considered unstable and do not carry
|
69
|
+
the same compatibility guarantees as stable releases.
|
70
|
+
[Beta changelog](https://github.com/pangeacyber/pangea-python/blob/beta/CHANGELOG.md).
|
70
71
|
|
71
72
|
Via pip:
|
72
73
|
|
@@ -1,17 +1,17 @@
|
|
1
|
-
pangea/__init__.py,sha256=
|
1
|
+
pangea/__init__.py,sha256=YW7Y-Lb2D13OAwVGQH3AL6xmqtVbLjqDaQFROwi_Yd4,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=Pwk3dAzO_A7I1NyrIqK5V80xvtAL80KiNSjbrXjzQzA,17519
|
5
|
-
pangea/asyncio/services/__init__.py,sha256=
|
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=bZ7gdkVWkzqLqUVc1Wnf3oDAaCLg97-zTWhY8UdX0_Y,26549
|
7
8
|
pangea/asyncio/services/authn.py,sha256=rPeLJweL8mYH_t4ebcQn4n_Wglr3kClKNnCXNCimZU4,46622
|
8
9
|
pangea/asyncio/services/authz.py,sha256=HgW9R8DeW19wS7fpgq0NWOx41wZWcn6NYS4NMbi8p1A,9482
|
9
|
-
pangea/asyncio/services/base.py,sha256=
|
10
|
-
pangea/asyncio/services/data_guard.py,sha256=f6VzZCcfAHpttCjqt5SExtbsrH1HkIRFmZ2c3nRlcwU,1713
|
10
|
+
pangea/asyncio/services/base.py,sha256=1_W3ImEdH5C3rGynC_JWeKx1E2X9HHvUWBa5uRiZFNM,2763
|
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=cCm3VwWxUzEUCNhuPCeejJvr4uOeLXuYDbDwTzNG6Aw,38121
|
14
|
-
pangea/asyncio/services/prompt_guard.py,sha256=
|
14
|
+
pangea/asyncio/services/prompt_guard.py,sha256=gRh7Z-ZS21EN8vXXnK1OJ5kYvmOWxKppia8tZYeuhmM,2202
|
15
15
|
pangea/asyncio/services/redact.py,sha256=jRNtXr_DZ_cY7guhut-eZmOEhy2uN_VCXrjGH6bkh74,7265
|
16
16
|
pangea/asyncio/services/sanitize.py,sha256=bf98J-s-P51oSKqNBgR0wj5mlHOCBwpjWz7k0NdXCKQ,7899
|
17
17
|
pangea/asyncio/services/share.py,sha256=UYJeUKA3NLSFA8R0X7B6yBi2U1g4q04O4ftrp9SMCzA,26097
|
@@ -27,7 +27,8 @@ pangea/file_uploader.py,sha256=4RQ44xt-faApC61nn2PlwHT7XYrJ4GeQA8Ug4tySEAg,1227
|
|
27
27
|
pangea/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
28
|
pangea/request.py,sha256=ZRH4NCnbzjpzkcNnOomelK5uB49T_20PfHP_j4Swgmw,24545
|
29
29
|
pangea/response.py,sha256=lPAcYsF9Xg166CiyhCofVmQA-W4jevh0MQXxUa8Re68,7737
|
30
|
-
pangea/services/__init__.py,sha256=
|
30
|
+
pangea/services/__init__.py,sha256=h36HzyIGaI5kO6l3UCwKHx_Kd-m_9mYVwn5MLRVzblI,408
|
31
|
+
pangea/services/ai_guard.py,sha256=W9OxmqQiC2ymDWAoE8FK3_8prDTQhHR8lz4xE81tlMM,4157
|
31
32
|
pangea/services/audit/audit.py,sha256=IFv7jANA8S2SypQVS47x94_Cr5Z9zSsL9Dp9eXw9RHk,39593
|
32
33
|
pangea/services/audit/exceptions.py,sha256=bhVuYe4ammacOVxwg98CChxvwZf5FKgR2DcgqILOcwc,471
|
33
34
|
pangea/services/audit/models.py,sha256=1h1B9eSYQMYG3f8WNi1UcDX2-impRrET_ErjJYUnj7M,14678
|
@@ -36,12 +37,11 @@ pangea/services/audit/util.py,sha256=Zq1qvfeplYfhCP_ud5YMvntSB0UvnCdsuYbOzZkHbjg
|
|
36
37
|
pangea/services/authn/authn.py,sha256=cZKl2Ixc6HwHnkRecpSaAGTQUgaZUtxfLa0T3S03HMs,45478
|
37
38
|
pangea/services/authn/models.py,sha256=HH5su6jx3O9AwVGzASXZ99-eIWjgXEP5LhIVdewM13s,22394
|
38
39
|
pangea/services/authz.py,sha256=HfDnovAokzAHvnjYdOCwceM-1sCmzODnjNEbQBUSfo8,12222
|
39
|
-
pangea/services/base.py,sha256=
|
40
|
-
pangea/services/data_guard.py,sha256=CzJ4Q-aakmWm8NhaWNWkT0QA6zFlyY49j2yerGOPUmc,3689
|
40
|
+
pangea/services/base.py,sha256=nnVVzw6Y_hej5Vcy0WvN_CR0BG_U5F5k_XTNiBX1we0,3464
|
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=CziBhC5K6O_kBXpD8zgJLpDtLHzBRgATGW4gHHFJT48,52039
|
44
|
-
pangea/services/prompt_guard.py,sha256=
|
44
|
+
pangea/services/prompt_guard.py,sha256=baaYbYW_HoZJNB8NCIxxFjvJelqrl9UOtWa10-N1jgg,2312
|
45
45
|
pangea/services/redact.py,sha256=ZYXkzEoriLJyCqaj5dqmgsC56mIz4T3pPToZ7TcNfhg,11465
|
46
46
|
pangea/services/sanitize.py,sha256=XP5D4CcbCZfzgU567X6H5eFBWwZuYSsHdvsdrQAZekY,12767
|
47
47
|
pangea/services/share/file_format.py,sha256=1svO1ee_aenA9zoO_AaU-Rk5Ulp7kcPOc_KwNoluyQE,2797
|
@@ -53,8 +53,8 @@ pangea/services/vault/models/secret.py,sha256=ItGdkulM-SEySfcm4a5yGxMvo_omjC7kCh
|
|
53
53
|
pangea/services/vault/models/symmetric.py,sha256=t8xCM1wGGKDBpOqTggFueO4-4-2IFmyxqcs7_PDr7U0,2562
|
54
54
|
pangea/services/vault/vault.py,sha256=ow-Zm7PYzfWIfUcA4UNnpeL2DHfZM4C7inRDmNR3zQU,76196
|
55
55
|
pangea/tools.py,sha256=2-Y4SAHWFv6Ocj42J_bWrVy27M5G3wi7a8LJn0dabHc,6427
|
56
|
-
pangea/utils.py,sha256=
|
56
|
+
pangea/utils.py,sha256=dZ6MwFVEWXUgXvvDg-k6JnvVfsgslvtaBd7ez7afrqk,4983
|
57
57
|
pangea/verify_audit.py,sha256=nSP17OzoSPdvezRExwfcf45H8ZPZnxZu-CbEp3qFJO0,17354
|
58
|
-
pangea_sdk-5.2.
|
59
|
-
pangea_sdk-5.2.
|
60
|
-
pangea_sdk-5.2.
|
58
|
+
pangea_sdk-5.2.0b2.dist-info/METADATA,sha256=j_pSOR8g6RfcYWO7D9lQhISqYHPzfUlc5VSFFYW1elo,7514
|
59
|
+
pangea_sdk-5.2.0b2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
60
|
+
pangea_sdk-5.2.0b2.dist-info/RECORD,,
|
@@ -1,65 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
from pangea.asyncio.services.base import ServiceBaseAsync
|
4
|
-
from pangea.response import PangeaResponse, PangeaResponseResult
|
5
|
-
from pangea.services.data_guard import TextGuardResult
|
6
|
-
|
7
|
-
|
8
|
-
class DataGuard(ServiceBaseAsync):
|
9
|
-
"""Data Guard service client.
|
10
|
-
|
11
|
-
Provides methods to interact with Pangea's Data Guard service.
|
12
|
-
"""
|
13
|
-
|
14
|
-
service_name = "data-guard"
|
15
|
-
|
16
|
-
async def guard_text(
|
17
|
-
self,
|
18
|
-
text: str,
|
19
|
-
*,
|
20
|
-
recipe: str = "pangea_prompt_guard",
|
21
|
-
debug: bool = False,
|
22
|
-
) -> PangeaResponse[TextGuardResult]:
|
23
|
-
"""
|
24
|
-
Text guard (Beta)
|
25
|
-
|
26
|
-
Guard text.
|
27
|
-
|
28
|
-
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
29
|
-
|
30
|
-
OperationId: data_guard_post_v1_text_guard
|
31
|
-
|
32
|
-
Args:
|
33
|
-
text: Text.
|
34
|
-
recipe: Recipe.
|
35
|
-
debug: Debug.
|
36
|
-
|
37
|
-
Examples:
|
38
|
-
response = await data_guard.guard_text("text")
|
39
|
-
"""
|
40
|
-
|
41
|
-
return await self.request.post(
|
42
|
-
"v1/text/guard", TextGuardResult, data={"text": text, "recipe": recipe, "debug": debug}
|
43
|
-
)
|
44
|
-
|
45
|
-
async def guard_file(
|
46
|
-
self,
|
47
|
-
file_url: str,
|
48
|
-
) -> PangeaResponse[PangeaResponseResult]:
|
49
|
-
"""
|
50
|
-
File guard (Beta)
|
51
|
-
|
52
|
-
Guard a file URL.
|
53
|
-
|
54
|
-
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
55
|
-
|
56
|
-
OperationId: data_guard_post_v1_file_guard
|
57
|
-
|
58
|
-
Args:
|
59
|
-
file_url: File URL.
|
60
|
-
|
61
|
-
Examples:
|
62
|
-
response = await data_guard.guard_file("https://example.org/file.txt")
|
63
|
-
"""
|
64
|
-
|
65
|
-
return await self.request.post("v1/file/guard", PangeaResponseResult, data={"file_url": file_url})
|
File without changes
|