style: format A2A transformation and common_utils files using ruff

This commit is contained in:
STiFLeR7 2026-07-06 10:29:24 +05:30
parent c0f080eaa9
commit a600a21a2c
2 changed files with 6 additions and 19 deletions

View file

@ -55,9 +55,7 @@ class A2AConfig(BaseConfig):
agent_name = model.split("/", 1)[1] if "/" in model else None
# Only lookup if agent name exists and some config is missing
if not agent_name or (
api_base is not None and api_key is not None and headers is not None
):
if not agent_name or (api_base is not None and api_key is not None and headers is not None):
return api_base, api_key, headers
# Try registry lookup (only available in proxy context)
@ -84,10 +82,7 @@ class A2AConfig(BaseConfig):
# Merge other litellm_params (timeout, max_retries, etc.)
for key, value in agent.litellm_params.items():
if (
key not in ["api_key", "api_base", "headers", "model"]
and key not in optional_params
):
if key not in ["api_key", "api_base", "headers", "model"] and key not in optional_params:
optional_params[key] = value
except ImportError:
pass # Registry not available (not running in proxy context)

View file

@ -62,9 +62,7 @@ def convert_messages_to_prompt(messages: List[AllMessageValues]) -> str:
return "\n".join(conversation_parts)
def extract_text_from_a2a_message(
message: Dict[str, Any], depth: int = 0, max_depth: int = 10
) -> str:
def extract_text_from_a2a_message(message: Dict[str, Any], depth: int = 0, max_depth: int = 10) -> str:
"""
Extract text content from A2A message parts.
@ -102,9 +100,7 @@ def extract_text_from_a2a_message(
return " ".join(text_parts)
def extract_text_from_a2a_response(
response_dict: Dict[str, Any], max_depth: int = 10
) -> str:
def extract_text_from_a2a_response(response_dict: Dict[str, Any], max_depth: int = 10) -> str:
"""
Extract text content from A2A response result.
@ -145,16 +141,12 @@ def extract_text_from_a2a_response(
if isinstance(status, dict):
status_message = status.get("message")
if status_message:
return extract_text_from_a2a_message(
status_message, depth=0, max_depth=max_depth
)
return extract_text_from_a2a_message(status_message, depth=0, max_depth=max_depth)
# Handle task result with artifacts (plural, array)
artifacts = result.get("artifacts", [])
if artifacts and len(artifacts) > 0:
first_artifact = artifacts[0]
return extract_text_from_a2a_message(
first_artifact, depth=0, max_depth=max_depth
)
return extract_text_from_a2a_message(first_artifact, depth=0, max_depth=max_depth)
return ""