mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +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:
parent
f2cb31a45e
commit
2f6d18e6bc
2 changed files with 7 additions and 2 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue