Support fine-tuned gemini model path to use google_search_tool

PiperOrigin-RevId: 761543344
This commit is contained in:
Google Team Member 2025-05-21 08:58:38 -07:00 committed by Copybara-Service
parent 62a543bd58
commit 1561b0f15c

View File

@ -46,7 +46,7 @@ class GoogleSearchTool(BaseTool):
) -> None:
llm_request.config = llm_request.config or types.GenerateContentConfig()
llm_request.config.tools = llm_request.config.tools or []
if llm_request.model and llm_request.model.startswith('gemini-1'):
if llm_request.model and 'gemini-1' in llm_request.model:
if llm_request.config.tools:
print(llm_request.config.tools)
raise ValueError(
@ -55,7 +55,7 @@ class GoogleSearchTool(BaseTool):
llm_request.config.tools.append(
types.Tool(google_search_retrieval=types.GoogleSearchRetrieval())
)
elif llm_request.model and llm_request.model.startswith('gemini-2'):
elif llm_request.model and 'gemini-2' in llm_request.model:
llm_request.config.tools.append(
types.Tool(google_search=types.GoogleSearch())
)