From e1f84b1bd96f02cc9b1d7358a31035cf3fb0ff5a Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 29 Jun 2024 09:23:21 -0700 Subject: [PATCH] docs(vertex.md): add vertex pdf example to docs --- docs/my-website/docs/providers/vertex.md | 80 ++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/docs/my-website/docs/providers/vertex.md b/docs/my-website/docs/providers/vertex.md index de1b5811f1..5e2c72060b 100644 --- a/docs/my-website/docs/providers/vertex.md +++ b/docs/my-website/docs/providers/vertex.md @@ -645,6 +645,86 @@ assert isinstance( ``` +## Usage - PDF / Videos / etc. Files + +Pass any file supported by Vertex AI, through LiteLLM. + + + + +```python +from litellm import completion + +response = completion( + model="vertex_ai/gemini-1.5-flash", + messages=[ + { + "role": "user", + "content": [ + {"type": "text", "text": "You are a very professional document summarization specialist. Please summarize the given document."}, + { + "type": "image_url", + "image_url": "gs://cloud-samples-data/generative-ai/pdf/2403.05530.pdf", + }, + ], + } + ], + max_tokens=300, +) + +print(response.choices[0]) + +``` + + + +1. Add model to config + +```yaml +- model_name: gemini-1.5-flash + litellm_params: + model: vertex_ai/gemini-1.5-flash + vertex_credentials: "/path/to/service_account.json" +``` + +2. Start Proxy + +``` +litellm --config /path/to/config.yaml +``` + +3. Test it! + +```bash +curl http://0.0.0.0:4000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer " \ + -d '{ + "model": "gemini-1.5-flash", + "messages": [ + { + "role": "user", + "content": [ + { + "type": "text", + "text": "You are a very professional document summarization specialist. Please summarize the given document" + }, + { + "type": "image_url", + "image_url": "gs://cloud-samples-data/generative-ai/pdf/2403.05530.pdf", + }, + } + ] + } + ], + "max_tokens": 300 + }' + +``` + + + + ## Chat Models | Model Name | Function Call | |------------------|--------------------------------------|