mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-18 04:28:19 +00:00
fix(proxy): use get_async_httpx_client for logo download (#20155)
Replace direct AsyncHTTPHandler instantiation with get_async_httpx_client to avoid +500ms latency per request from creating new async clients. Added httpxSpecialProvider.UI for UI-related HTTP requests like logo downloads.
This commit is contained in:
@@ -10164,9 +10164,13 @@ async def get_image():
|
||||
if logo_path.startswith(("http://", "https://")):
|
||||
try:
|
||||
# Download the image and cache it
|
||||
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler
|
||||
from litellm.llms.custom_httpx.http_handler import get_async_httpx_client
|
||||
from litellm.types.llms.custom_http import httpxSpecialProvider
|
||||
|
||||
async_client = AsyncHTTPHandler(timeout=5.0)
|
||||
async_client = get_async_httpx_client(
|
||||
llm_provider=httpxSpecialProvider.UI,
|
||||
params={"timeout": 5.0},
|
||||
)
|
||||
response = await async_client.get(logo_path)
|
||||
if response.status_code == 200:
|
||||
# Save the image to a local file
|
||||
|
||||
@@ -26,6 +26,7 @@ class httpxSpecialProvider(str, Enum):
|
||||
RAG = "rag"
|
||||
A2A = "a2a"
|
||||
PromptManagement = "prompt_management"
|
||||
UI = "ui"
|
||||
|
||||
|
||||
VerifyTypes = Union[str, bool, ssl.SSLContext]
|
||||
|
||||
Reference in New Issue
Block a user