Skip to content

Commit 8097512

Browse files
authored
chore: Revert "feat: [google-cloud-modelarmor] A new field filter_config is added to message .google.cloud.modelarmor.v1.SanitizeUserPromptRequest" (#13546)
Reverts #13541 See discussion in cl/716621110
1 parent 6e892e0 commit 8097512

File tree

7 files changed

+9
-133
lines changed

7 files changed

+9
-133
lines changed

packages/google-cloud-modelarmor/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ In order to use this library, you first need to go through the following steps:
2626
1. `Select or create a Cloud Platform project.`_
2727
2. `Enable billing for your project.`_
2828
3. `Enable the Model Armor API.`_
29-
4. `Set up Authentication.`_
29+
4. `Setup Authentication.`_
3030

3131
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
3232
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
3333
.. _Enable the Model Armor API.: https://cloud.google.com/security-command-center/docs/model-armor-overview
34-
.. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
34+
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
3535

3636
Installation
3737
~~~~~~~~~~~~

packages/google-cloud-modelarmor/google/cloud/modelarmor/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.0.0" # {x-release-please-version}
16+
__version__ = "0.1.1" # {x-release-please-version}

packages/google-cloud-modelarmor/google/cloud/modelarmor_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.0.0" # {x-release-please-version}
16+
__version__ = "0.1.1" # {x-release-please-version}

packages/google-cloud-modelarmor/google/cloud/modelarmor_v1/types/service.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -901,31 +901,13 @@ class SdpAdvancedConfig(proto.Message):
901901
class SanitizeUserPromptRequest(proto.Message):
902902
r"""Sanitize User Prompt request.
903903
904-
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
905-
906904
Attributes:
907905
name (str):
908906
Required. Represents resource name of
909907
template e.g.
910908
name=projects/sample-project/locations/us-central1/templates/templ01
911909
user_prompt_data (google.cloud.modelarmor_v1.types.DataItem):
912910
Required. User prompt data to sanitize.
913-
filter_config (google.cloud.modelarmor_v1.types.FilterConfig):
914-
Optional. Optional Filter configuration to Sanitize User
915-
Prompt.
916-
917-
If below configuration is specified then Sanitization will
918-
be performed using settings in this configuration along with
919-
settings defined at template level (union of both).
920-
921-
If a filter setting overlaps, then the lowest threshold
922-
value i.e. value with greater false positives will be
923-
applied. For example, the ``filter_configuration`` defines
924-
LOW_AND_ABOVE confidence level for TOXICITY, and template
925-
defines HIGH confidence level, then Sanitization is
926-
performed using LOW_AND_ABOVE confidence level.
927-
928-
This field is a member of `oneof`_ ``_filter_config``.
929911
"""
930912

931913
name: str = proto.Field(
@@ -937,41 +919,18 @@ class SanitizeUserPromptRequest(proto.Message):
937919
number=2,
938920
message="DataItem",
939921
)
940-
filter_config: "FilterConfig" = proto.Field(
941-
proto.MESSAGE,
942-
number=3,
943-
optional=True,
944-
message="FilterConfig",
945-
)
946922

947923

948924
class SanitizeModelResponseRequest(proto.Message):
949925
r"""Sanitize Model Response request.
950926
951-
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
952-
953927
Attributes:
954928
name (str):
955929
Required. Represents resource name of
956930
template e.g.
957931
name=projects/sample-project/locations/us-central1/templates/templ01
958932
model_response_data (google.cloud.modelarmor_v1.types.DataItem):
959933
Required. Model response data to sanitize.
960-
filter_config (google.cloud.modelarmor_v1.types.FilterConfig):
961-
Optional. Optional Filter configuration to Sanitize User
962-
Prompt.
963-
964-
If below configuration is specified then Sanitization will
965-
be performed using settings in this configuration along with
966-
settings defined at template level (union of both).
967-
968-
If a filter overlaps, then the highest level of strictness
969-
will be applied. For example, the filter_configuration
970-
specifies LOW_AND_ABOVE confidence level for TOXICITY filter
971-
and template uses HIGH confidence level, then Sanitization
972-
is performed using LOW_AND_ABOVE confidence level.
973-
974-
This field is a member of `oneof`_ ``_filter_config``.
975934
user_prompt (str):
976935
Optional. User Prompt associated with Model
977936
response.
@@ -986,12 +945,6 @@ class SanitizeModelResponseRequest(proto.Message):
986945
number=2,
987946
message="DataItem",
988947
)
989-
filter_config: "FilterConfig" = proto.Field(
990-
proto.MESSAGE,
991-
number=3,
992-
optional=True,
993-
message="FilterConfig",
994-
)
995948
user_prompt: str = proto.Field(
996949
proto.STRING,
997950
number=4,

packages/google-cloud-modelarmor/noxfile.py

Lines changed: 2 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -382,29 +382,20 @@ def docfx(session):
382382
["python", "upb", "cpp"],
383383
)
384384
def prerelease_deps(session, protobuf_implementation):
385-
"""
386-
Run all tests with pre-release versions of dependencies installed
387-
rather than the standard non pre-release versions.
388-
Pre-releases versions can be installed using
389-
`pip install --pre <package>`.
390-
"""
385+
"""Run all tests with prerelease versions of dependencies installed."""
391386

392387
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
393388
session.skip("cpp implementation is not supported in python 3.11+")
394389

395390
# Install all dependencies
396-
session.install("-e", ".")
397-
391+
session.install("-e", ".[all, tests, tracing]")
398392
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
399-
# Install dependencies for the unit test environment
400393
session.install(*unit_deps_all)
401-
402394
system_deps_all = (
403395
SYSTEM_TEST_STANDARD_DEPENDENCIES
404396
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
405397
+ SYSTEM_TEST_EXTRAS
406398
)
407-
# Install dependencies for the system test environment
408399
session.install(*system_deps_all)
409400

410401
# Because we test minimum dependency versions on the minimum Python
@@ -426,7 +417,6 @@ def prerelease_deps(session, protobuf_implementation):
426417
)
427418
]
428419

429-
# Install dependencies specified in `testing/constraints-X.txt`.
430420
session.install(*constraints_deps)
431421

432422
prerel_deps = [
@@ -468,70 +458,3 @@ def prerelease_deps(session, protobuf_implementation):
468458
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
469459
},
470460
)
471-
472-
473-
@nox.session(python="3.13")
474-
@nox.parametrize(
475-
"protobuf_implementation",
476-
["python", "upb"],
477-
)
478-
def core_deps_from_source(session, protobuf_implementation):
479-
"""Run all tests with local versions of core dependencies installed,
480-
rather than pulling core dependencies from PyPI.
481-
"""
482-
483-
# Install all dependencies
484-
session.install(".")
485-
486-
# Install dependencies for the unit test environment
487-
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
488-
session.install(*unit_deps_all)
489-
490-
# Install dependencies for the system test environment
491-
system_deps_all = (
492-
SYSTEM_TEST_STANDARD_DEPENDENCIES
493-
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
494-
+ SYSTEM_TEST_EXTRAS
495-
)
496-
session.install(*system_deps_all)
497-
498-
# Because we test minimum dependency versions on the minimum Python
499-
# version, the first version we test with in the unit tests sessions has a
500-
# constraints file containing all dependencies and extras that should be installed.
501-
with open(
502-
CURRENT_DIRECTORY
503-
/ "testing"
504-
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
505-
encoding="utf-8",
506-
) as constraints_file:
507-
constraints_text = constraints_file.read()
508-
509-
# Ignore leading whitespace and comment lines.
510-
constraints_deps = [
511-
match.group(1)
512-
for match in re.finditer(
513-
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
514-
)
515-
]
516-
517-
# Install dependencies specified in `testing/constraints-X.txt`.
518-
session.install(*constraints_deps)
519-
520-
core_dependencies_from_source = [
521-
"google-api-core @ git+https://github.com/googleapis/python-api-core.git",
522-
"google-auth @ git+https://github.com/googleapis/google-auth-library-python.git",
523-
f"{CURRENT_DIRECTORY}/../googleapis-common-protos",
524-
f"{CURRENT_DIRECTORY}/../grpc-google-iam-v1",
525-
"proto-plus @ git+https://github.com/googleapis/proto-plus-python.git",
526-
]
527-
528-
for dep in core_dependencies_from_source:
529-
session.install(dep, "--ignore-installed", "--no-deps")
530-
531-
session.run(
532-
"py.test",
533-
"tests/unit",
534-
env={
535-
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
536-
},
537-
)

packages/google-cloud-modelarmor/samples/generated_samples/snippet_metadata_google.cloud.modelarmor.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-modelarmor",
11-
"version": "0.1.0"
11+
"version": "0.1.1"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-modelarmor/scripts/fixup_modelarmor_v1_keywords.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class modelarmorCallTransformer(cst.CSTTransformer):
4444
'get_floor_setting': ('name', ),
4545
'get_template': ('name', ),
4646
'list_templates': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ),
47-
'sanitize_model_response': ('name', 'model_response_data', 'filter_config', 'user_prompt', ),
48-
'sanitize_user_prompt': ('name', 'user_prompt_data', 'filter_config', ),
47+
'sanitize_model_response': ('name', 'model_response_data', 'user_prompt', ),
48+
'sanitize_user_prompt': ('name', 'user_prompt_data', ),
4949
'update_floor_setting': ('floor_setting', 'update_mask', ),
5050
'update_template': ('update_mask', 'template', 'request_id', ),
5151
}

0 commit comments

Comments
 (0)