Skip to content

Commit c68d559

Browse files
qiaodevcopybara-github
authored andcommitted
fix: Deprecate disable_attribution in GoogleSearchRetrieval.
PiperOrigin-RevId: 662280701
1 parent 281c171 commit c68d559

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

tests/system/vertexai/test_generative_models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,7 @@ def test_grounding_google_search_retriever(self, api_endpoint):
298298
model = preview_generative_models.GenerativeModel(GEMINI_MODEL_NAME)
299299
google_search_retriever_tool = (
300300
preview_generative_models.Tool.from_google_search_retrieval(
301-
preview_generative_models.grounding.GoogleSearchRetrieval(
302-
disable_attribution=False
303-
)
301+
preview_generative_models.grounding.GoogleSearchRetrieval()
304302
)
305303
)
306304
response = model.generate_content(

tests/unit/vertexai/test_generative_models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,9 +1016,7 @@ def test_generate_content_grounding_google_search_retriever_preview(self):
10161016
model = preview_generative_models.GenerativeModel("gemini-pro")
10171017
google_search_retriever_tool = (
10181018
preview_generative_models.Tool.from_google_search_retrieval(
1019-
preview_generative_models.grounding.GoogleSearchRetrieval(
1020-
disable_attribution=False
1021-
)
1019+
preview_generative_models.grounding.GoogleSearchRetrieval()
10221020
)
10231021
)
10241022
response = model.generate_content(

vertexai/generative_models/_generative_models.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,20 +2310,22 @@ class GoogleSearchRetrieval:
23102310

23112311
def __init__(
23122312
self,
2313-
disable_attribution: Optional[bool] = None,
2313+
disable_attribution: Optional[
2314+
bool
2315+
] = None, # pylint: disable=unused-argument
23142316
):
23152317
"""Initializes a Google Search Retrieval tool.
23162318
23172319
Args:
23182320
disable_attribution (bool):
2319-
Optional. Disable using the result from this
2320-
tool in detecting grounding attribution. This
2321+
Optional. This field is Deprecated. Disable using the result
2322+
from this tool in detecting grounding attribution. This
23212323
does not affect how the result is given to the
23222324
model for generation.
23232325
"""
2324-
self._raw_google_search_retrieval = gapic_tool_types.GoogleSearchRetrieval(
2325-
disable_attribution=disable_attribution,
2326-
)
2326+
if disable_attribution is not None:
2327+
warnings.warn("disable_attribution is deprecated.")
2328+
self._raw_google_search_retrieval = gapic_tool_types.GoogleSearchRetrieval()
23272329

23282330

23292331
def _to_content(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy