diff --git a/litellm/llms/anthropic.py b/litellm/llms/anthropic.py index 047616cfe51..5e088790124 100644 --- a/litellm/llms/anthropic.py +++ b/litellm/llms/anthropic.py @@ -227,7 +227,7 @@ def completion( else: text_content = completion_response["content"][0].get("text", None) ## TOOL CALLING - OUTPUT PARSE - if _is_function_call == True: + if text_content is not None and "invoke" in text_content: function_name = extract_between_tags("tool_name", text_content)[0] function_arguments_str = extract_between_tags("invoke", text_content)[ 0 diff --git a/litellm/tests/test_add_function_to_prompt.py b/litellm/tests/test_add_function_to_prompt.py index 93b09cd8c8b..d703ce849e2 100644 --- a/litellm/tests/test_add_function_to_prompt.py +++ b/litellm/tests/test_add_function_to_prompt.py @@ -41,10 +41,11 @@ def test_function_call_non_openai_model(): pass -test_function_call_non_openai_model() +# test_function_call_non_openai_model() ## case 2: add_function_to_prompt set +@pytest.mark.skip(reason="Anthropic now supports tool calling") def test_function_call_non_openai_model_litellm_mod_set(): litellm.add_function_to_prompt = True litellm.set_verbose = True