diff --git a/litellm/llms/openai_like/embedding/handler.py b/litellm/llms/openai_like/embedding/handler.py index ce0860724..84b8405e6 100644 --- a/litellm/llms/openai_like/embedding/handler.py +++ b/litellm/llms/openai_like/embedding/handler.py @@ -45,7 +45,10 @@ class OpenAILikeEmbeddingHandler(OpenAILikeBase): response = None try: if client is None or isinstance(client, AsyncHTTPHandler): - self.async_client = AsyncHTTPHandler(timeout=timeout) # type: ignore + self.async_client = get_async_httpx_client( + llm_provider=litellm.LlmProviders.OPENAI, + params={"timeout": timeout}, + ) else: self.async_client = client diff --git a/litellm/llms/vertex_ai_and_google_ai_studio/gemini_embeddings/batch_embed_content_handler.py b/litellm/llms/vertex_ai_and_google_ai_studio/gemini_embeddings/batch_embed_content_handler.py index 314e129c2..8e2d1f39a 100644 --- a/litellm/llms/vertex_ai_and_google_ai_studio/gemini_embeddings/batch_embed_content_handler.py +++ b/litellm/llms/vertex_ai_and_google_ai_studio/gemini_embeddings/batch_embed_content_handler.py @@ -7,8 +7,13 @@ from typing import Any, List, Literal, Optional, Union import httpx +import litellm from litellm import EmbeddingResponse -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.types.llms.openai import EmbeddingInput from litellm.types.llms.vertex_ai import ( VertexAIBatchEmbeddingsRequestBody, @@ -150,7 +155,10 @@ class GoogleBatchEmbeddings(VertexLLM): else: _params["timeout"] = httpx.Timeout(timeout=600.0, connect=5.0) - async_handler: AsyncHTTPHandler = AsyncHTTPHandler(**_params) # type: ignore + async_handler: AsyncHTTPHandler = get_async_httpx_client( + llm_provider=litellm.LlmProviders.VERTEX_AI, + params={"timeout": timeout}, + ) else: async_handler = client # type: ignore