pangea-sdk 6.3.0__tar.gz → 6.4.0__tar.gz
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_sdk-6.3.0 → pangea_sdk-6.4.0}/PKG-INFO +1 -1
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/__init__.py +1 -1
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/ai_guard.py +31 -29
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/ai_guard.py +84 -60
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pyproject.toml +3 -3
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/README.md +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/__init__.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/file_uploader.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/request.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/__init__.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/audit.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/authn.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/authz.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/base.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/embargo.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/file_scan.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/intel.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/prompt_guard.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/redact.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/sanitize.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/share.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/asyncio/services/vault.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/audit_logger.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/config.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/crypto/rsa.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/deep_verify.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/deprecated.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/dump_audit.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/exceptions.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/file_uploader.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/py.typed +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/request.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/response.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/__init__.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/audit/audit.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/audit/exceptions.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/audit/models.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/audit/signing.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/audit/util.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/authn/authn.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/authn/models.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/authz.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/base.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/embargo.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/file_scan.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/intel.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/prompt_guard.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/redact.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/sanitize.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/share/file_format.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/share/share.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/vault/models/asymmetric.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/vault/models/common.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/vault/models/keys.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/vault/models/secret.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/vault/models/symmetric.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/services/vault/vault.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/tools.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/utils.py +0 -0
- {pangea_sdk-6.3.0 → pangea_sdk-6.4.0}/pangea/verify_audit.py +0 -0
@@ -15,11 +15,9 @@ class AIGuardAsync(ServiceBaseAsync):
|
|
15
15
|
Provides methods to interact with Pangea's AI Guard service.
|
16
16
|
|
17
17
|
Examples:
|
18
|
-
from pangea import PangeaConfig
|
19
18
|
from pangea.asyncio.services import AIGuardAsync
|
20
19
|
|
21
|
-
|
22
|
-
ai_guard = AIGuardAsync(token="pangea_token", config=config)
|
20
|
+
ai_guard = AIGuardAsync(token="pangea_token")
|
23
21
|
"""
|
24
22
|
|
25
23
|
service_name = "ai-guard"
|
@@ -39,11 +37,9 @@ class AIGuardAsync(ServiceBaseAsync):
|
|
39
37
|
config_id: Configuration ID.
|
40
38
|
|
41
39
|
Examples:
|
42
|
-
from pangea import PangeaConfig
|
43
40
|
from pangea.asyncio.services import AIGuardAsync
|
44
41
|
|
45
|
-
|
46
|
-
ai_guard = AIGuardAsync(token="pangea_token", config=config)
|
42
|
+
ai_guard = AIGuardAsync(token="pangea_token")
|
47
43
|
"""
|
48
44
|
|
49
45
|
super().__init__(token, config, logger_name, config_id)
|
@@ -53,29 +49,31 @@ class AIGuardAsync(ServiceBaseAsync):
|
|
53
49
|
self,
|
54
50
|
text: str,
|
55
51
|
*,
|
56
|
-
recipe: str | None = None,
|
57
52
|
debug: bool | None = None,
|
58
|
-
overrides: Overrides | None = None,
|
59
53
|
log_fields: LogFields | None = None,
|
54
|
+
overrides: Overrides | None = None,
|
55
|
+
recipe: str | None = None,
|
60
56
|
) -> PangeaResponse[TextGuardResult]:
|
61
57
|
"""
|
62
|
-
|
58
|
+
Guard LLM input and output text
|
63
59
|
|
64
|
-
|
65
|
-
|
60
|
+
Detect, remove, or block malicious content and intent in LLM inputs and
|
61
|
+
outputs to prevent model manipulation and data leakage.
|
66
62
|
|
67
63
|
OperationId: ai_guard_post_v1_text_guard
|
68
64
|
|
69
65
|
Args:
|
70
66
|
text: Text to be scanned by AI Guard for PII, sensitive data,
|
71
67
|
malicious content, and other data types defined by the
|
72
|
-
configuration. Supports processing up to
|
73
|
-
recipe: Recipe key of a configuration of data types and settings
|
74
|
-
defined in the Pangea User Console. It specifies the rules that
|
75
|
-
are to be applied to the text, such as defang malicious URLs.
|
68
|
+
configuration. Supports processing up to 20 KiB of text.
|
76
69
|
debug: Setting this value to true will provide a detailed analysis
|
77
70
|
of the text data
|
78
71
|
log_field: Additional fields to include in activity log
|
72
|
+
overrides: Overrides flags. Note: This parameter has no effect when
|
73
|
+
the request is made by AIDR
|
74
|
+
recipe: Recipe key of a configuration of data types and settings
|
75
|
+
defined in the Pangea User Console. It specifies the rules that
|
76
|
+
are to be applied to the text, such as defang malicious URLs.
|
79
77
|
|
80
78
|
Examples:
|
81
79
|
response = await ai_guard.guard_text("text")
|
@@ -92,24 +90,26 @@ class AIGuardAsync(ServiceBaseAsync):
|
|
92
90
|
log_fields: LogFields | None = None,
|
93
91
|
) -> PangeaResponse[TextGuardResult]:
|
94
92
|
"""
|
95
|
-
|
93
|
+
Guard LLM input and output text
|
96
94
|
|
97
|
-
|
98
|
-
|
95
|
+
Detect, remove, or block malicious content and intent in LLM inputs and
|
96
|
+
outputs to prevent model manipulation and data leakage.
|
99
97
|
|
100
98
|
OperationId: ai_guard_post_v1_text_guard
|
101
99
|
|
102
100
|
Args:
|
103
101
|
messages: Structured messages data to be scanned by AI Guard for
|
104
102
|
PII, sensitive data, malicious content, and other data types
|
105
|
-
defined by the configuration. Supports processing up to
|
106
|
-
JSON text
|
107
|
-
recipe: Recipe key of a configuration of data types and settings
|
108
|
-
defined in the Pangea User Console. It specifies the rules that
|
109
|
-
are to be applied to the text, such as defang malicious URLs.
|
103
|
+
defined by the configuration. Supports processing up to 20 KiB
|
104
|
+
of JSON text using Pangea message format.
|
110
105
|
debug: Setting this value to true will provide a detailed analysis
|
111
106
|
of the text data
|
112
107
|
log_field: Additional fields to include in activity log
|
108
|
+
overrides: Overrides flags. Note: This parameter has no effect when
|
109
|
+
the request is made by AIDR
|
110
|
+
recipe: Recipe key of a configuration of data types and settings
|
111
|
+
defined in the Pangea User Console. It specifies the rules that
|
112
|
+
are to be applied to the text, such as defang malicious URLs.
|
113
113
|
|
114
114
|
Examples:
|
115
115
|
response = await ai_guard.guard_text(messages=[Message(role="user", content="hello world")])
|
@@ -126,10 +126,10 @@ class AIGuardAsync(ServiceBaseAsync):
|
|
126
126
|
log_fields: LogFields | None = None,
|
127
127
|
) -> PangeaResponse[TextGuardResult]:
|
128
128
|
"""
|
129
|
-
|
129
|
+
Guard LLM input and output text
|
130
130
|
|
131
|
-
|
132
|
-
|
131
|
+
Detect, remove, or block malicious content and intent in LLM inputs and
|
132
|
+
outputs to prevent model manipulation and data leakage.
|
133
133
|
|
134
134
|
OperationId: ai_guard_post_v1_text_guard
|
135
135
|
|
@@ -141,12 +141,14 @@ class AIGuardAsync(ServiceBaseAsync):
|
|
141
141
|
PII, sensitive data, malicious content, and other data types
|
142
142
|
defined by the configuration. Supports processing up to 10KB of
|
143
143
|
JSON text
|
144
|
-
recipe: Recipe key of a configuration of data types and settings
|
145
|
-
defined in the Pangea User Console. It specifies the rules that
|
146
|
-
are to be applied to the text, such as defang malicious URLs.
|
147
144
|
debug: Setting this value to true will provide a detailed analysis
|
148
145
|
of the text data
|
149
146
|
log_field: Additional fields to include in activity log
|
147
|
+
overrides: Overrides flags. Note: This parameter has no effect when
|
148
|
+
the request is made by AIDR
|
149
|
+
recipe: Recipe key of a configuration of data types and settings
|
150
|
+
defined in the Pangea User Console. It specifies the rules that
|
151
|
+
are to be applied to the text, such as defang malicious URLs.
|
150
152
|
|
151
153
|
Examples:
|
152
154
|
response = await ai_guard.guard_text("text")
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
3
3
|
from collections.abc import Sequence
|
4
4
|
from typing import Generic, Literal, Optional, overload
|
5
5
|
|
6
|
-
from pydantic import BaseModel, ConfigDict
|
7
6
|
from typing_extensions import TypeVar
|
8
7
|
|
9
8
|
from pangea.config import PangeaConfig
|
@@ -21,9 +20,7 @@ MaliciousEntityAction = Literal["report", "defang", "disabled", "block"]
|
|
21
20
|
PiiEntityAction = Literal["disabled", "report", "block", "mask", "partial_masking", "replacement", "hash", "fpe"]
|
22
21
|
|
23
22
|
|
24
|
-
class Message(
|
25
|
-
model_config = ConfigDict(extra="forbid")
|
26
|
-
|
23
|
+
class Message(APIRequestModel):
|
27
24
|
role: str
|
28
25
|
content: str
|
29
26
|
|
@@ -31,18 +28,21 @@ class Message(BaseModel):
|
|
31
28
|
class CodeDetectionOverride(APIRequestModel):
|
32
29
|
disabled: Optional[bool] = None
|
33
30
|
action: Optional[Literal["report", "block"]] = None
|
31
|
+
threshold: Optional[float] = None
|
34
32
|
|
35
33
|
|
36
34
|
class LanguageDetectionOverride(APIRequestModel):
|
37
35
|
disabled: Optional[bool] = None
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
action: Optional[Literal["", "report", "allow", "block"]] = ""
|
37
|
+
languages: Optional[list[str]] = None
|
38
|
+
threshold: Optional[float] = None
|
41
39
|
|
42
40
|
|
43
41
|
class TopicDetectionOverride(APIRequestModel):
|
44
42
|
disabled: Optional[bool] = None
|
45
|
-
|
43
|
+
action: Optional[Literal["", "report", "block"]] = ""
|
44
|
+
topics: Optional[list[str]] = None
|
45
|
+
threshold: Optional[float] = None
|
46
46
|
|
47
47
|
|
48
48
|
class PromptInjectionOverride(APIRequestModel):
|
@@ -145,6 +145,8 @@ class SecretsDetectionOverride(APIRequestModel):
|
|
145
145
|
|
146
146
|
|
147
147
|
class Overrides(APIRequestModel):
|
148
|
+
"""Overrides flags."""
|
149
|
+
|
148
150
|
ignore_recipe: Optional[bool] = None
|
149
151
|
"""Bypass existing Recipe content and create an on-the-fly Recipe."""
|
150
152
|
|
@@ -159,7 +161,7 @@ class Overrides(APIRequestModel):
|
|
159
161
|
secrets_detection: Optional[SecretsDetectionOverride] = None
|
160
162
|
selfharm: Optional[SelfHarmOverride] = None
|
161
163
|
sentiment: Optional[SentimentOverride] = None
|
162
|
-
|
164
|
+
topic: Optional[TopicDetectionOverride] = None
|
163
165
|
|
164
166
|
|
165
167
|
class LogFields(APIRequestModel):
|
@@ -249,15 +251,24 @@ class SecretsEntityResult(APIResponseModel):
|
|
249
251
|
|
250
252
|
|
251
253
|
class LanguageDetectionResult(APIResponseModel):
|
252
|
-
|
253
|
-
action: str
|
254
|
+
action: Optional[str] = None
|
254
255
|
"""The action taken by this Detector"""
|
255
256
|
|
257
|
+
language: Optional[str] = None
|
258
|
+
|
259
|
+
|
260
|
+
class Topic(APIResponseModel):
|
261
|
+
topic: str
|
262
|
+
confidence: float
|
263
|
+
|
256
264
|
|
257
265
|
class TopicDetectionResult(APIResponseModel):
|
258
|
-
action: str
|
266
|
+
action: Optional[str] = None
|
259
267
|
"""The action taken by this Detector"""
|
260
268
|
|
269
|
+
topics: Optional[list[Topic]] = None
|
270
|
+
"""List of topics detected"""
|
271
|
+
|
261
272
|
|
262
273
|
class CodeDetectionResult(APIResponseModel):
|
263
274
|
language: str
|
@@ -274,38 +285,49 @@ class TextGuardDetector(APIResponseModel, Generic[_T]):
|
|
274
285
|
|
275
286
|
|
276
287
|
class TextGuardDetectors(APIResponseModel):
|
277
|
-
|
278
|
-
|
279
|
-
malicious_entity: Optional[TextGuardDetector[MaliciousEntityResult]] = None
|
288
|
+
code_detection: Optional[TextGuardDetector[CodeDetectionResult]] = None
|
289
|
+
competitors: Optional[TextGuardDetector[object]] = None
|
280
290
|
custom_entity: Optional[TextGuardDetector[object]] = None
|
281
|
-
|
282
|
-
|
291
|
+
gibberish: Optional[TextGuardDetector[object]] = None
|
292
|
+
hardening: Optional[TextGuardDetector[object]] = None
|
283
293
|
language_detection: Optional[TextGuardDetector[LanguageDetectionResult]] = None
|
284
|
-
|
285
|
-
|
294
|
+
malicious_entity: Optional[TextGuardDetector[MaliciousEntityResult]] = None
|
295
|
+
pii_entity: Optional[TextGuardDetector[PiiEntityResult]] = None
|
296
|
+
profanity_and_toxicity: Optional[TextGuardDetector[object]] = None
|
297
|
+
prompt_injection: Optional[TextGuardDetector[PromptInjectionResult]] = None
|
298
|
+
secrets_detection: Optional[TextGuardDetector[SecretsEntityResult]] = None
|
299
|
+
selfharm: Optional[TextGuardDetector[object]] = None
|
300
|
+
sentiment: Optional[TextGuardDetector[object]] = None
|
301
|
+
topic: Optional[TextGuardDetector[TopicDetectionResult]] = None
|
286
302
|
|
287
303
|
|
288
304
|
class TextGuardResult(PangeaResponseResult):
|
289
305
|
detectors: TextGuardDetectors
|
290
306
|
"""Result of the recipe analyzing and input prompt."""
|
291
307
|
|
292
|
-
|
293
|
-
"""
|
308
|
+
access_rules: Optional[object] = None
|
309
|
+
"""Result of the recipe evaluating configured rules"""
|
310
|
+
|
311
|
+
blocked: Optional[bool] = None
|
312
|
+
"""Whether or not the prompt triggered a block detection."""
|
313
|
+
|
314
|
+
fpe_context: Optional[str] = None
|
315
|
+
"""
|
316
|
+
If an FPE redaction method returned results, this will be the context passed to
|
317
|
+
unredact.
|
318
|
+
"""
|
294
319
|
|
295
320
|
prompt_messages: Optional[object] = None
|
296
321
|
"""Updated structured prompt, if applicable."""
|
297
322
|
|
298
|
-
|
299
|
-
"""
|
323
|
+
prompt_text: Optional[str] = None
|
324
|
+
"""Updated prompt text, if applicable."""
|
300
325
|
|
301
|
-
recipe: str
|
326
|
+
recipe: Optional[str] = None
|
302
327
|
"""The Recipe that was used."""
|
303
328
|
|
304
|
-
|
305
|
-
"""
|
306
|
-
If an FPE redaction method returned results, this will be the context passed
|
307
|
-
to unredact.
|
308
|
-
"""
|
329
|
+
transformed: Optional[bool] = None
|
330
|
+
"""Whether or not the original input was transformed."""
|
309
331
|
|
310
332
|
|
311
333
|
class AIGuard(ServiceBase):
|
@@ -314,11 +336,9 @@ class AIGuard(ServiceBase):
|
|
314
336
|
Provides methods to interact with Pangea's AI Guard service.
|
315
337
|
|
316
338
|
Examples:
|
317
|
-
from pangea import PangeaConfig
|
318
339
|
from pangea.services import AIGuard
|
319
340
|
|
320
|
-
|
321
|
-
ai_guard = AIGuard(token="pangea_token", config=config)
|
341
|
+
ai_guard = AIGuard(token="pangea_token")
|
322
342
|
"""
|
323
343
|
|
324
344
|
service_name = "ai-guard"
|
@@ -338,11 +358,9 @@ class AIGuard(ServiceBase):
|
|
338
358
|
config_id: Configuration ID.
|
339
359
|
|
340
360
|
Examples:
|
341
|
-
from pangea import PangeaConfig
|
342
361
|
from pangea.services import AIGuard
|
343
362
|
|
344
|
-
|
345
|
-
ai_guard = AIGuard(token="pangea_token", config=config)
|
363
|
+
ai_guard = AIGuard(token="pangea_token")
|
346
364
|
"""
|
347
365
|
|
348
366
|
super().__init__(token, config, logger_name, config_id)
|
@@ -352,29 +370,31 @@ class AIGuard(ServiceBase):
|
|
352
370
|
self,
|
353
371
|
text: str,
|
354
372
|
*,
|
355
|
-
recipe: str | None = None,
|
356
373
|
debug: bool | None = None,
|
357
|
-
overrides: Overrides | None = None,
|
358
374
|
log_fields: LogFields | None = None,
|
375
|
+
overrides: Overrides | None = None,
|
376
|
+
recipe: str | None = None,
|
359
377
|
) -> PangeaResponse[TextGuardResult]:
|
360
378
|
"""
|
361
|
-
|
379
|
+
Guard LLM input and output text
|
362
380
|
|
363
|
-
|
364
|
-
|
381
|
+
Detect, remove, or block malicious content and intent in LLM inputs and
|
382
|
+
outputs to prevent model manipulation and data leakage.
|
365
383
|
|
366
384
|
OperationId: ai_guard_post_v1_text_guard
|
367
385
|
|
368
386
|
Args:
|
369
387
|
text: Text to be scanned by AI Guard for PII, sensitive data,
|
370
388
|
malicious content, and other data types defined by the
|
371
|
-
configuration. Supports processing up to
|
372
|
-
recipe: Recipe key of a configuration of data types and settings
|
373
|
-
defined in the Pangea User Console. It specifies the rules that
|
374
|
-
are to be applied to the text, such as defang malicious URLs.
|
389
|
+
configuration. Supports processing up to 20 KiB of text.
|
375
390
|
debug: Setting this value to true will provide a detailed analysis
|
376
391
|
of the text data
|
377
392
|
log_field: Additional fields to include in activity log
|
393
|
+
overrides: Overrides flags. Note: This parameter has no effect when
|
394
|
+
the request is made by AIDR
|
395
|
+
recipe: Recipe key of a configuration of data types and settings
|
396
|
+
defined in the Pangea User Console. It specifies the rules that
|
397
|
+
are to be applied to the text, such as defang malicious URLs.
|
378
398
|
|
379
399
|
Examples:
|
380
400
|
response = ai_guard.guard_text("text")
|
@@ -391,24 +411,26 @@ class AIGuard(ServiceBase):
|
|
391
411
|
log_fields: LogFields | None = None,
|
392
412
|
) -> PangeaResponse[TextGuardResult]:
|
393
413
|
"""
|
394
|
-
|
414
|
+
Guard LLM input and output text
|
395
415
|
|
396
|
-
|
397
|
-
|
416
|
+
Detect, remove, or block malicious content and intent in LLM inputs and
|
417
|
+
outputs to prevent model manipulation and data leakage.
|
398
418
|
|
399
419
|
OperationId: ai_guard_post_v1_text_guard
|
400
420
|
|
401
421
|
Args:
|
402
422
|
messages: Structured messages data to be scanned by AI Guard for
|
403
423
|
PII, sensitive data, malicious content, and other data types
|
404
|
-
defined by the configuration. Supports processing up to
|
405
|
-
JSON text
|
406
|
-
recipe: Recipe key of a configuration of data types and settings
|
407
|
-
defined in the Pangea User Console. It specifies the rules that
|
408
|
-
are to be applied to the text, such as defang malicious URLs.
|
424
|
+
defined by the configuration. Supports processing up to 20 KiB
|
425
|
+
of JSON text using Pangea message format.
|
409
426
|
debug: Setting this value to true will provide a detailed analysis
|
410
427
|
of the text data
|
411
428
|
log_field: Additional fields to include in activity log
|
429
|
+
overrides: Overrides flags. Note: This parameter has no effect when
|
430
|
+
the request is made by AIDR
|
431
|
+
recipe: Recipe key of a configuration of data types and settings
|
432
|
+
defined in the Pangea User Console. It specifies the rules that
|
433
|
+
are to be applied to the text, such as defang malicious URLs.
|
412
434
|
|
413
435
|
Examples:
|
414
436
|
response = ai_guard.guard_text(messages=[Message(role="user", content="hello world")])
|
@@ -419,16 +441,16 @@ class AIGuard(ServiceBase):
|
|
419
441
|
text: str | None = None,
|
420
442
|
*,
|
421
443
|
messages: Sequence[Message] | None = None,
|
422
|
-
recipe: str | None = None,
|
423
444
|
debug: bool | None = None,
|
424
|
-
overrides: Overrides | None = None,
|
425
445
|
log_fields: LogFields | None = None,
|
446
|
+
overrides: Overrides | None = None,
|
447
|
+
recipe: str | None = None,
|
426
448
|
) -> PangeaResponse[TextGuardResult]:
|
427
449
|
"""
|
428
|
-
|
450
|
+
Guard LLM input and output text
|
429
451
|
|
430
|
-
|
431
|
-
|
452
|
+
Detect, remove, or block malicious content and intent in LLM inputs and
|
453
|
+
outputs to prevent model manipulation and data leakage.
|
432
454
|
|
433
455
|
OperationId: ai_guard_post_v1_text_guard
|
434
456
|
|
@@ -440,12 +462,14 @@ class AIGuard(ServiceBase):
|
|
440
462
|
PII, sensitive data, malicious content, and other data types
|
441
463
|
defined by the configuration. Supports processing up to 10KB of
|
442
464
|
JSON text
|
443
|
-
recipe: Recipe key of a configuration of data types and settings
|
444
|
-
defined in the Pangea User Console. It specifies the rules that
|
445
|
-
are to be applied to the text, such as defang malicious URLs.
|
446
465
|
debug: Setting this value to true will provide a detailed analysis
|
447
466
|
of the text data
|
448
467
|
log_field: Additional fields to include in activity log
|
468
|
+
overrides: Overrides flags. Note: This parameter has no effect when
|
469
|
+
the request is made by AIDR
|
470
|
+
recipe: Recipe key of a configuration of data types and settings
|
471
|
+
defined in the Pangea User Console. It specifies the rules that
|
472
|
+
are to be applied to the text, such as defang malicious URLs.
|
449
473
|
|
450
474
|
Examples:
|
451
475
|
response = ai_guard.guard_text("text")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "pangea-sdk"
|
3
|
-
version = "6.
|
3
|
+
version = "6.4.0"
|
4
4
|
description = "Pangea API SDK"
|
5
5
|
authors = [
|
6
6
|
{name = "Glenn Gallien", email = "glenn.gallien@pangea.cloud"}
|
@@ -35,9 +35,9 @@ packages = [
|
|
35
35
|
|
36
36
|
[tool.poetry.group.dev.dependencies]
|
37
37
|
docstring-parser = "^0.15"
|
38
|
-
mypy = "1.
|
38
|
+
mypy = "1.17.0"
|
39
39
|
pytest = "8.3.5"
|
40
|
-
pytest-asyncio = "1.
|
40
|
+
pytest-asyncio = "1.1.0"
|
41
41
|
types-Deprecated = "^1.2.9.3"
|
42
42
|
types-python-dateutil = "^2.8.19.14"
|
43
43
|
types-requests = "2.32.4.20250611"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|