diff --git a/inference_sdk/http/entities.py b/inference_sdk/http/entities.py index 95bc9cad51..0dad1e4492 100644 --- a/inference_sdk/http/entities.py +++ b/inference_sdk/http/entities.py @@ -415,6 +415,8 @@ def to_legacy_call_parameters(self) -> Dict[str, Any]: ("source", "source"), ("source_info", "source_info"), ("response_mask_format", "response_mask_format"), + # The legacy route reads it as a query parameter (see `legacy_infer_from_request`). + ("include_anomaly_map", "include_anomaly_map"), ] parameters = get_non_empty_attributes( source_object=self, diff --git a/tests/inference_sdk/unit_tests/http/test_entities.py b/tests/inference_sdk/unit_tests/http/test_entities.py index 3ef404de2e..35ac66c82d 100644 --- a/tests/inference_sdk/unit_tests/http/test_entities.py +++ b/tests/inference_sdk/unit_tests/http/test_entities.py @@ -342,6 +342,24 @@ def test_to_legacy_call_parameters_context_overrides_explicit_count_inference_tr assert parameters["service_secret"] == "ctx-secret" +@pytest.mark.parametrize("client_mode", [HTTPClientMode.V0, HTTPClientMode.V1]) +@pytest.mark.parametrize("requested", [None, False, True]) +def test_include_anomaly_map_reaches_both_api_versions(client_mode, requested): + # given - the anomaly heatmap is requested the same way on the legacy route and v1 + configuration = InferenceConfiguration(include_anomaly_map=requested) + + # when + parameters = configuration.to_api_call_parameters( + client_mode=client_mode, task_type=CLASSIFICATION_TASK + ) + + # then + if requested is None: + assert "include_anomaly_map" not in parameters + else: + assert parameters["include_anomaly_map"] is requested + + @pytest.mark.parametrize("client_mode", [HTTPClientMode.V0, HTTPClientMode.V1]) @pytest.mark.parametrize("opt_in", [None, False, True]) def test_mask_resolution_opt_in_is_serialized_only_when_selected(client_mode, opt_in):