diff --git a/litellm/llms/a2a/chat/transformation.py b/litellm/llms/a2a/chat/transformation.py index be3b5fea601..79208416f52 100644 --- a/litellm/llms/a2a/chat/transformation.py +++ b/litellm/llms/a2a/chat/transformation.py @@ -133,13 +133,13 @@ class A2AConfig(BaseConfig): return api_base, api_key, headers def get_supported_openai_params(self, model: str) -> list[str]: - """Return list of supported OpenAI parameters""" - return [ - "stream", - "temperature", - "max_tokens", - "top_p", - ] + """Return list of supported OpenAI parameters. + + Only ``stream`` is forwarded (map_openai_params maps nothing else onto the + A2A JSON-RPC payload). Declaring sampling params as supported used to drop + them silently; leaving them unsupported makes callers fail loudly instead. + """ + return ["stream"] def map_openai_params( self, diff --git a/tests/unit/llms/a2a/chat/test_a2a_chat_transformation.py b/tests/unit/llms/a2a/chat/test_a2a_chat_transformation.py index 76bce26e2e0..8c64bacd6bb 100644 --- a/tests/unit/llms/a2a/chat/test_a2a_chat_transformation.py +++ b/tests/unit/llms/a2a/chat/test_a2a_chat_transformation.py @@ -226,3 +226,36 @@ def test_transform_response_reports_an_undecodable_body_as_an_agent_error(): assert exc_info.value.status_code == 502 assert exc_info.value.message.startswith("Failed to parse A2A response: ") + + +def test_get_supported_openai_params_declares_only_stream(): + """Sampling params are not mapped onto the A2A JSON-RPC payload, so the config + must not declare them as supported - declaring them used to drop them silently.""" + assert A2AConfig().get_supported_openai_params(model="test-agent") == ["stream"] + + +def test_sampling_params_fail_loudly_instead_of_dropping_silently(): + """temperature/max_tokens/top_p are not forwarded to the agent; callers must get + a named error rather than a call that silently ignores their settings.""" + from litellm.exceptions import UnsupportedParamsError + from litellm.utils import get_optional_params + + for param in ("temperature", "max_tokens", "top_p"): + with pytest.raises(UnsupportedParamsError): + get_optional_params(model="test-agent", custom_llm_provider="a2a", **{param: 0.7}) + + +def test_drop_params_still_drops_unsupported_sampling_params(): + """With drop_params set, unsupported sampling params are stripped and only the + supported stream flag survives.""" + from litellm.utils import get_optional_params + + result = get_optional_params( + model="test-agent", + custom_llm_provider="a2a", + temperature=0.7, + stream=True, + drop_params=True, + ) + assert "temperature" not in result + assert result.get("stream") is True