google-cloud-modelarmor 0.6.0__tar.gz → 0.7.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.
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/MANIFEST.in +1 -1
- {google_cloud_modelarmor-0.6.0/google_cloud_modelarmor.egg-info → google_cloud_modelarmor-0.7.0}/PKG-INFO +8 -8
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/README.rst +3 -2
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor/__init__.py +3 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor/gapic_version.py +2 -2
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/__init__.py +6 -21
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/gapic_metadata.json +30 -0
- {google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1beta → google_cloud_modelarmor-0.7.0/google/cloud/modelarmor_v1}/gapic_version.py +2 -2
- {google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1beta → google_cloud_modelarmor-0.7.0/google/cloud/modelarmor_v1}/services/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/services/model_armor/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/services/model_armor/async_client.py +178 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/services/model_armor/client.py +177 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/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.0/google/cloud/modelarmor_v1}/services/model_armor/transports/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/services/model_armor/transports/base.py +35 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/services/model_armor/transports/grpc.py +61 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/services/model_armor/transports/grpc_asyncio.py +73 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/services/model_armor/transports/rest.py +62 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/services/model_armor/transports/rest_base.py +9 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/types/__init__.py +3 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/types/service.py +51 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/__init__.py +4 -21
- {google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1 → google_cloud_modelarmor-0.7.0/google/cloud/modelarmor_v1beta}/gapic_version.py +2 -2
- {google_cloud_modelarmor-0.6.0/tests → google_cloud_modelarmor-0.7.0/google/cloud/modelarmor_v1beta/services}/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/services/model_armor/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/services/model_armor/async_client.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/services/model_armor/client.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/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.0/google/cloud/modelarmor_v1beta}/services/model_armor/transports/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/base.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/grpc.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/grpc_asyncio.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/rest.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/rest_base.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/types/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/types/service.py +1 -1
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0/google_cloud_modelarmor.egg-info}/PKG-INFO +8 -8
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google_cloud_modelarmor.egg-info/requires.txt +2 -2
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/setup.py +5 -6
- {google_cloud_modelarmor-0.6.0/tests/unit → google_cloud_modelarmor-0.7.0/tests}/__init__.py +1 -1
- {google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1/services → google_cloud_modelarmor-0.7.0/tests/unit}/__init__.py +1 -1
- google_cloud_modelarmor-0.7.0/tests/unit/gapic/__init__.py +15 -0
- google_cloud_modelarmor-0.7.0/tests/unit/gapic/modelarmor_v1/__init__.py +15 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/tests/unit/gapic/modelarmor_v1/test_model_armor.py +560 -162
- google_cloud_modelarmor-0.7.0/tests/unit/gapic/modelarmor_v1beta/__init__.py +15 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/tests/unit/gapic/modelarmor_v1beta/test_model_armor.py +180 -182
- 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.0}/LICENSE +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor/py.typed +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1/py.typed +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/gapic_metadata.json +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google/cloud/modelarmor_v1beta/py.typed +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google_cloud_modelarmor.egg-info/SOURCES.txt +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google_cloud_modelarmor.egg-info/dependency_links.txt +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google_cloud_modelarmor.egg-info/not-zip-safe +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/google_cloud_modelarmor.egg-info/top_level.txt +0 -0
- {google_cloud_modelarmor-0.6.0 → google_cloud_modelarmor-0.7.0}/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.0
|
|
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,11 +19,11 @@ 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.17.1
|
|
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
28
|
Requires-Dist: proto-plus<2.0.0,>=1.22.3
|
|
30
29
|
Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
|
|
@@ -106,14 +105,15 @@ Supported Python Versions
|
|
|
106
105
|
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
|
|
107
106
|
Python.
|
|
108
107
|
|
|
109
|
-
Python >= 3.
|
|
108
|
+
Python >= 3.10, including 3.14
|
|
110
109
|
|
|
111
110
|
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
|
|
112
111
|
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
|
|
113
112
|
|
|
114
113
|
Unsupported Python Versions
|
|
115
114
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
116
|
-
Python <= 3.
|
|
115
|
+
Python <= 3.9
|
|
116
|
+
|
|
117
117
|
|
|
118
118
|
If you are using an `end-of-life`_
|
|
119
119
|
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.0}/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.
|
|
@@ -63,6 +63,7 @@ from google.cloud.modelarmor_v1.types.service import (
|
|
|
63
63
|
SdpFinding,
|
|
64
64
|
SdpFindingLikelihood,
|
|
65
65
|
SdpInspectResult,
|
|
66
|
+
StreamingMode,
|
|
66
67
|
Template,
|
|
67
68
|
UpdateFloorSettingRequest,
|
|
68
69
|
UpdateTemplateRequest,
|
|
@@ -118,4 +119,5 @@ __all__ = (
|
|
|
118
119
|
"InvocationResult",
|
|
119
120
|
"RaiFilterType",
|
|
120
121
|
"SdpFindingLikelihood",
|
|
122
|
+
"StreamingMode",
|
|
121
123
|
)
|
|
@@ -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.0" # {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 (
|
|
@@ -71,6 +65,7 @@ from .types.service import (
|
|
|
71
65
|
SdpFinding,
|
|
72
66
|
SdpFindingLikelihood,
|
|
73
67
|
SdpInspectResult,
|
|
68
|
+
StreamingMode,
|
|
74
69
|
Template,
|
|
75
70
|
UpdateFloorSettingRequest,
|
|
76
71
|
UpdateTemplateRequest,
|
|
@@ -87,28 +82,17 @@ else: # pragma: NO COVER
|
|
|
87
82
|
# An older version of api_core is installed which does not define the
|
|
88
83
|
# functions above. We do equivalent checks manually.
|
|
89
84
|
try:
|
|
90
|
-
import sys
|
|
91
85
|
import warnings
|
|
92
86
|
|
|
93
87
|
_py_version_str = sys.version.split()[0]
|
|
94
88
|
_package_label = "google.cloud.modelarmor_v1"
|
|
95
|
-
if sys.version_info < (3,
|
|
89
|
+
if sys.version_info < (3, 10):
|
|
96
90
|
warnings.warn(
|
|
97
91
|
"You are using a non-supported Python version "
|
|
98
92
|
+ f"({_py_version_str}). Google will not post any further "
|
|
99
93
|
+ f"updates to {_package_label} supporting this Python version. "
|
|
100
94
|
+ "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}.",
|
|
95
|
+
+ f"least to Python 3.10, and then update {_package_label}.",
|
|
112
96
|
FutureWarning,
|
|
113
97
|
)
|
|
114
98
|
|
|
@@ -215,6 +199,7 @@ __all__ = (
|
|
|
215
199
|
"SdpFinding",
|
|
216
200
|
"SdpFindingLikelihood",
|
|
217
201
|
"SdpInspectResult",
|
|
202
|
+
"StreamingMode",
|
|
218
203
|
"Template",
|
|
219
204
|
"UpdateFloorSettingRequest",
|
|
220
205
|
"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.0" # {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,
|
|
@@ -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.
|
|
@@ -23,6 +23,8 @@ from http import HTTPStatus
|
|
|
23
23
|
from typing import (
|
|
24
24
|
Callable,
|
|
25
25
|
Dict,
|
|
26
|
+
Iterable,
|
|
27
|
+
Iterator,
|
|
26
28
|
Mapping,
|
|
27
29
|
MutableMapping,
|
|
28
30
|
MutableSequence,
|
|
@@ -1710,6 +1712,180 @@ class ModelArmorClient(metaclass=ModelArmorClientMeta):
|
|
|
1710
1712
|
# Done; return the response.
|
|
1711
1713
|
return response
|
|
1712
1714
|
|
|
1715
|
+
def stream_sanitize_user_prompt(
|
|
1716
|
+
self,
|
|
1717
|
+
requests: Optional[Iterator[service.SanitizeUserPromptRequest]] = None,
|
|
1718
|
+
*,
|
|
1719
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1720
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1721
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1722
|
+
) -> Iterable[service.SanitizeUserPromptResponse]:
|
|
1723
|
+
r"""Streaming version of Sanitize User Prompt.
|
|
1724
|
+
|
|
1725
|
+
.. code-block:: python
|
|
1726
|
+
|
|
1727
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1728
|
+
# code template only.
|
|
1729
|
+
# It will require modifications to work:
|
|
1730
|
+
# - It may require correct/in-range values for request initialization.
|
|
1731
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1732
|
+
# client as shown in:
|
|
1733
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1734
|
+
from google.cloud import modelarmor_v1
|
|
1735
|
+
|
|
1736
|
+
def sample_stream_sanitize_user_prompt():
|
|
1737
|
+
# Create a client
|
|
1738
|
+
client = modelarmor_v1.ModelArmorClient()
|
|
1739
|
+
|
|
1740
|
+
# Initialize request argument(s)
|
|
1741
|
+
user_prompt_data = modelarmor_v1.DataItem()
|
|
1742
|
+
user_prompt_data.text = "text_value"
|
|
1743
|
+
|
|
1744
|
+
request = modelarmor_v1.SanitizeUserPromptRequest(
|
|
1745
|
+
name="name_value",
|
|
1746
|
+
user_prompt_data=user_prompt_data,
|
|
1747
|
+
)
|
|
1748
|
+
|
|
1749
|
+
# This method expects an iterator which contains
|
|
1750
|
+
# 'modelarmor_v1.SanitizeUserPromptRequest' objects
|
|
1751
|
+
# Here we create a generator that yields a single `request` for
|
|
1752
|
+
# demonstrative purposes.
|
|
1753
|
+
requests = [request]
|
|
1754
|
+
|
|
1755
|
+
def request_generator():
|
|
1756
|
+
for request in requests:
|
|
1757
|
+
yield request
|
|
1758
|
+
|
|
1759
|
+
# Make the request
|
|
1760
|
+
stream = client.stream_sanitize_user_prompt(requests=request_generator())
|
|
1761
|
+
|
|
1762
|
+
# Handle the response
|
|
1763
|
+
for response in stream:
|
|
1764
|
+
print(response)
|
|
1765
|
+
|
|
1766
|
+
Args:
|
|
1767
|
+
requests (Iterator[google.cloud.modelarmor_v1.types.SanitizeUserPromptRequest]):
|
|
1768
|
+
The request object iterator. Sanitize User Prompt request.
|
|
1769
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
1770
|
+
should be retried.
|
|
1771
|
+
timeout (float): The timeout for this request.
|
|
1772
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1773
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1774
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1775
|
+
be of type `bytes`.
|
|
1776
|
+
|
|
1777
|
+
Returns:
|
|
1778
|
+
Iterable[google.cloud.modelarmor_v1.types.SanitizeUserPromptResponse]:
|
|
1779
|
+
Sanitized User Prompt Response.
|
|
1780
|
+
"""
|
|
1781
|
+
|
|
1782
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1783
|
+
# and friendly error handling.
|
|
1784
|
+
rpc = self._transport._wrapped_methods[
|
|
1785
|
+
self._transport.stream_sanitize_user_prompt
|
|
1786
|
+
]
|
|
1787
|
+
|
|
1788
|
+
# Validate the universe domain.
|
|
1789
|
+
self._validate_universe_domain()
|
|
1790
|
+
|
|
1791
|
+
# Send the request.
|
|
1792
|
+
response = rpc(
|
|
1793
|
+
requests,
|
|
1794
|
+
retry=retry,
|
|
1795
|
+
timeout=timeout,
|
|
1796
|
+
metadata=metadata,
|
|
1797
|
+
)
|
|
1798
|
+
|
|
1799
|
+
# Done; return the response.
|
|
1800
|
+
return response
|
|
1801
|
+
|
|
1802
|
+
def stream_sanitize_model_response(
|
|
1803
|
+
self,
|
|
1804
|
+
requests: Optional[Iterator[service.SanitizeModelResponseRequest]] = None,
|
|
1805
|
+
*,
|
|
1806
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1807
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1808
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1809
|
+
) -> Iterable[service.SanitizeModelResponseResponse]:
|
|
1810
|
+
r"""Streaming version of Sanitizes Model Response.
|
|
1811
|
+
|
|
1812
|
+
.. code-block:: python
|
|
1813
|
+
|
|
1814
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1815
|
+
# code template only.
|
|
1816
|
+
# It will require modifications to work:
|
|
1817
|
+
# - It may require correct/in-range values for request initialization.
|
|
1818
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1819
|
+
# client as shown in:
|
|
1820
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1821
|
+
from google.cloud import modelarmor_v1
|
|
1822
|
+
|
|
1823
|
+
def sample_stream_sanitize_model_response():
|
|
1824
|
+
# Create a client
|
|
1825
|
+
client = modelarmor_v1.ModelArmorClient()
|
|
1826
|
+
|
|
1827
|
+
# Initialize request argument(s)
|
|
1828
|
+
model_response_data = modelarmor_v1.DataItem()
|
|
1829
|
+
model_response_data.text = "text_value"
|
|
1830
|
+
|
|
1831
|
+
request = modelarmor_v1.SanitizeModelResponseRequest(
|
|
1832
|
+
name="name_value",
|
|
1833
|
+
model_response_data=model_response_data,
|
|
1834
|
+
)
|
|
1835
|
+
|
|
1836
|
+
# This method expects an iterator which contains
|
|
1837
|
+
# 'modelarmor_v1.SanitizeModelResponseRequest' objects
|
|
1838
|
+
# Here we create a generator that yields a single `request` for
|
|
1839
|
+
# demonstrative purposes.
|
|
1840
|
+
requests = [request]
|
|
1841
|
+
|
|
1842
|
+
def request_generator():
|
|
1843
|
+
for request in requests:
|
|
1844
|
+
yield request
|
|
1845
|
+
|
|
1846
|
+
# Make the request
|
|
1847
|
+
stream = client.stream_sanitize_model_response(requests=request_generator())
|
|
1848
|
+
|
|
1849
|
+
# Handle the response
|
|
1850
|
+
for response in stream:
|
|
1851
|
+
print(response)
|
|
1852
|
+
|
|
1853
|
+
Args:
|
|
1854
|
+
requests (Iterator[google.cloud.modelarmor_v1.types.SanitizeModelResponseRequest]):
|
|
1855
|
+
The request object iterator. Sanitize Model Response request.
|
|
1856
|
+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
|
|
1857
|
+
should be retried.
|
|
1858
|
+
timeout (float): The timeout for this request.
|
|
1859
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1860
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1861
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1862
|
+
be of type `bytes`.
|
|
1863
|
+
|
|
1864
|
+
Returns:
|
|
1865
|
+
Iterable[google.cloud.modelarmor_v1.types.SanitizeModelResponseResponse]:
|
|
1866
|
+
Sanitized Model Response Response.
|
|
1867
|
+
"""
|
|
1868
|
+
|
|
1869
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1870
|
+
# and friendly error handling.
|
|
1871
|
+
rpc = self._transport._wrapped_methods[
|
|
1872
|
+
self._transport.stream_sanitize_model_response
|
|
1873
|
+
]
|
|
1874
|
+
|
|
1875
|
+
# Validate the universe domain.
|
|
1876
|
+
self._validate_universe_domain()
|
|
1877
|
+
|
|
1878
|
+
# Send the request.
|
|
1879
|
+
response = rpc(
|
|
1880
|
+
requests,
|
|
1881
|
+
retry=retry,
|
|
1882
|
+
timeout=timeout,
|
|
1883
|
+
metadata=metadata,
|
|
1884
|
+
)
|
|
1885
|
+
|
|
1886
|
+
# Done; return the response.
|
|
1887
|
+
return response
|
|
1888
|
+
|
|
1713
1889
|
def __enter__(self) -> "ModelArmorClient":
|
|
1714
1890
|
return self
|
|
1715
1891
|
|