From 11c9780ff05d2a4661749bdf98092a0cc956f4e5 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 20 May 2024 13:11:10 -0700 Subject: [PATCH] fix self.async_handler --- litellm/llms/vertex_httpx.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/litellm/llms/vertex_httpx.py b/litellm/llms/vertex_httpx.py index 61920d4e6e..e7b31b1554 100644 --- a/litellm/llms/vertex_httpx.py +++ b/litellm/llms/vertex_httpx.py @@ -31,6 +31,7 @@ class VertexLLM(BaseLLM): self.refresh_token: Optional[str] = None self._credentials: Optional[Any] = None self.project_id: Optional[str] = None + self.async_handler: Optional[AsyncHTTPHandler] = None def load_auth(self) -> Tuple[Any, str]: from google.auth.transport.requests import Request # type: ignore[import-untyped] @@ -134,9 +135,9 @@ class VertexLLM(BaseLLM): if isinstance(timeout, float) or isinstance(timeout, int): _httpx_timeout = httpx.Timeout(timeout) _params["timeout"] = _httpx_timeout - client = AsyncHTTPHandler(**_params) # type: ignore + self.async_handler = AsyncHTTPHandler(**_params) # type: ignore else: - client = client # type: ignore + self.async_handler = client # type: ignore # make POST request to # https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/imagegeneration:predict @@ -176,7 +177,7 @@ class VertexLLM(BaseLLM): }, ) - response = await client.post( + response = await self.async_handler.post( url=url, headers={ "Content-Type": "application/json; charset=utf-8",