diff --git a/litellm/llms/vertex_httpx.py b/litellm/llms/vertex_httpx.py index b5f460954..7676744e8 100644 --- a/litellm/llms/vertex_httpx.py +++ b/litellm/llms/vertex_httpx.py @@ -394,16 +394,19 @@ class VertexGeminiConfig: google_search_tool: Optional[dict] = None for tool in value: # check if grounding - _search_tool = tool.get("googleSearchRetrieval", None) - if google_search_tool is not None: - google_search_tool = _search_tool - else: + try: gtool_func_declaration = FunctionDeclaration( name=tool["function"]["name"], description=tool["function"].get("description", ""), parameters=tool["function"].get("parameters", {}), ) gtool_func_declarations.append(gtool_func_declaration) + except KeyError: + # assume it's a provider-specific param + verbose_logger.warning( + "Got KeyError parsing tool={}. Assuming it's a provider-specific param. Use `litellm.set_verbose` or `litellm --detailed_debug` to see raw request." + ) + google_search_tool = tool _tools = Tools(function_declarations=gtool_func_declarations) if google_search_tool is not None: _tools["googleSearchRetrieval"] = google_search_tool diff --git a/litellm/tests/test_amazing_vertex_completion.py b/litellm/tests/test_amazing_vertex_completion.py index 746527594..211f093d9 100644 --- a/litellm/tests/test_amazing_vertex_completion.py +++ b/litellm/tests/test_amazing_vertex_completion.py @@ -682,18 +682,6 @@ def test_gemini_pro_grounding(): load_vertex_ai_credentials() litellm.set_verbose = True - messages = [ - { - "role": "system", - "content": "Your name is Litellm Bot, you are a helpful assistant", - }, - # User asks for their name and weather in San Francisco - { - "role": "user", - "content": "Hello, what is your name and can you tell me the weather?", - }, - ] - tools = [{"googleSearchRetrieval": {}}] litellm.set_verbose = True @@ -710,8 +698,8 @@ def test_gemini_pro_grounding(): tools=tools, client=client, ) - except Exception: - pass + except Exception as e: + print("Received Exception - {}".format(str(e))) mock_call.assert_called_once()