diff --git a/lib/shared/layers/python-sdk/python/genai_core/models.py b/lib/shared/layers/python-sdk/python/genai_core/models.py index 78ccd6af3..2772710aa 100644 --- a/lib/shared/layers/python-sdk/python/genai_core/models.py +++ b/lib/shared/layers/python-sdk/python/genai_core/models.py @@ -103,8 +103,8 @@ def list_bedrock_finetuned_models(): } for model in bedrock_custom_models # Exclude embeddings and stable diffusion models - if model.get("inputModalities", None) != None - and model.get("outputModalities", None) != None + if "inputModalities" in model + and "outputModalities" in model and Modality.EMBEDDING.value not in model.get("outputModalities", []) and Modality.IMAGE.value not in model.get("outputModalities", []) ]