google-cloud-platformlarge-language-modelgoogle-searchgoogle-cloud-vertex-aigoogle-gemini

How to use Google Search Grounding with Dynamic Retrieval Configuration


I'm trying to use Google Search for grounding in Vertex AI with dynamic retrieval configuration, but I'm encountering issues with the Tool.from_google_search_retrieval method.

from vertexai.generative_models import Tool, grounding

tool = Tool.from_google_search_retrieval(grounding.GoogleSearchRetrieval())

responses = model.generate_content(
    prompt,
    tools=tool
    generation_config=self.generation_config
)

This works. But when I Try to set the threshold like using a dictionary explained here I encounter in an error.


Solution

  • The solution was solved in this issue here