The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix vertex ai use _get_async_client
Ishaan Jaff1e8cf9f2a6a1
diff --git a/litellm/llms/vertex_ai_and_google_ai_studio/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai_and_google_ai_studio/gemini/vertex_and_google_ai_studio_gemini.pyindex 669167c1723..abe8b29edf7 100644--- a/litellm/llms/vertex_ai_and_google_ai_studio/gemini/vertex_and_google_ai_studio_gemini.py+++ b/litellm/llms/vertex_ai_and_google_ai_studio/gemini/vertex_and_google_ai_studio_gemini.py@@ -19,7 +19,11 @@ import litellm.litellm_core_utilsimport litellm.litellm_core_utils.litellm_loggingfrom litellm import verbose_loggerfrom litellm.litellm_core_utils.core_helpers import map_finish_reason-from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler+from litellm.llms.custom_httpx.http_handler import (+ AsyncHTTPHandler,+ HTTPHandler,+ _get_async_httpx_client,+)from litellm.llms.prompt_templates.factory import (convert_url_to_base64,response_schema_prompt,@@ -1286,15 +1290,10 @@ class VertexLLM(BaseLLM):) -> Union[ModelResponse, CustomStreamWrapper]:request_body = await async_transform_request_body(**data) # type: ignore- if client is None or not isinstance(client, AsyncHTTPHandler):- _params = {}- if timeout is not None:- if isinstance(timeout, float) or isinstance(timeout, int):- timeout = httpx.Timeout(timeout)- _params["timeout"] = timeout- client = AsyncHTTPHandler(**_params) # type: ignore- else:- client = client # type: ignore+ _async_client_params = {}+ if timeout:+ _async_client_params["timeout"] = timeout+ client = _get_async_httpx_client(params=_async_client_params)## LOGGINGlogging_obj.pre_call(input=messages,diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yamlindex ad7fbd384e4..defde377230 100644--- a/litellm/proxy/proxy_config.yaml+++ b/litellm/proxy/proxy_config.yaml@@ -1,37 +1,16 @@model_list:- - model_name: openai/*+ - model_name: gemini-visionlitellm_params:- model: openai/*- api_key: os.environ/OPENAI_API_KEY- model_info:- id: "good-openai"- - model_name: openai/*+ model: vertex_ai/gemini-1.0-pro-vision-001+ api_base: https://exampleopenaiendpoint-production.up.railway.app/v1/projects/adroit-crow-413218/locations/us-central1/publishers/google/models/gemini-1.0-pro-vision-001+ vertex_project: "adroit-crow-413218"+ vertex_location: "us-central1"+ vertex_credentials: "/Users/ishaanjaffer/Downloads/adroit-crow-413218-a956eef1a2a8.json"+ - model_name: fake-openai-endpointlitellm_params:- model: openai/*- api_key: os.environ/non-exsitent-env-var- tags: ["bad-model"]- model_info:- id: "test-openai"----litellm_settings:- callbacks: ["otel"]--callback_settings:- otel:- message_logging: False--router_settings:- enable_tag_filtering: True # 👈 Key Chang-+ model: openai/fake+ api_key: fake-key+ api_base: https://exampleopenaiendpoint-production.up.railway.app/general_settings:master_key: sk-1234- alerting: ["slack"]- spend_report_frequency: "1d"---litellm_settings:- success_callback: ["prometheus"]- failure_callback: ["prometheus"]\ No newline at end of file