Skip to content

Commit

Permalink
fix: Deprecate disable_attribution in GoogleSearchRetrieval.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 662280701
  • Loading branch information
happy-qiao authored and copybara-github committed Aug 13, 2024
1 parent 281c171 commit c68d559
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions tests/system/vertexai/test_generative_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,7 @@ def test_grounding_google_search_retriever(self, api_endpoint):
model = preview_generative_models.GenerativeModel(GEMINI_MODEL_NAME)
google_search_retriever_tool = (
preview_generative_models.Tool.from_google_search_retrieval(
preview_generative_models.grounding.GoogleSearchRetrieval(
disable_attribution=False
)
preview_generative_models.grounding.GoogleSearchRetrieval()
)
)
response = model.generate_content(
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/vertexai/test_generative_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,9 +1016,7 @@ def test_generate_content_grounding_google_search_retriever_preview(self):
model = preview_generative_models.GenerativeModel("gemini-pro")
google_search_retriever_tool = (
preview_generative_models.Tool.from_google_search_retrieval(
preview_generative_models.grounding.GoogleSearchRetrieval(
disable_attribution=False
)
preview_generative_models.grounding.GoogleSearchRetrieval()
)
)
response = model.generate_content(
Expand Down
14 changes: 8 additions & 6 deletions vertexai/generative_models/_generative_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2310,20 +2310,22 @@ class GoogleSearchRetrieval:

def __init__(
self,
disable_attribution: Optional[bool] = None,
disable_attribution: Optional[
bool
] = None, # pylint: disable=unused-argument
):
"""Initializes a Google Search Retrieval tool.
Args:
disable_attribution (bool):
Optional. Disable using the result from this
tool in detecting grounding attribution. This
Optional. This field is Deprecated. Disable using the result
from this tool in detecting grounding attribution. This
does not affect how the result is given to the
model for generation.
"""
self._raw_google_search_retrieval = gapic_tool_types.GoogleSearchRetrieval(
disable_attribution=disable_attribution,
)
if disable_attribution is not None:
warnings.warn("disable_attribution is deprecated.")
self._raw_google_search_retrieval = gapic_tool_types.GoogleSearchRetrieval()


def _to_content(
Expand Down

0 comments on commit c68d559

Please sign in to comment.