mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-13 08:52:02 +00:00
fix(model-info): preserve deprecated Bedrock opt-out report
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
2ecad649ec
commit
4daae1e80d
2 changed files with 7 additions and 12 deletions
|
|
@ -4170,7 +4170,7 @@ def _registration_base(
|
|||
def native_structured_output_support(model_info: Mapping[str, object]) -> bool | None:
|
||||
by_default: Final = model_info.get("supports_bedrock_native_structured_output_by_default")
|
||||
if isinstance(by_default, bool):
|
||||
return by_default
|
||||
return by_default and model_info.get("supports_bedrock_native_structured_output") is not False
|
||||
declared: Final = model_info.get("supports_native_structured_output")
|
||||
return declared if isinstance(declared, bool) else None
|
||||
|
||||
|
|
|
|||
|
|
@ -491,16 +491,16 @@ def test_model_info_reports_null_cost_for_unpriced_deployment_and_zero_for_decla
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("deployment_model_info", "reported_native"),
|
||||
("deployment_model_info", "native"),
|
||||
[
|
||||
({}, True),
|
||||
({"supports_bedrock_native_structured_output": False}, True),
|
||||
({"supports_bedrock_native_structured_output": False}, False),
|
||||
({"supports_native_structured_output": True, "supports_bedrock_native_structured_output": False}, True),
|
||||
],
|
||||
ids=["native-by-default", "deprecated-opt-out", "explicit-generic-flag"],
|
||||
ids=["native-by-default", "bedrock-opt-out", "explicit-generic-flag"],
|
||||
)
|
||||
def test_model_info_reports_the_map_default_without_reading_the_deprecated_opt_out(
|
||||
local_model_cost_map: None, deployment_model_info: dict[str, object], reported_native: bool
|
||||
def test_model_info_reports_a_deployment_bedrock_native_output_opt_out(
|
||||
local_model_cost_map: None, deployment_model_info: dict[str, object], native: bool
|
||||
) -> None:
|
||||
info: Final = proxy_server._enrich_model_info_with_litellm_data(
|
||||
{
|
||||
|
|
@ -510,12 +510,7 @@ def test_model_info_reports_the_map_default_without_reading_the_deprecated_opt_o
|
|||
}
|
||||
)["model_info"]
|
||||
|
||||
assert info["supports_native_structured_output"] is reported_native
|
||||
if "supports_bedrock_native_structured_output" in deployment_model_info:
|
||||
assert (
|
||||
info["supports_bedrock_native_structured_output"]
|
||||
is deployment_model_info["supports_bedrock_native_structured_output"]
|
||||
)
|
||||
assert info["supports_native_structured_output"] is native
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue