diff --git a/src/crewai/integrations/mlflow.py b/src/crewai/integrations/mlflow.py index edc702cdf..aad7a5f16 100644 --- a/src/crewai/integrations/mlflow.py +++ b/src/crewai/integrations/mlflow.py @@ -1,6 +1,5 @@ """MLflow integration for CrewAI""" import logging -from typing import Optional from crewai.utilities.events.crewai_event_bus import crewai_event_bus from crewai.utilities.events.third_party.mlflow_listener import mlflow_listener @@ -18,9 +17,14 @@ def autolog( Args: disable: If True, disable autologging. If False, enable it. silent: If True, suppress logging messages. + + Raises: + TypeError: If disable or silent are not boolean values. """ + if not isinstance(disable, bool) or not isinstance(silent, bool): + raise TypeError("Parameters 'disable' and 'silent' must be boolean") try: - import mlflow + import mlflow # noqa: F401 except ImportError: if not silent: logger.warning( diff --git a/src/crewai/utilities/events/third_party/mlflow_listener.py b/src/crewai/utilities/events/third_party/mlflow_listener.py index 67cc5ca0d..e72c9e394 100644 --- a/src/crewai/utilities/events/third_party/mlflow_listener.py +++ b/src/crewai/utilities/events/third_party/mlflow_listener.py @@ -1,4 +1,4 @@ -from typing import Optional, Dict, Any +from typing import Dict, Any import logging from crewai.utilities.events.crew_events import ( diff --git a/tests/test_mlflow_final.py b/tests/test_mlflow_final.py index 00f9b93fa..1b4cc4df5 100644 --- a/tests/test_mlflow_final.py +++ b/tests/test_mlflow_final.py @@ -1,8 +1,7 @@ """ Final test for MLflow integration issue #2947 """ -import pytest -from unittest.mock import Mock, patch + def test_mlflow_autolog_availability():