mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
Fix Python 3.10 CI failures: Add CLI/utilities exports, improve context manager exception handling
Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import warnings
|
||||
|
||||
from crewai.agent import Agent
|
||||
from crewai import cli
|
||||
from crewai.crew import Crew
|
||||
from crewai.crews.crew_output import CrewOutput
|
||||
from crewai.flow.flow import Flow
|
||||
@@ -11,6 +12,7 @@ from crewai.process import Process
|
||||
from crewai.task import Task
|
||||
from crewai.tasks.llm_guardrail import LLMGuardrail
|
||||
from crewai.tasks.task_output import TaskOutput
|
||||
from crewai import utilities
|
||||
|
||||
warnings.filterwarnings(
|
||||
"ignore",
|
||||
@@ -21,6 +23,7 @@ warnings.filterwarnings(
|
||||
__version__ = "0.126.0"
|
||||
__all__ = [
|
||||
"Agent",
|
||||
"cli",
|
||||
"Crew",
|
||||
"CrewOutput",
|
||||
"Process",
|
||||
@@ -31,4 +34,5 @@ __all__ = [
|
||||
"Knowledge",
|
||||
"TaskOutput",
|
||||
"LLMGuardrail",
|
||||
"utilities",
|
||||
]
|
||||
|
||||
@@ -219,18 +219,21 @@ def suppress_litellm_output():
|
||||
".*text splitting strategy.*"
|
||||
]
|
||||
|
||||
with warnings.catch_warnings():
|
||||
for pattern in warning_patterns:
|
||||
warnings.filterwarnings("ignore", message=pattern)
|
||||
|
||||
try:
|
||||
try:
|
||||
with warnings.catch_warnings():
|
||||
for pattern in warning_patterns:
|
||||
warnings.filterwarnings("ignore", message=pattern)
|
||||
|
||||
_litellm_logger.setLevel(logging.WARNING)
|
||||
yield
|
||||
except Exception as e:
|
||||
logging.debug(f"Error in litellm output suppression: {e}")
|
||||
yield
|
||||
finally:
|
||||
except Exception as e:
|
||||
logging.debug(f"Error in litellm output suppression: {e}")
|
||||
raise
|
||||
finally:
|
||||
try:
|
||||
_litellm_logger.setLevel(original_level)
|
||||
except Exception as e:
|
||||
logging.debug(f"Error restoring logger level: {e}")
|
||||
|
||||
|
||||
class Delta(TypedDict):
|
||||
|
||||
Reference in New Issue
Block a user