mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 18:24:20 +00:00
feat: add enterpriseWebSearch tool for vertex-ai (#9856)
This commit is contained in:
parent
d5e362459c
commit
93532e00db
4 changed files with 9 additions and 0 deletions
|
@ -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)**
|
||||
|
||||
|
||||
|
|
|
@ -240,6 +240,7 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
|
|||
gtool_func_declarations = []
|
||||
googleSearch: Optional[dict] = None
|
||||
googleSearchRetrieval: Optional[dict] = None
|
||||
enterpriseWebSearch: Optional[dict] = None
|
||||
code_execution: Optional[dict] = None
|
||||
# remove 'additionalProperties' from tools
|
||||
value = _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"] = googleSearch
|
||||
if googleSearchRetrieval is not None:
|
||||
_tools["googleSearchRetrieval"] = googleSearchRetrieval
|
||||
if enterpriseWebSearch is not None:
|
||||
_tools["enterpriseWebSearch"] = enterpriseWebSearch
|
||||
if code_execution is not None:
|
||||
_tools["code_execution"] = code_execution
|
||||
return [_tools]
|
||||
|
|
|
@ -187,6 +187,7 @@ class Tools(TypedDict, total=False):
|
|||
function_declarations: List[FunctionDeclaration]
|
||||
googleSearch: dict
|
||||
googleSearchRetrieval: dict
|
||||
enterpriseWebSearch: dict
|
||||
code_execution: dict
|
||||
retrieval: Retrieval
|
||||
|
||||
|
|
|
@ -141,6 +141,7 @@ def test_build_vertex_schema():
|
|||
[
|
||||
([{"googleSearch": {}}], "googleSearch"),
|
||||
([{"googleSearchRetrieval": {}}], "googleSearchRetrieval"),
|
||||
([{"enterpriseWebSearch": {}}], "enterpriseWebSearch"),
|
||||
([{"code_execution": {}}], "code_execution"),
|
||||
],
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue