From 4c4f032a75896ee05053e54e9768d67fc5222c76 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 19 Jul 2024 15:32:01 -0700 Subject: [PATCH] fix(factory.py): refactor factory to use httpx client --- litellm/llms/prompt_templates/factory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/llms/prompt_templates/factory.py b/litellm/llms/prompt_templates/factory.py index 99ffcfbf4..a219e930a 100644 --- a/litellm/llms/prompt_templates/factory.py +++ b/litellm/llms/prompt_templates/factory.py @@ -14,6 +14,7 @@ import litellm import litellm.types import litellm.types.llms import litellm.types.llms.vertex_ai +from litellm.llms.custom_httpx.http_handler import HTTPHandler from litellm.types.completion import ( ChatCompletionFunctionMessageParam, ChatCompletionMessageParam, @@ -1989,8 +1990,9 @@ def get_image_details(image_url) -> Tuple[str, str]: try: import base64 + client = HTTPHandler(concurrent_limit=1) # Send a GET request to the image URL - response = requests.get(image_url) + response = client.get(image_url) response.raise_for_status() # Raise an exception for HTTP errors # Check the response's content type to ensure it is an image