diff --git a/tests/unit/llms/bedrock/chat/test_converse_transformation.py b/tests/unit/llms/bedrock/chat/test_converse_transformation.py index efe6371122d..1950801b35b 100644 --- a/tests/unit/llms/bedrock/chat/test_converse_transformation.py +++ b/tests/unit/llms/bedrock/chat/test_converse_transformation.py @@ -4867,47 +4867,38 @@ def test_translate_response_format_native_output_config_claude_5_family(monkeypa Regression test for: https://github.com/BerriAI/litellm/issues/47687 """ - old_env = os.environ.get("LITELLM_LOCAL_MODEL_COST_MAP") - old_cost = litellm.model_cost monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True") - litellm.model_cost = litellm.get_model_cost_map(url="") - try: - config = AmazonConverseConfig() - response_format = { - "type": "json_schema", - "json_schema": { - "name": "ScoreResult", - "schema": { - "type": "object", - "properties": {"score": {"type": "number"}}, - "required": ["score"], - }, + monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url="")) + config = AmazonConverseConfig() + response_format = { + "type": "json_schema", + "json_schema": { + "name": "ScoreResult", + "schema": { + "type": "object", + "properties": {"score": {"type": "number"}}, + "required": ["score"], }, - } - for model in ( - "us.anthropic.claude-opus-5-5", - "us.anthropic.claude-sonnet-5-5", - "us.anthropic.claude-haiku-5-5", - "anthropic.claude-opus-5", - "anthropic.claude-sonnet-5", - ): - optional_params: dict = {} - result = config._translate_response_format_param( - value=response_format, - model=model, - optional_params=optional_params, - non_default_params={"response_format": response_format}, - is_thinking_enabled=False, - ) - assert "outputConfig" in result, f"{model}: json_schema should route to native outputConfig without thinking" - assert "tools" not in result, f"{model}: json tool path must not be used for Claude 5 family" - assert "tool_choice" not in result - finally: - litellm.model_cost = old_cost - if old_env is None: - os.environ.pop("LITELLM_LOCAL_MODEL_COST_MAP", None) - else: - monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", old_env) + }, + } + for model in ( + "us.anthropic.claude-opus-5-5", + "us.anthropic.claude-sonnet-5-5", + "us.anthropic.claude-haiku-5-5", + "anthropic.claude-opus-5", + "anthropic.claude-sonnet-5", + ): + optional_params: dict = {} + result = config._translate_response_format_param( + value=response_format, + model=model, + optional_params=optional_params, + non_default_params={"response_format": response_format}, + is_thinking_enabled=False, + ) + assert "outputConfig" in result, f"{model}: json_schema should route to native outputConfig without thinking" + assert "tools" not in result, f"{model}: json tool path must not be used for Claude 5 family" + assert "tool_choice" not in result CAPITAL_RESPONSE_FORMAT: Final = {