google-cloud-modelarmor 0.6.0__tar.gz → 0.7.1__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.
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/MANIFEST.in +1 -1
- {google_cloud_modelarmor-0.6.0/google_cloud_modelarmor.egg-info → google_cloud_modelarmor-0.7.1}/PKG-INFO +10 -11
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/README.rst +3 -2
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor/__init__.py +11 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor/gapic_version.py +2 -2
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/__init__.py +18 -25
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/gapic_metadata.json +30 -0
- {google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1beta → google_cloud_modelarmor-0.7.1/google/cloud/modelarmor_v1}/gapic_version.py +2 -2
- {google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1beta → google_cloud_modelarmor-0.7.1/google/cloud/modelarmor_v1}/services/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/services/model_armor/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/services/model_armor/async_client.py +178 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/services/model_armor/client.py +177 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/services/model_armor/pagers.py +1 -1
- {google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1beta → google_cloud_modelarmor-0.7.1/google/cloud/modelarmor_v1}/services/model_armor/transports/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/services/model_armor/transports/base.py +35 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/services/model_armor/transports/grpc.py +61 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/services/model_armor/transports/grpc_asyncio.py +73 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/services/model_armor/transports/rest.py +62 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/services/model_armor/transports/rest_base.py +9 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/types/__init__.py +11 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/types/service.py +270 -3
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/__init__.py +8 -25
- {google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1 → google_cloud_modelarmor-0.7.1/google/cloud/modelarmor_v1beta}/gapic_version.py +2 -2
- {google_cloud_modelarmor-0.6.0/tests → google_cloud_modelarmor-0.7.1/google/cloud/modelarmor_v1beta/services}/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/services/model_armor/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/services/model_armor/async_client.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/services/model_armor/client.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/services/model_armor/pagers.py +1 -1
- {google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1 → google_cloud_modelarmor-0.7.1/google/cloud/modelarmor_v1beta}/services/model_armor/transports/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/services/model_armor/transports/base.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/services/model_armor/transports/grpc.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/services/model_armor/transports/grpc_asyncio.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/services/model_armor/transports/rest.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/services/model_armor/transports/rest_base.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/types/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/types/service.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1/google_cloud_modelarmor.egg-info}/PKG-INFO +10 -11
- google_cloud_modelarmor-0.7.1/google_cloud_modelarmor.egg-info/requires.txt +8 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/setup.py +11 -10
- {google_cloud_modelarmor-0.6.0/tests/unit → google_cloud_modelarmor-0.7.1/tests}/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1/services → google_cloud_modelarmor-0.7.1/tests/unit}/__init__.py +1 -1
- google_cloud_modelarmor-0.7.1/tests/unit/gapic/__init__.py +15 -0
- google_cloud_modelarmor-0.7.1/tests/unit/gapic/modelarmor_v1/__init__.py +15 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/tests/unit/gapic/modelarmor_v1/test_model_armor.py +562 -162
- google_cloud_modelarmor-0.7.1/tests/unit/gapic/modelarmor_v1beta/__init__.py +15 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/tests/unit/gapic/modelarmor_v1beta/test_model_armor.py +180 -182
- google_cloud_modelarmor-0.6.0/google_cloud_modelarmor.egg-info/requires.txt +0 -11
- google_cloud_modelarmor-0.6.0/tests/unit/gapic/__init__.py +0 -15
- google_cloud_modelarmor-0.6.0/tests/unit/gapic/modelarmor_v1/__init__.py +0 -15
- google_cloud_modelarmor-0.6.0/tests/unit/gapic/modelarmor_v1beta/__init__.py +0 -15
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/LICENSE +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor/py.typed +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1/py.typed +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/gapic_metadata.json +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor_v1beta/py.typed +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google_cloud_modelarmor.egg-info/SOURCES.txt +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google_cloud_modelarmor.egg-info/dependency_links.txt +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google_cloud_modelarmor.egg-info/not-zip-safe +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google_cloud_modelarmor.egg-info/top_level.txt +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/setup.cfg +0 -0
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-cloud-modelarmor
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: Google Cloud Modelarmor API client library
|
|
5
5
|
Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-modelarmor
|
|
6
6
|
Author: Google LLC
|
|
7
7
|
Author-email: googleapis-packages@google.com
|
|
8
|
-
License: Apache
|
|
8
|
+
License: Apache-2.0
|
|
9
9
|
Platform: Posix; MacOS X; Windows
|
|
10
10
|
Classifier: Development Status :: 4 - Beta
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -20,15 +19,14 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.14
|
|
21
20
|
Classifier: Operating System :: OS Independent
|
|
22
21
|
Classifier: Topic :: Internet
|
|
23
|
-
Requires-Python: >=3.
|
|
22
|
+
Requires-Python: >=3.10
|
|
24
23
|
License-File: LICENSE
|
|
25
|
-
Requires-Dist: google-api-core[grpc]<3.0.0,>=2.
|
|
24
|
+
Requires-Dist: google-api-core[grpc]<3.0.0,>=2.24.2
|
|
26
25
|
Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
|
|
27
|
-
Requires-Dist: grpcio<2.0.0,>=1.
|
|
26
|
+
Requires-Dist: grpcio<2.0.0,>=1.59.0
|
|
28
27
|
Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14"
|
|
29
|
-
Requires-Dist: proto-plus<2.0.0,>=1.
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist: protobuf<8.0.0,>=4.25.8
|
|
28
|
+
Requires-Dist: proto-plus<2.0.0,>=1.26.1
|
|
29
|
+
Requires-Dist: protobuf<8.0.0,>=6.33.5
|
|
32
30
|
Dynamic: author
|
|
33
31
|
Dynamic: author-email
|
|
34
32
|
Dynamic: classifier
|
|
@@ -106,14 +104,15 @@ Supported Python Versions
|
|
|
106
104
|
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
|
|
107
105
|
Python.
|
|
108
106
|
|
|
109
|
-
Python >= 3.
|
|
107
|
+
Python >= 3.10, including 3.14
|
|
110
108
|
|
|
111
109
|
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
|
|
112
110
|
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
|
|
113
111
|
|
|
114
112
|
Unsupported Python Versions
|
|
115
113
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
116
|
-
Python <= 3.
|
|
114
|
+
Python <= 3.9
|
|
115
|
+
|
|
117
116
|
|
|
118
117
|
If you are using an `end-of-life`_
|
|
119
118
|
version of Python, we recommend that you update as soon as possible to an actively supported version.
|
|
@@ -63,14 +63,15 @@ Supported Python Versions
|
|
|
63
63
|
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
|
|
64
64
|
Python.
|
|
65
65
|
|
|
66
|
-
Python >= 3.
|
|
66
|
+
Python >= 3.10, including 3.14
|
|
67
67
|
|
|
68
68
|
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
|
|
69
69
|
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
|
|
70
70
|
|
|
71
71
|
Unsupported Python Versions
|
|
72
72
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
73
|
-
Python <= 3.
|
|
73
|
+
Python <= 3.9
|
|
74
|
+
|
|
74
75
|
|
|
75
76
|
If you are using an `end-of-life`_
|
|
76
77
|
version of Python, we recommend that you update as soon as possible to an actively supported version.
|
{google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.1}/google/cloud/modelarmor/__init__.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright
|
|
2
|
+
# Copyright 2026 Google LLC
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
@@ -43,6 +43,7 @@ from google.cloud.modelarmor_v1.types.service import (
|
|
|
43
43
|
MaliciousUriFilterResult,
|
|
44
44
|
MaliciousUriFilterSettings,
|
|
45
45
|
MessageItem,
|
|
46
|
+
Modality,
|
|
46
47
|
MultiLanguageDetectionMetadata,
|
|
47
48
|
PiAndJailbreakFilterResult,
|
|
48
49
|
PiAndJailbreakFilterSettings,
|
|
@@ -57,12 +58,16 @@ from google.cloud.modelarmor_v1.types.service import (
|
|
|
57
58
|
SanitizeUserPromptResponse,
|
|
58
59
|
SdpAdvancedConfig,
|
|
59
60
|
SdpBasicConfig,
|
|
61
|
+
SdpContentLocation,
|
|
60
62
|
SdpDeidentifyResult,
|
|
61
63
|
SdpFilterResult,
|
|
62
64
|
SdpFilterSettings,
|
|
63
65
|
SdpFinding,
|
|
64
66
|
SdpFindingLikelihood,
|
|
67
|
+
SdpImageFindingLocation,
|
|
65
68
|
SdpInspectResult,
|
|
69
|
+
SdpRedactResult,
|
|
70
|
+
StreamingMode,
|
|
66
71
|
Template,
|
|
67
72
|
UpdateFloorSettingRequest,
|
|
68
73
|
UpdateTemplateRequest,
|
|
@@ -102,11 +107,14 @@ __all__ = (
|
|
|
102
107
|
"SanitizeUserPromptResponse",
|
|
103
108
|
"SdpAdvancedConfig",
|
|
104
109
|
"SdpBasicConfig",
|
|
110
|
+
"SdpContentLocation",
|
|
105
111
|
"SdpDeidentifyResult",
|
|
106
112
|
"SdpFilterResult",
|
|
107
113
|
"SdpFilterSettings",
|
|
108
114
|
"SdpFinding",
|
|
115
|
+
"SdpImageFindingLocation",
|
|
109
116
|
"SdpInspectResult",
|
|
117
|
+
"SdpRedactResult",
|
|
110
118
|
"Template",
|
|
111
119
|
"UpdateFloorSettingRequest",
|
|
112
120
|
"UpdateTemplateRequest",
|
|
@@ -116,6 +124,8 @@ __all__ = (
|
|
|
116
124
|
"FilterExecutionState",
|
|
117
125
|
"FilterMatchState",
|
|
118
126
|
"InvocationResult",
|
|
127
|
+
"Modality",
|
|
119
128
|
"RaiFilterType",
|
|
120
129
|
"SdpFindingLikelihood",
|
|
130
|
+
"StreamingMode",
|
|
121
131
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright
|
|
2
|
+
# Copyright 2026 Google LLC
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
-
__version__ = "0.
|
|
16
|
+
__version__ = "0.7.1" # {x-release-please-version}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright
|
|
2
|
+
# Copyright 2026 Google LLC
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
@@ -21,13 +21,7 @@ from google.cloud.modelarmor_v1 import gapic_version as package_version
|
|
|
21
21
|
|
|
22
22
|
__version__ = package_version.__version__
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
from importlib import metadata
|
|
26
|
-
else: # pragma: NO COVER
|
|
27
|
-
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
|
|
28
|
-
# this code path once we drop support for Python 3.7
|
|
29
|
-
import importlib_metadata as metadata
|
|
30
|
-
|
|
24
|
+
from importlib import metadata
|
|
31
25
|
|
|
32
26
|
from .services.model_armor import ModelArmorAsyncClient, ModelArmorClient
|
|
33
27
|
from .types.service import (
|
|
@@ -51,6 +45,7 @@ from .types.service import (
|
|
|
51
45
|
MaliciousUriFilterResult,
|
|
52
46
|
MaliciousUriFilterSettings,
|
|
53
47
|
MessageItem,
|
|
48
|
+
Modality,
|
|
54
49
|
MultiLanguageDetectionMetadata,
|
|
55
50
|
PiAndJailbreakFilterResult,
|
|
56
51
|
PiAndJailbreakFilterSettings,
|
|
@@ -65,12 +60,16 @@ from .types.service import (
|
|
|
65
60
|
SanitizeUserPromptResponse,
|
|
66
61
|
SdpAdvancedConfig,
|
|
67
62
|
SdpBasicConfig,
|
|
63
|
+
SdpContentLocation,
|
|
68
64
|
SdpDeidentifyResult,
|
|
69
65
|
SdpFilterResult,
|
|
70
66
|
SdpFilterSettings,
|
|
71
67
|
SdpFinding,
|
|
72
68
|
SdpFindingLikelihood,
|
|
69
|
+
SdpImageFindingLocation,
|
|
73
70
|
SdpInspectResult,
|
|
71
|
+
SdpRedactResult,
|
|
72
|
+
StreamingMode,
|
|
74
73
|
Template,
|
|
75
74
|
UpdateFloorSettingRequest,
|
|
76
75
|
UpdateTemplateRequest,
|
|
@@ -87,34 +86,23 @@ else: # pragma: NO COVER
|
|
|
87
86
|
# An older version of api_core is installed which does not define the
|
|
88
87
|
# functions above. We do equivalent checks manually.
|
|
89
88
|
try:
|
|
90
|
-
import sys
|
|
91
89
|
import warnings
|
|
92
90
|
|
|
93
91
|
_py_version_str = sys.version.split()[0]
|
|
94
92
|
_package_label = "google.cloud.modelarmor_v1"
|
|
95
|
-
if sys.version_info < (3,
|
|
93
|
+
if sys.version_info < (3, 10):
|
|
96
94
|
warnings.warn(
|
|
97
95
|
"You are using a non-supported Python version "
|
|
98
96
|
+ f"({_py_version_str}). Google will not post any further "
|
|
99
97
|
+ f"updates to {_package_label} supporting this Python version. "
|
|
100
98
|
+ "Please upgrade to the latest Python version, or at "
|
|
101
|
-
+ f"least to Python 3.
|
|
102
|
-
FutureWarning,
|
|
103
|
-
)
|
|
104
|
-
if sys.version_info[:2] == (3, 9):
|
|
105
|
-
warnings.warn(
|
|
106
|
-
f"You are using a Python version ({_py_version_str}) "
|
|
107
|
-
+ f"which Google will stop supporting in {_package_label} in "
|
|
108
|
-
+ "January 2026. Please "
|
|
109
|
-
+ "upgrade to the latest Python version, or at "
|
|
110
|
-
+ "least to Python 3.10, before then, and "
|
|
111
|
-
+ f"then update {_package_label}.",
|
|
99
|
+
+ f"least to Python 3.10, and then update {_package_label}.",
|
|
112
100
|
FutureWarning,
|
|
113
101
|
)
|
|
114
102
|
|
|
115
103
|
def parse_version_to_tuple(version_string: str):
|
|
116
104
|
"""Safely converts a semantic version string to a comparable tuple of integers.
|
|
117
|
-
Example: "
|
|
105
|
+
Example: "6.33.5" -> (6, 33, 5)
|
|
118
106
|
Ignores non-numeric parts and handles common version formats.
|
|
119
107
|
Args:
|
|
120
108
|
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
|
|
@@ -143,9 +131,9 @@ else: # pragma: NO COVER
|
|
|
143
131
|
return (None, "--")
|
|
144
132
|
|
|
145
133
|
_dependency_package = "google.protobuf"
|
|
146
|
-
_next_supported_version = "
|
|
147
|
-
_next_supported_version_tuple = (
|
|
148
|
-
_recommendation = " (we recommend
|
|
134
|
+
_next_supported_version = "6.33.5"
|
|
135
|
+
_next_supported_version_tuple = (6, 33, 5)
|
|
136
|
+
_recommendation = " (we recommend 7.x)"
|
|
149
137
|
(_version_used, _version_used_string) = _get_version(_dependency_package)
|
|
150
138
|
if _version_used and _version_used < _next_supported_version_tuple:
|
|
151
139
|
warnings.warn(
|
|
@@ -194,6 +182,7 @@ __all__ = (
|
|
|
194
182
|
"MaliciousUriFilterResult",
|
|
195
183
|
"MaliciousUriFilterSettings",
|
|
196
184
|
"MessageItem",
|
|
185
|
+
"Modality",
|
|
197
186
|
"ModelArmorClient",
|
|
198
187
|
"MultiLanguageDetectionMetadata",
|
|
199
188
|
"PiAndJailbreakFilterResult",
|
|
@@ -209,12 +198,16 @@ __all__ = (
|
|
|
209
198
|
"SanitizeUserPromptResponse",
|
|
210
199
|
"SdpAdvancedConfig",
|
|
211
200
|
"SdpBasicConfig",
|
|
201
|
+
"SdpContentLocation",
|
|
212
202
|
"SdpDeidentifyResult",
|
|
213
203
|
"SdpFilterResult",
|
|
214
204
|
"SdpFilterSettings",
|
|
215
205
|
"SdpFinding",
|
|
216
206
|
"SdpFindingLikelihood",
|
|
207
|
+
"SdpImageFindingLocation",
|
|
217
208
|
"SdpInspectResult",
|
|
209
|
+
"SdpRedactResult",
|
|
210
|
+
"StreamingMode",
|
|
218
211
|
"Template",
|
|
219
212
|
"UpdateFloorSettingRequest",
|
|
220
213
|
"UpdateTemplateRequest",
|
|
@@ -45,6 +45,16 @@
|
|
|
45
45
|
"sanitize_user_prompt"
|
|
46
46
|
]
|
|
47
47
|
},
|
|
48
|
+
"StreamSanitizeModelResponse": {
|
|
49
|
+
"methods": [
|
|
50
|
+
"stream_sanitize_model_response"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"StreamSanitizeUserPrompt": {
|
|
54
|
+
"methods": [
|
|
55
|
+
"stream_sanitize_user_prompt"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
48
58
|
"UpdateFloorSetting": {
|
|
49
59
|
"methods": [
|
|
50
60
|
"update_floor_setting"
|
|
@@ -95,6 +105,16 @@
|
|
|
95
105
|
"sanitize_user_prompt"
|
|
96
106
|
]
|
|
97
107
|
},
|
|
108
|
+
"StreamSanitizeModelResponse": {
|
|
109
|
+
"methods": [
|
|
110
|
+
"stream_sanitize_model_response"
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
"StreamSanitizeUserPrompt": {
|
|
114
|
+
"methods": [
|
|
115
|
+
"stream_sanitize_user_prompt"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
98
118
|
"UpdateFloorSetting": {
|
|
99
119
|
"methods": [
|
|
100
120
|
"update_floor_setting"
|
|
@@ -145,6 +165,16 @@
|
|
|
145
165
|
"sanitize_user_prompt"
|
|
146
166
|
]
|
|
147
167
|
},
|
|
168
|
+
"StreamSanitizeModelResponse": {
|
|
169
|
+
"methods": [
|
|
170
|
+
"stream_sanitize_model_response"
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"StreamSanitizeUserPrompt": {
|
|
174
|
+
"methods": [
|
|
175
|
+
"stream_sanitize_user_prompt"
|
|
176
|
+
]
|
|
177
|
+
},
|
|
148
178
|
"UpdateFloorSetting": {
|
|
149
179
|
"methods": [
|
|
150
180
|
"update_floor_setting"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright
|
|
2
|
+
# Copyright 2026 Google LLC
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
-
__version__ = "0.
|
|
16
|
+
__version__ = "0.7.1" # {x-release-please-version}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright
|
|
2
|
+
# Copyright 2026 Google LLC
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
@@ -17,6 +17,9 @@ import logging as std_logging
|
|
|
17
17
|
import re
|
|
18
18
|
from collections import OrderedDict
|
|
19
19
|
from typing import (
|
|
20
|
+
AsyncIterable,
|
|
21
|
+
AsyncIterator,
|
|
22
|
+
Awaitable,
|
|
20
23
|
Callable,
|
|
21
24
|
Dict,
|
|
22
25
|
Mapping,
|
|
@@ -1280,6 +1283,180 @@ class ModelArmorAsyncClient:
|
|
|
1280
1283
|
# Done; return the response.
|
|
1281
1284
|
return response
|
|
1282
1285
|
|
|
1286
|
+
def stream_sanitize_user_prompt(
|
|
1287
|
+
self,
|
|
1288
|
+
requests: Optional[AsyncIterator[service.SanitizeUserPromptRequest]] = None,
|
|
1289
|
+
*,
|
|
1290
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1291
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1292
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1293
|
+
) -> Awaitable[AsyncIterable[service.SanitizeUserPromptResponse]]:
|
|
1294
|
+
r"""Streaming version of Sanitize User Prompt.
|
|
1295
|
+
|
|
1296
|
+
.. code-block:: python
|
|
1297
|
+
|
|
1298
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1299
|
+
# code template only.
|
|
1300
|
+
# It will require modifications to work:
|
|
1301
|
+
# - It may require correct/in-range values for request initialization.
|
|
1302
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1303
|
+
# client as shown in:
|
|
1304
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1305
|
+
from google.cloud import modelarmor_v1
|
|
1306
|
+
|
|
1307
|
+
async def sample_stream_sanitize_user_prompt():
|
|
1308
|
+
# Create a client
|
|
1309
|
+
client = modelarmor_v1.ModelArmorAsyncClient()
|
|
1310
|
+
|
|
1311
|
+
# Initialize request argument(s)
|
|
1312
|
+
user_prompt_data = modelarmor_v1.DataItem()
|
|
1313
|
+
user_prompt_data.text = "text_value"
|
|
1314
|
+
|
|
1315
|
+
request = modelarmor_v1.SanitizeUserPromptRequest(
|
|
1316
|
+
name="name_value",
|
|
1317
|
+
user_prompt_data=user_prompt_data,
|
|
1318
|
+
)
|
|
1319
|
+
|
|
1320
|
+
# This method expects an iterator which contains
|
|
1321
|
+
# 'modelarmor_v1.SanitizeUserPromptRequest' objects
|
|
1322
|
+
# Here we create a generator that yields a single `request` for
|
|
1323
|
+
# demonstrative purposes.
|
|
1324
|
+
requests = [request]
|
|
1325
|
+
|
|
1326
|
+
def request_generator():
|
|
1327
|
+
for request in requests:
|
|
1328
|
+
yield request
|
|
1329
|
+
|
|
1330
|
+
# Make the request
|
|
1331
|
+
stream = await client.stream_sanitize_user_prompt(requests=request_generator())
|
|
1332
|
+
|
|
1333
|
+
# Handle the response
|
|
1334
|
+
async for response in stream:
|
|
1335
|
+
print(response)
|
|
1336
|
+
|
|
1337
|
+
Args:
|
|
1338
|
+
requests (AsyncIterator[`google.cloud.modelarmor_v1.types.SanitizeUserPromptRequest`]):
|
|
1339
|
+
The request object AsyncIterator. Sanitize User Prompt request.
|
|
1340
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1341
|
+
should be retried.
|
|
1342
|
+
timeout (float): The timeout for this request.
|
|
1343
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1344
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1345
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1346
|
+
be of type `bytes`.
|
|
1347
|
+
|
|
1348
|
+
Returns:
|
|
1349
|
+
AsyncIterable[google.cloud.modelarmor_v1.types.SanitizeUserPromptResponse]:
|
|
1350
|
+
Sanitized User Prompt Response.
|
|
1351
|
+
"""
|
|
1352
|
+
|
|
1353
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1354
|
+
# and friendly error handling.
|
|
1355
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1356
|
+
self._client._transport.stream_sanitize_user_prompt
|
|
1357
|
+
]
|
|
1358
|
+
|
|
1359
|
+
# Validate the universe domain.
|
|
1360
|
+
self._client._validate_universe_domain()
|
|
1361
|
+
|
|
1362
|
+
# Send the request.
|
|
1363
|
+
response = rpc(
|
|
1364
|
+
requests,
|
|
1365
|
+
retry=retry,
|
|
1366
|
+
timeout=timeout,
|
|
1367
|
+
metadata=metadata,
|
|
1368
|
+
)
|
|
1369
|
+
|
|
1370
|
+
# Done; return the response.
|
|
1371
|
+
return response
|
|
1372
|
+
|
|
1373
|
+
def stream_sanitize_model_response(
|
|
1374
|
+
self,
|
|
1375
|
+
requests: Optional[AsyncIterator[service.SanitizeModelResponseRequest]] = None,
|
|
1376
|
+
*,
|
|
1377
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1378
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1379
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1380
|
+
) -> Awaitable[AsyncIterable[service.SanitizeModelResponseResponse]]:
|
|
1381
|
+
r"""Streaming version of Sanitizes Model Response.
|
|
1382
|
+
|
|
1383
|
+
.. code-block:: python
|
|
1384
|
+
|
|
1385
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1386
|
+
# code template only.
|
|
1387
|
+
# It will require modifications to work:
|
|
1388
|
+
# - It may require correct/in-range values for request initialization.
|
|
1389
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1390
|
+
# client as shown in:
|
|
1391
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1392
|
+
from google.cloud import modelarmor_v1
|
|
1393
|
+
|
|
1394
|
+
async def sample_stream_sanitize_model_response():
|
|
1395
|
+
# Create a client
|
|
1396
|
+
client = modelarmor_v1.ModelArmorAsyncClient()
|
|
1397
|
+
|
|
1398
|
+
# Initialize request argument(s)
|
|
1399
|
+
model_response_data = modelarmor_v1.DataItem()
|
|
1400
|
+
model_response_data.text = "text_value"
|
|
1401
|
+
|
|
1402
|
+
request = modelarmor_v1.SanitizeModelResponseRequest(
|
|
1403
|
+
name="name_value",
|
|
1404
|
+
model_response_data=model_response_data,
|
|
1405
|
+
)
|
|
1406
|
+
|
|
1407
|
+
# This method expects an iterator which contains
|
|
1408
|
+
# 'modelarmor_v1.SanitizeModelResponseRequest' objects
|
|
1409
|
+
# Here we create a generator that yields a single `request` for
|
|
1410
|
+
# demonstrative purposes.
|
|
1411
|
+
requests = [request]
|
|
1412
|
+
|
|
1413
|
+
def request_generator():
|
|
1414
|
+
for request in requests:
|
|
1415
|
+
yield request
|
|
1416
|
+
|
|
1417
|
+
# Make the request
|
|
1418
|
+
stream = await client.stream_sanitize_model_response(requests=request_generator())
|
|
1419
|
+
|
|
1420
|
+
# Handle the response
|
|
1421
|
+
async for response in stream:
|
|
1422
|
+
print(response)
|
|
1423
|
+
|
|
1424
|
+
Args:
|
|
1425
|
+
requests (AsyncIterator[`google.cloud.modelarmor_v1.types.SanitizeModelResponseRequest`]):
|
|
1426
|
+
The request object AsyncIterator. Sanitize Model Response request.
|
|
1427
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1428
|
+
should be retried.
|
|
1429
|
+
timeout (float): The timeout for this request.
|
|
1430
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1431
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1432
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1433
|
+
be of type `bytes`.
|
|
1434
|
+
|
|
1435
|
+
Returns:
|
|
1436
|
+
AsyncIterable[google.cloud.modelarmor_v1.types.SanitizeModelResponseResponse]:
|
|
1437
|
+
Sanitized Model Response Response.
|
|
1438
|
+
"""
|
|
1439
|
+
|
|
1440
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1441
|
+
# and friendly error handling.
|
|
1442
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1443
|
+
self._client._transport.stream_sanitize_model_response
|
|
1444
|
+
]
|
|
1445
|
+
|
|
1446
|
+
# Validate the universe domain.
|
|
1447
|
+
self._client._validate_universe_domain()
|
|
1448
|
+
|
|
1449
|
+
# Send the request.
|
|
1450
|
+
response = rpc(
|
|
1451
|
+
requests,
|
|
1452
|
+
retry=retry,
|
|
1453
|
+
timeout=timeout,
|
|
1454
|
+
metadata=metadata,
|
|
1455
|
+
)
|
|
1456
|
+
|
|
1457
|
+
# Done; return the response.
|
|
1458
|
+
return response
|
|
1459
|
+
|
|
1283
1460
|
async def get_location(
|
|
1284
1461
|
self,
|
|
1285
1462
|
request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None,
|