Skip to content

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]

fix get_async_httpx_client

Ishaan Jaff7ad3fe464ed2
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.py
index 7d3c09271e8..9b57c293e01 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
@@ -1293,9 +1293,12 @@ class VertexLLM(BaseLLM):
_async_client_params = {}
if timeout:
_async_client_params["timeout"] = timeout
- client = get_async_httpx_client(
- params=_async_client_params, llm_provider=litellm.LlmProviders.VERTEX_AI
- )
+ if client is None or not isinstance(client, AsyncHTTPHandler):
+ client = get_async_httpx_client(
+ params=_async_client_params, llm_provider=litellm.LlmProviders.VERTEX_AI
+ )
+ else:
+ client = client # type: ignore
## LOGGING
logging_obj.pre_call(
input=messages,