BerriAI / litellm

Python SDK, Proxy Server to call 100+ LLM APIs using the OpenAI format - [Bedrock, Azure, OpenAI, VertexAI, Cohere, Anthropic, Sagemaker, HuggingFace, Replicate, Groq]
https://docs.litellm.ai/docs/
Other
12.3k stars 1.43k forks source link

[Feature]: Proxy: Support Anthropic Claude 3 Opus on Google Vertex AI #3022

Closed demux79 closed 5 months ago

demux79 commented 5 months ago

The Feature

Google Vertex AI now supports Claude 3 Opus in beta. Adding it to the model config works fine. However, our default retry setting causes an error using the proxy health check:

{ "model": "vertex_ai/claude-3-opus@20240229", "max_retries": 2, "cache": { "no-cache": true }, "error": "AsyncMessages.create() got an unexpected keyword argument 'max_retries' stack trace: Traceback (most recent call last):\n File \"/usr/local/lib/python3.11/site-packages/litellm/main.py\", line 317, in acompletion\n response = await init_response\n ^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/litellm/llms/vertex_ai_anthropic.py\", line 355, in async_completion\n message = await vertex_ai_client.messages.create(*data) # type: ignore\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/anthropic/_utils/_utils.py\", line 275, in wrapper\n return func(args, kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\nTypeError: AsyncMessages.create() got an unexpected keyword argument 'max_retries'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.11/site-packages/litellm/main.py\", line 3818, in ahealth_check\n await acompletion(model_params)\n File \"/usr/local/lib/python3.11/site-packages/litellm/utils.py\"," },

Motivation, pitch

It's the latest and greatest model from Anthropic which would be nice to use via Google Vertex AI.

Dev-Khant commented 5 months ago

Looks like this error is because of max_tries. Is it correlated with model not being present?

Dev-Khant commented 5 months ago

Anyway I have opened a PR.

krrishdholakia commented 5 months ago

added - https://github.com/BerriAI/litellm/commit/ab1e26ad89d7f29e8ae47b1187331bb620cc168a