diff --git a/litellm/llms/anthropic/completion.py b/litellm/llms/anthropic/completion.py index 89a50db6a..dc06401d6 100644 --- a/litellm/llms/anthropic/completion.py +++ b/litellm/llms/anthropic/completion.py @@ -13,7 +13,11 @@ import httpx import requests import litellm -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.utils import CustomStreamWrapper, ModelResponse, Usage from ..base import BaseLLM @@ -162,7 +166,10 @@ class AnthropicTextCompletion(BaseLLM): client=None, ): if client is None: - client = AsyncHTTPHandler(timeout=httpx.Timeout(timeout=600.0, connect=5.0)) + client = get_async_httpx_client( + llm_provider=litellm.LlmProviders.ANTHROPIC, + params={"timeout": httpx.Timeout(timeout=600.0, connect=5.0)}, + ) response = await client.post(api_base, headers=headers, data=json.dumps(data)) @@ -198,7 +205,10 @@ class AnthropicTextCompletion(BaseLLM): client=None, ): if client is None: - client = AsyncHTTPHandler(timeout=httpx.Timeout(timeout=600.0, connect=5.0)) + client = get_async_httpx_client( + llm_provider=litellm.LlmProviders.ANTHROPIC, + params={"timeout": httpx.Timeout(timeout=600.0, connect=5.0)}, + ) response = await client.post(api_base, headers=headers, data=json.dumps(data)) diff --git a/litellm/llms/azure_ai/embed/handler.py b/litellm/llms/azure_ai/embed/handler.py index 638a77479..2946a84dd 100644 --- a/litellm/llms/azure_ai/embed/handler.py +++ b/litellm/llms/azure_ai/embed/handler.py @@ -74,7 +74,10 @@ class AzureAIEmbedding(OpenAIChatCompletion): client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None, ) -> EmbeddingResponse: if client is None or not isinstance(client, AsyncHTTPHandler): - client = AsyncHTTPHandler(timeout=timeout, concurrent_limit=1) + client = get_async_httpx_client( + llm_provider=litellm.LlmProviders.AZURE_AI, + params={"timeout": timeout}, + ) url = "{}/images/embeddings".format(api_base)