From 56d20cd0737e9c6facfb9ce75bde99d765b0dfb4 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Wed, 28 Feb 2024 17:36:15 -0800 Subject: [PATCH] (test) supports_function_calling --- litellm/__init__.py | 2 ++ litellm/tests/test_utils.py | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/litellm/__init__.py b/litellm/__init__.py index 3ba337415..cd639ddb9 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -549,6 +549,8 @@ from .utils import ( token_counter, cost_per_token, completion_cost, + supports_function_calling, + supports_parallel_function_calling, get_litellm_params, Logging, acreate, diff --git a/litellm/tests/test_utils.py b/litellm/tests/test_utils.py index a9e1c75fe..e094afee6 100644 --- a/litellm/tests/test_utils.py +++ b/litellm/tests/test_utils.py @@ -317,3 +317,27 @@ def test_token_counter(): # test_token_counter() + + +def test_supports_function_calling(): + try: + assert litellm.supports_function_calling(model="gpt-3.5-turbo") == True + assert ( + litellm.supports_function_calling(model="azure/gpt-4-1106-preview") == True + ) + assert ( + litellm.supports_function_calling( + model="bedrock/anthropic.claude-instant-v1" + ) + == False + ) + assert litellm.supports_function_calling(model="palm/chat-bison") == False + assert litellm.supports_function_calling(model="ollama/llama2") == False + assert ( + litellm.supports_function_calling(model="anthropic.claude-instant-v1") + == False + ) + assert litellm.supports_function_calling(model="claude-2") == False + + except Exception as e: + pytest.fail(f"Error occurred: {e}")