feat - new util supports_vision

This commit is contained in:
Ishaan Jaff 2024-04-15 18:10:12 -07:00
parent 351baf42b5
commit fb8e256aba

View file

@ -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.