From aec5c20a0d6c7cadfd458be4e9334a78f0deff6f Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 8 Jul 2024 21:45:17 -0700 Subject: [PATCH] docs(vertex.md): add vertex ai grounding to docs --- docs/my-website/docs/providers/vertex.md | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/docs/my-website/docs/providers/vertex.md b/docs/my-website/docs/providers/vertex.md index 7872f42d0f..07caa91893 100644 --- a/docs/my-website/docs/providers/vertex.md +++ b/docs/my-website/docs/providers/vertex.md @@ -330,6 +330,51 @@ Return a `list[Recipe]` completion(model="vertex_ai_beta/gemini-1.5-flash-preview-0514", messages=messages, response_format={ "type": "json_object" }) ``` +### **Grounding** + +Add Google Search Result grounding to vertex ai calls. + + + + +```python +from litellm import completion + +## SETUP ENVIRONMENT +# !gcloud auth application-default login - run this to add vertex credentials to your env + +tools = [{"googleSearchRetrieval": {}}] # 👈 ADD GOOGLE SEARCH + +resp = litellm.completion( + model="vertex_ai_beta/gemini-1.0-pro-001", + messages=[{"role": "user", "content": "Who won the world cup?"}], + tools=tools, + ) + +print(resp) +``` + + + +```bash +curl http://0.0.0.0:4000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-4o", + "messages": [{"role": "user", "content": "Who won the world cup?"}], + "tools": [ + { + "googleSearchResults": {} + } + ] + }' + +``` + + + + ## Pre-requisites * `pip install google-cloud-aiplatform` (pre-installed on proxy docker image) * Authentication: