diff --git a/litellm/utils.py b/litellm/utils.py index 76d54f6a8..3a319f24b 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -4156,6 +4156,30 @@ def supports_function_calling(model: str): ) +def supports_vision(model: str): + """ + Check if the given model supports vision and return a boolean value. + + Parameters: + model (str): The model name to be checked. + + Returns: + bool: True if the model supports vision, False otherwise. + + Raises: + Exception: If the given model is not found in model_prices_and_context_window.json. + """ + if model in litellm.model_cost: + model_info = litellm.model_cost[model] + if model_info.get("supports_vision", False): + return True + return False + else: + raise Exception( + f"Model not in model_prices_and_context_window.json. You passed model={model}." + ) + + def supports_parallel_function_calling(model: str): """ Check if the given model supports parallel function calling and return True if it does, False otherwise.