The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
feat: add enterpriseWebSearch tool for vertex-ai (#9856)
qvalentin93532e00dbed
diff --git a/docs/my-website/docs/providers/vertex.md b/docs/my-website/docs/providers/vertex.mdindex ab13a511371..cdd3fce6c65 100644--- a/docs/my-website/docs/providers/vertex.md+++ b/docs/my-website/docs/providers/vertex.md@@ -398,6 +398,8 @@ curl http://localhost:4000/v1/chat/completions \</TabItem></Tabs>+You can also use the `enterpriseWebSearch` tool for an [enterprise compliant search](https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise).+#### **Moving from Vertex AI SDK to LiteLLM (GROUNDING)**diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.pyindex 749b6d94287..e7d3d2b060e 100644--- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py+++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py@@ -240,6 +240,7 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):gtool_func_declarations = []googleSearch: Optional[dict] = NonegoogleSearchRetrieval: Optional[dict] = None+ enterpriseWebSearch: Optional[dict] = Nonecode_execution: Optional[dict] = None# remove 'additionalProperties' from toolsvalue = _remove_additional_properties(value)@@ -273,6 +274,8 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):googleSearch = tool["googleSearch"]elif tool.get("googleSearchRetrieval", None) is not None:googleSearchRetrieval = tool["googleSearchRetrieval"]+ elif tool.get("enterpriseWebSearch", None) is not None:+ enterpriseWebSearch = tool["enterpriseWebSearch"]elif tool.get("code_execution", None) is not None:code_execution = tool["code_execution"]elif openai_function_object is not None:@@ -299,6 +302,8 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):_tools["googleSearch"] = googleSearchif googleSearchRetrieval is not None:_tools["googleSearchRetrieval"] = googleSearchRetrieval+ if enterpriseWebSearch is not None:+ _tools["enterpriseWebSearch"] = enterpriseWebSearchif code_execution is not None:_tools["code_execution"] = code_executionreturn [_tools]diff --git a/litellm/types/llms/vertex_ai.py b/litellm/types/llms/vertex_ai.pyindex 7fa167938f1..2e25f259b0a 100644--- a/litellm/types/llms/vertex_ai.py+++ b/litellm/types/llms/vertex_ai.py@@ -187,6 +187,7 @@ class Tools(TypedDict, total=False):function_declarations: List[FunctionDeclaration]googleSearch: dictgoogleSearchRetrieval: dict+ enterpriseWebSearch: dictcode_execution: dictretrieval: Retrievaldiff --git a/tests/llm_translation/test_vertex.py b/tests/llm_translation/test_vertex.pyindex d821fb415eb..9118d94a6f3 100644--- a/tests/llm_translation/test_vertex.py+++ b/tests/llm_translation/test_vertex.py@@ -141,6 +141,7 @@ def test_build_vertex_schema():[([{"googleSearch": {}}], "googleSearch"),([{"googleSearchRetrieval": {}}], "googleSearchRetrieval"),+ ([{"enterpriseWebSearch": {}}], "enterpriseWebSearch"),([{"code_execution": {}}], "code_execution"),],)