mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
refactor(a2a): use direct typed access in protocol binding normalization
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
329202004e
commit
0697188be4
2 changed files with 4 additions and 5 deletions
|
|
@ -67,11 +67,9 @@ def normalize_agent_card_protocol_bindings(agent_card: "AgentCard") -> "AgentCar
|
|||
case-sensitively against its uppercase TransportProtocol constants and fails
|
||||
with "no compatible transports found." for spec-adjacent casings.
|
||||
"""
|
||||
interfaces: Final = getattr(agent_card, "supported_interfaces", None) or ()
|
||||
for interface in interfaces:
|
||||
binding: str = getattr(interface, "protocol_binding", "") or ""
|
||||
canonical = _CANONICAL_PROTOCOL_BINDINGS.get(binding.lower())
|
||||
if canonical is not None and binding != canonical:
|
||||
for interface in agent_card.supported_interfaces:
|
||||
canonical: str | None = _CANONICAL_PROTOCOL_BINDINGS.get(interface.protocol_binding.lower())
|
||||
if canonical is not None and canonical != interface.protocol_binding:
|
||||
interface.protocol_binding = canonical
|
||||
return agent_card
|
||||
|
||||
|
|
|
|||
|
|
@ -344,6 +344,7 @@ async def test_lowercase_protocol_binding_in_agent_card_still_gets_a_client(isol
|
|||
response = await _send_message(a2a_client, _send_request("lc"))
|
||||
|
||||
assert type(response.root.result).__name__ == "Message"
|
||||
assert a2a_client._litellm_agent_card.supported_interfaces[0].protocol_binding == "JSONRPC"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue