From f310ce541f3e9a9a389f2eed418846b79f9ea203 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 21 Aug 2024 17:41:49 -0700 Subject: [PATCH] docs(vertex.md): add vertex global safety settings to doc --- docs/my-website/docs/providers/vertex.md | 60 ++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/docs/my-website/docs/providers/vertex.md b/docs/my-website/docs/providers/vertex.md index 95dac9fc09e..b8dad6ccdcb 100644 --- a/docs/my-website/docs/providers/vertex.md +++ b/docs/my-website/docs/providers/vertex.md @@ -661,6 +661,7 @@ Here's how to use Vertex AI with the LiteLLM Proxy Server ## Specifying Safety Settings In certain use-cases you may need to make calls to the models and pass [safety settigns](https://ai.google.dev/docs/safety_setting_gemini) different from the defaults. To do so, simple pass the `safety_settings` argument to `completion` or `acompletion`. For example: +### Set per model/request @@ -752,6 +753,65 @@ response = client.chat.completions.create( +### Set Globally + + + + + +```python +import litellm + +litellm.set_verbose = True 👈 See RAW REQUEST/RESPONSE + +litellm.vertex_ai_safety_settings = [ + { + "category": "HARM_CATEGORY_HARASSMENT", + "threshold": "BLOCK_NONE", + }, + { + "category": "HARM_CATEGORY_HATE_SPEECH", + "threshold": "BLOCK_NONE", + }, + { + "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", + "threshold": "BLOCK_NONE", + }, + { + "category": "HARM_CATEGORY_DANGEROUS_CONTENT", + "threshold": "BLOCK_NONE", + }, + ] +response = completion( + model="vertex_ai/gemini-pro", + messages=[{"role": "user", "content": "write code for saying hi from LiteLLM"}] +) +``` + + + +```yaml +model_list: + - model_name: gemini-experimental + litellm_params: + model: vertex_ai/gemini-experimental + vertex_project: litellm-epic + vertex_location: us-central1 + +litellm_settings: + vertex_ai_safety_settings: + - category: HARM_CATEGORY_HARASSMENT + threshold: BLOCK_NONE + - category: HARM_CATEGORY_HATE_SPEECH + threshold: BLOCK_NONE + - category: HARM_CATEGORY_SEXUALLY_EXPLICIT + threshold: BLOCK_NONE + - category: HARM_CATEGORY_DANGEROUS_CONTENT + threshold: BLOCK_NONE +``` + + + ## Set Vertex Project & Vertex Location All calls using Vertex AI require the following parameters: * Your Project ID