From 854b47ac95cd9798f22679e1cd76b46d31063a8a Mon Sep 17 00:00:00 2001 From: Brandon Hancock Date: Thu, 20 Feb 2025 12:03:53 -0500 Subject: [PATCH] Fix issues pointed out by lorenze --- src/crewai/llm.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crewai/llm.py b/src/crewai/llm.py index 08f31f0fb..aac1af3b7 100644 --- a/src/crewai/llm.py +++ b/src/crewai/llm.py @@ -26,9 +26,9 @@ from crewai.utilities.events.tool_usage_events import ToolExecutionErrorEvent with warnings.catch_warnings(): warnings.simplefilter("ignore", UserWarning) import litellm - from litellm import Choices, get_supported_openai_params + from litellm import Choices from litellm.types.utils import ModelResponse - from litellm.utils import supports_response_schema + from litellm.utils import get_supported_openai_params, supports_response_schema from crewai.traces.unified_trace_controller import trace_llm_call @@ -449,7 +449,7 @@ class LLM: def supports_function_calling(self) -> bool: try: params = get_supported_openai_params(model=self.model) - return "tools" in params + return params is not None and "tools" in params except Exception as e: logging.error(f"Failed to get supported params: {str(e)}") return False @@ -457,7 +457,7 @@ class LLM: def supports_stop_words(self) -> bool: try: params = get_supported_openai_params(model=self.model) - return "stop" in params + return params is not None and "stop" in params except Exception as e: logging.error(f"Failed to get supported params: {str(e)}") return False