Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

quick bug fixes

João Moura2787c9b0ef60
diff --git a/pyproject.toml b/pyproject.toml
index a0aabdf34..c34bac99b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "crewai"
-version = "0.60.0"
+version = "0.60.4"
description = "Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks."
authors = ["Joao Moura <[email protected]>"]
readme = "README.md"
diff --git a/src/crewai/agent.py b/src/crewai/agent.py
index 44b319621..31630391f 100644
--- a/src/crewai/agent.py
+++ b/src/crewai/agent.py
@@ -118,11 +118,15 @@ class Agent(BaseAgent):
@model_validator(mode="after")
def post_init_setup(self):
self.agent_ops_agent_name = self.role
- self.llm = self.llm.model_name if hasattr(self.llm, "model_name") else self.llm
+ self.llm = (
+ getattr(self.llm, "model_name", None)
+ or getattr(self.llm, "deployment_name", None)
+ or self.llm
+ )
self.function_calling_llm = (
- self.function_calling_llm.model_name
- if hasattr(self.function_calling_llm, "model_name")
- else self.function_calling_llm
+ getattr(self.function_calling_llm, "model_name", None)
+ or getattr(self.function_calling_llm, "deployment_name", None)
+ or self.function_calling_llm
)
if not self.agent_executor:
self._setup_agent_executor()
diff --git a/src/crewai/crew.py b/src/crewai/crew.py
index 0e0222558..3ab33833d 100644
--- a/src/crewai/crew.py
+++ b/src/crewai/crew.py
@@ -200,10 +200,9 @@ class Crew(BaseModel):
self._file_handler = FileHandler(self.output_log_file)
self._rpm_controller = RPMController(max_rpm=self.max_rpm, logger=self._logger)
self.function_calling_llm = (
- self.function_calling_llm.model_name
- if self.function_calling_llm is not None
- and hasattr(self.function_calling_llm, "model_name")
- else self.function_calling_llm
+ getattr(self.function_calling_llm, "model_name", None)
+ or getattr(self.function_calling_llm, "deployment_name", None)
+ or self.function_calling_llm
)
self._telemetry = Telemetry()
self._telemetry.set_tracer()
@@ -592,9 +591,9 @@ class Crew(BaseModel):
manager.tools = self.manager_agent.get_delegation_tools(self.agents)
else:
self.manager_llm = (
- self.manager_llm.model_name
- if hasattr(self.manager_llm, "model_name")
- else self.manager_llm
+ getattr(self.manager_llm, "model_name", None)
+ or getattr(self.manager_llm, "deployment_name", None)
+ or self.manager_llm
)
manager = Agent(
role=i18n.retrieve("hierarchical_manager_agent", "role"),
@@ -605,6 +604,7 @@ class Crew(BaseModel):
verbose=self.verbose,
)
self.manager_agent = manager
+ manager.crew = self
def _execute_tasks(
self,
@@ -936,10 +936,10 @@ class Crew(BaseModel):
def test(
self,
n_iterations: int,
- openai_model_name: str,
+ openai_model_name: Optional[str] = None,
inputs: Optional[Dict[str, Any]] = None,
) -> None:
- """Test and evaluate the Crew with the given inputs for n iterations."""
+ """Test and evaluate the Crew with the given inputs for n iterations concurrently using concurrent.futures."""
self._test_execution_span = self._telemetry.test_execution_span(
self, n_iterations, inputs, openai_model_name
)
diff --git a/src/crewai/tasks/task_output.py b/src/crewai/tasks/task_output.py
index d527f6fdb..b0e8aecd4 100644
--- a/src/crewai/tasks/task_output.py
+++ b/src/crewai/tasks/task_output.py
@@ -35,7 +35,7 @@ class TaskOutput(BaseModel):
return self
@property
- def json(self) -> str:
+ def json(self) -> Optional[str]:
if self.output_format != OutputFormat.JSON:
raise ValueError(
"""
diff --git a/src/crewai/tools/tool_usage.py b/src/crewai/tools/tool_usage.py
index cdcbcde5c..ff8a57351 100644
--- a/src/crewai/tools/tool_usage.py
+++ b/src/crewai/tools/tool_usage.py
@@ -17,7 +17,7 @@ if os.environ.get("AGENTOPS_API_KEY"):
except ImportError:
pass
-OPENAI_BIGGER_MODELS = ["gpt-4", "gpt-4o"]
+OPENAI_BIGGER_MODELS = ["gpt-4", "gpt-4o", "o1-preview", "o1-mini"]
class ToolUsageErrorException(Exception):
@@ -71,10 +71,12 @@ class ToolUsage:
self.function_calling_llm = function_calling_llm
# Set the maximum parsing attempts for bigger models
- if self._is_gpt(self.function_calling_llm) and "4" in self.function_calling_llm:
- if self.function_calling_llm in OPENAI_BIGGER_MODELS:
- self._max_parsing_attempts = 2
- self._remember_format_after_usages = 4
+ if (
+ self._is_gpt(self.function_calling_llm)
+ and self.function_calling_llm in OPENAI_BIGGER_MODELS
+ ):
+ self._max_parsing_attempts = 2
+ self._remember_format_after_usages = 4
def parse(self, tool_string: str):
"""Parse the tool string and return the tool calling."""
diff --git a/src/crewai/utilities/rpm_controller.py b/src/crewai/utilities/rpm_controller.py
index 35a11cd3b..5ee054c5f 100644
--- a/src/crewai/utilities/rpm_controller.py
+++ b/src/crewai/utilities/rpm_controller.py
@@ -52,7 +52,7 @@ class RPMController(BaseModel):
self._timer = None
def _wait_for_next_minute(self):
- time.sleep(1)
+ time.sleep(60)
self._current_rpm = 0
def _reset_request_count(self):