google-cloud-modelarmor 0.5.0__tar.gz → 0.6.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.
Files changed (56) hide show
  1. {google_cloud_modelarmor-0.5.0/google_cloud_modelarmor.egg-info → google_cloud_modelarmor-0.6.0}/PKG-INFO +13 -11
  2. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/README.rst +12 -10
  3. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor/gapic_version.py +1 -1
  4. {google_cloud_modelarmor-0.5.0/google/cloud/modelarmor_v1beta → google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1}/gapic_version.py +1 -1
  5. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/__init__.py +4 -0
  6. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/gapic_metadata.json +30 -0
  7. {google_cloud_modelarmor-0.5.0/google/cloud/modelarmor_v1 → google_cloud_modelarmor-0.6.0/google/cloud/modelarmor_v1beta}/gapic_version.py +1 -1
  8. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/async_client.py +177 -0
  9. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/client.py +176 -0
  10. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/base.py +34 -0
  11. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/grpc.py +60 -0
  12. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/grpc_asyncio.py +72 -0
  13. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/rest.py +61 -0
  14. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/rest_base.py +8 -0
  15. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/types/__init__.py +4 -0
  16. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/types/service.py +140 -7
  17. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0/google_cloud_modelarmor.egg-info}/PKG-INFO +13 -11
  18. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/tests/unit/gapic/modelarmor_v1beta/test_model_armor.py +406 -0
  19. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/LICENSE +0 -0
  20. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/MANIFEST.in +0 -0
  21. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor/__init__.py +0 -0
  22. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor/py.typed +0 -0
  23. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/__init__.py +0 -0
  24. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/gapic_metadata.json +0 -0
  25. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/py.typed +0 -0
  26. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/__init__.py +0 -0
  27. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/__init__.py +0 -0
  28. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/async_client.py +0 -0
  29. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/client.py +0 -0
  30. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/pagers.py +0 -0
  31. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/__init__.py +0 -0
  32. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/base.py +0 -0
  33. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/grpc.py +0 -0
  34. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/grpc_asyncio.py +0 -0
  35. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/rest.py +0 -0
  36. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/services/model_armor/transports/rest_base.py +0 -0
  37. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/types/__init__.py +0 -0
  38. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1/types/service.py +0 -0
  39. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/py.typed +0 -0
  40. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/__init__.py +0 -0
  41. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/__init__.py +0 -0
  42. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/pagers.py +0 -0
  43. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google/cloud/modelarmor_v1beta/services/model_armor/transports/__init__.py +0 -0
  44. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google_cloud_modelarmor.egg-info/SOURCES.txt +0 -0
  45. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google_cloud_modelarmor.egg-info/dependency_links.txt +0 -0
  46. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google_cloud_modelarmor.egg-info/not-zip-safe +0 -0
  47. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google_cloud_modelarmor.egg-info/requires.txt +0 -0
  48. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/google_cloud_modelarmor.egg-info/top_level.txt +0 -0
  49. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/setup.cfg +0 -0
  50. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/setup.py +0 -0
  51. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/tests/__init__.py +0 -0
  52. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/tests/unit/__init__.py +0 -0
  53. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/tests/unit/gapic/__init__.py +0 -0
  54. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/tests/unit/gapic/modelarmor_v1/__init__.py +0 -0
  55. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/tests/unit/gapic/modelarmor_v1/test_model_armor.py +0 -0
  56. {google_cloud_modelarmor-0.5.0 → google_cloud_modelarmor-0.6.0}/tests/unit/gapic/modelarmor_v1beta/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-cloud-modelarmor
3
- Version: 0.5.0
3
+ Version: 0.6.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
@@ -41,12 +41,14 @@ Dynamic: requires-dist
41
41
  Dynamic: requires-python
42
42
  Dynamic: summary
43
43
 
44
- Python Client for Model Armor API
45
- =================================
44
+ Python Client for Model Armor
45
+ =============================
46
46
 
47
47
  |preview| |pypi| |versions|
48
48
 
49
- `Model Armor API`_: Model Armor helps you protect against risks like prompt injection, harmful content, and data leakage in generative AI applications by letting you define policies that filter user prompts and model responses.
49
+ `Model Armor`_: Model Armor helps you protect against risks like prompt injection, harmful
50
+ content, and data leakage in generative AI applications by letting you
51
+ define policies that filter user prompts and model responses.
50
52
 
51
53
  - `Client Library Documentation`_
52
54
  - `Product Documentation`_
@@ -57,9 +59,9 @@ Python Client for Model Armor API
57
59
  :target: https://pypi.org/project/google-cloud-modelarmor/
58
60
  .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-modelarmor.svg
59
61
  :target: https://pypi.org/project/google-cloud-modelarmor/
60
- .. _Model Armor API: https://cloud.google.com/security-command-center/docs/model-armor-overview
62
+ .. _Model Armor: https://cloud.google.com/security-command-center/
61
63
  .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/google-cloud-modelarmor/latest/summary_overview
62
- .. _Product Documentation: https://cloud.google.com/security-command-center/docs/model-armor-overview
64
+ .. _Product Documentation: https://cloud.google.com/security-command-center/
63
65
 
64
66
  Quick Start
65
67
  -----------
@@ -68,12 +70,12 @@ In order to use this library, you first need to go through the following steps:
68
70
 
69
71
  1. `Select or create a Cloud Platform project.`_
70
72
  2. `Enable billing for your project.`_
71
- 3. `Enable the Model Armor API.`_
73
+ 3. `Enable the Model Armor.`_
72
74
  4. `Set up Authentication.`_
73
75
 
74
76
  .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
75
77
  .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
76
- .. _Enable the Model Armor API.: https://cloud.google.com/security-command-center/docs/model-armor-overview
78
+ .. _Enable the Model Armor.: https://cloud.google.com/security-command-center/
77
79
  .. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
78
80
 
79
81
  Installation
@@ -140,14 +142,14 @@ Windows
140
142
  Next Steps
141
143
  ~~~~~~~~~~
142
144
 
143
- - Read the `Client Library Documentation`_ for Model Armor API
145
+ - Read the `Client Library Documentation`_ for Model Armor
144
146
  to see other available methods on the client.
145
- - Read the `Model Armor API Product documentation`_ to learn
147
+ - Read the `Model Armor Product documentation`_ to learn
146
148
  more about the product and see How-to Guides.
147
149
  - View this `README`_ to see the full list of Cloud
148
150
  APIs that we cover.
149
151
 
150
- .. _Model Armor API Product documentation: https://cloud.google.com/security-command-center/docs/model-armor-overview
152
+ .. _Model Armor Product documentation: https://cloud.google.com/security-command-center/
151
153
  .. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
152
154
 
153
155
  Logging
@@ -1,9 +1,11 @@
1
- Python Client for Model Armor API
2
- =================================
1
+ Python Client for Model Armor
2
+ =============================
3
3
 
4
4
  |preview| |pypi| |versions|
5
5
 
6
- `Model Armor API`_: Model Armor helps you protect against risks like prompt injection, harmful content, and data leakage in generative AI applications by letting you define policies that filter user prompts and model responses.
6
+ `Model Armor`_: Model Armor helps you protect against risks like prompt injection, harmful
7
+ content, and data leakage in generative AI applications by letting you
8
+ define policies that filter user prompts and model responses.
7
9
 
8
10
  - `Client Library Documentation`_
9
11
  - `Product Documentation`_
@@ -14,9 +16,9 @@ Python Client for Model Armor API
14
16
  :target: https://pypi.org/project/google-cloud-modelarmor/
15
17
  .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-modelarmor.svg
16
18
  :target: https://pypi.org/project/google-cloud-modelarmor/
17
- .. _Model Armor API: https://cloud.google.com/security-command-center/docs/model-armor-overview
19
+ .. _Model Armor: https://cloud.google.com/security-command-center/
18
20
  .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/google-cloud-modelarmor/latest/summary_overview
19
- .. _Product Documentation: https://cloud.google.com/security-command-center/docs/model-armor-overview
21
+ .. _Product Documentation: https://cloud.google.com/security-command-center/
20
22
 
21
23
  Quick Start
22
24
  -----------
@@ -25,12 +27,12 @@ In order to use this library, you first need to go through the following steps:
25
27
 
26
28
  1. `Select or create a Cloud Platform project.`_
27
29
  2. `Enable billing for your project.`_
28
- 3. `Enable the Model Armor API.`_
30
+ 3. `Enable the Model Armor.`_
29
31
  4. `Set up Authentication.`_
30
32
 
31
33
  .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
32
34
  .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
33
- .. _Enable the Model Armor API.: https://cloud.google.com/security-command-center/docs/model-armor-overview
35
+ .. _Enable the Model Armor.: https://cloud.google.com/security-command-center/
34
36
  .. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
35
37
 
36
38
  Installation
@@ -97,14 +99,14 @@ Windows
97
99
  Next Steps
98
100
  ~~~~~~~~~~
99
101
 
100
- - Read the `Client Library Documentation`_ for Model Armor API
102
+ - Read the `Client Library Documentation`_ for Model Armor
101
103
  to see other available methods on the client.
102
- - Read the `Model Armor API Product documentation`_ to learn
104
+ - Read the `Model Armor Product documentation`_ to learn
103
105
  more about the product and see How-to Guides.
104
106
  - View this `README`_ to see the full list of Cloud
105
107
  APIs that we cover.
106
108
 
107
- .. _Model Armor API Product documentation: https://cloud.google.com/security-command-center/docs/model-armor-overview
109
+ .. _Model Armor Product documentation: https://cloud.google.com/security-command-center/
108
110
  .. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
109
111
 
110
112
  Logging
@@ -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.5.0" # {x-release-please-version}
16
+ __version__ = "0.6.0" # {x-release-please-version}
@@ -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.5.0" # {x-release-please-version}
16
+ __version__ = "0.6.0" # {x-release-please-version}
@@ -50,6 +50,7 @@ from .types.service import (
50
50
  ListTemplatesResponse,
51
51
  MaliciousUriFilterResult,
52
52
  MaliciousUriFilterSettings,
53
+ McpServerFloorSetting,
53
54
  MessageItem,
54
55
  MultiLanguageDetectionMetadata,
55
56
  PiAndJailbreakFilterResult,
@@ -71,6 +72,7 @@ from .types.service import (
71
72
  SdpFinding,
72
73
  SdpFindingLikelihood,
73
74
  SdpInspectResult,
75
+ StreamingMode,
74
76
  Template,
75
77
  UpdateFloorSettingRequest,
76
78
  UpdateTemplateRequest,
@@ -193,6 +195,7 @@ __all__ = (
193
195
  "ListTemplatesResponse",
194
196
  "MaliciousUriFilterResult",
195
197
  "MaliciousUriFilterSettings",
198
+ "McpServerFloorSetting",
196
199
  "MessageItem",
197
200
  "ModelArmorClient",
198
201
  "MultiLanguageDetectionMetadata",
@@ -215,6 +218,7 @@ __all__ = (
215
218
  "SdpFinding",
216
219
  "SdpFindingLikelihood",
217
220
  "SdpInspectResult",
221
+ "StreamingMode",
218
222
  "Template",
219
223
  "UpdateFloorSettingRequest",
220
224
  "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"
@@ -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.5.0" # {x-release-please-version}
16
+ __version__ = "0.6.0" # {x-release-please-version}
@@ -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_v1beta
1306
+
1307
+ async def sample_stream_sanitize_user_prompt():
1308
+ # Create a client
1309
+ client = modelarmor_v1beta.ModelArmorAsyncClient()
1310
+
1311
+ # Initialize request argument(s)
1312
+ user_prompt_data = modelarmor_v1beta.DataItem()
1313
+ user_prompt_data.text = "text_value"
1314
+
1315
+ request = modelarmor_v1beta.SanitizeUserPromptRequest(
1316
+ name="name_value",
1317
+ user_prompt_data=user_prompt_data,
1318
+ )
1319
+
1320
+ # This method expects an iterator which contains
1321
+ # 'modelarmor_v1beta.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_v1beta.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_v1beta.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_v1beta
1393
+
1394
+ async def sample_stream_sanitize_model_response():
1395
+ # Create a client
1396
+ client = modelarmor_v1beta.ModelArmorAsyncClient()
1397
+
1398
+ # Initialize request argument(s)
1399
+ model_response_data = modelarmor_v1beta.DataItem()
1400
+ model_response_data.text = "text_value"
1401
+
1402
+ request = modelarmor_v1beta.SanitizeModelResponseRequest(
1403
+ name="name_value",
1404
+ model_response_data=model_response_data,
1405
+ )
1406
+
1407
+ # This method expects an iterator which contains
1408
+ # 'modelarmor_v1beta.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_v1beta.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_v1beta.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,
@@ -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_v1beta
1735
+
1736
+ def sample_stream_sanitize_user_prompt():
1737
+ # Create a client
1738
+ client = modelarmor_v1beta.ModelArmorClient()
1739
+
1740
+ # Initialize request argument(s)
1741
+ user_prompt_data = modelarmor_v1beta.DataItem()
1742
+ user_prompt_data.text = "text_value"
1743
+
1744
+ request = modelarmor_v1beta.SanitizeUserPromptRequest(
1745
+ name="name_value",
1746
+ user_prompt_data=user_prompt_data,
1747
+ )
1748
+
1749
+ # This method expects an iterator which contains
1750
+ # 'modelarmor_v1beta.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_v1beta.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_v1beta.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_v1beta
1822
+
1823
+ def sample_stream_sanitize_model_response():
1824
+ # Create a client
1825
+ client = modelarmor_v1beta.ModelArmorClient()
1826
+
1827
+ # Initialize request argument(s)
1828
+ model_response_data = modelarmor_v1beta.DataItem()
1829
+ model_response_data.text = "text_value"
1830
+
1831
+ request = modelarmor_v1beta.SanitizeModelResponseRequest(
1832
+ name="name_value",
1833
+ model_response_data=model_response_data,
1834
+ )
1835
+
1836
+ # This method expects an iterator which contains
1837
+ # 'modelarmor_v1beta.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_v1beta.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_v1beta.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
 
@@ -234,6 +234,16 @@ class ModelArmorTransport(abc.ABC):
234
234
  default_timeout=60.0,
235
235
  client_info=client_info,
236
236
  ),
237
+ self.stream_sanitize_user_prompt: gapic_v1.method.wrap_method(
238
+ self.stream_sanitize_user_prompt,
239
+ default_timeout=None,
240
+ client_info=client_info,
241
+ ),
242
+ self.stream_sanitize_model_response: gapic_v1.method.wrap_method(
243
+ self.stream_sanitize_model_response,
244
+ default_timeout=None,
245
+ client_info=client_info,
246
+ ),
237
247
  self.get_location: gapic_v1.method.wrap_method(
238
248
  self.get_location,
239
249
  default_timeout=None,
@@ -342,6 +352,30 @@ class ModelArmorTransport(abc.ABC):
342
352
  ]:
343
353
  raise NotImplementedError()
344
354
 
355
+ @property
356
+ def stream_sanitize_user_prompt(
357
+ self,
358
+ ) -> Callable[
359
+ [service.SanitizeUserPromptRequest],
360
+ Union[
361
+ service.SanitizeUserPromptResponse,
362
+ Awaitable[service.SanitizeUserPromptResponse],
363
+ ],
364
+ ]:
365
+ raise NotImplementedError()
366
+
367
+ @property
368
+ def stream_sanitize_model_response(
369
+ self,
370
+ ) -> Callable[
371
+ [service.SanitizeModelResponseRequest],
372
+ Union[
373
+ service.SanitizeModelResponseResponse,
374
+ Awaitable[service.SanitizeModelResponseResponse],
375
+ ],
376
+ ]:
377
+ raise NotImplementedError()
378
+
345
379
  @property
346
380
  def get_location(
347
381
  self,