mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix: use cache-key-only param for A2A extra_headers to avoid AsyncHTTPHandler init error
The 'extra_headers' key in params was being passed to AsyncHTTPHandler.__init__() which doesn't accept it. Use 'disable_aiohttp_transport' as the cache-key-only param since it's explicitly filtered out before reaching the constructor. Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
This commit is contained in:
parent
026a4b11b9
commit
84dd6d8d47
1 changed files with 9 additions and 3 deletions
|
|
@ -656,11 +656,17 @@ async def create_a2a_client(
|
|||
# (with different extra_headers) get separate cached clients. The params
|
||||
# dict is hashed into the cache key, keeping agent auth isolated while
|
||||
# still reusing connections within the same agent.
|
||||
#
|
||||
# Only pass params that AsyncHTTPHandler.__init__ accepts (e.g. timeout).
|
||||
# Use "disable_aiohttp_transport" key for cache-key-only data (it's
|
||||
# filtered out before reaching the constructor).
|
||||
_client_params: dict = {"timeout": timeout}
|
||||
if extra_headers:
|
||||
# Include sorted header keys in params so each unique header set
|
||||
# produces a distinct cache key.
|
||||
_client_params["extra_headers"] = str(sorted(extra_headers.items()))
|
||||
# Encode headers into a cache-key-only param so each unique header
|
||||
# set produces a distinct cache key.
|
||||
_client_params["disable_aiohttp_transport"] = str(
|
||||
sorted(extra_headers.items())
|
||||
)
|
||||
_async_handler = get_async_httpx_client(
|
||||
llm_provider=httpxSpecialProvider.A2AProvider,
|
||||
params=_client_params,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue