Revert "Revert "true dependency""

This reverts commit 4d1b460b
This commit is contained in:
Braelyn Boynton
2024-04-19 19:09:20 -07:00
parent fd7de7f2eb
commit e9335e89a6
3 changed files with 6 additions and 13 deletions

View File

@@ -28,11 +28,10 @@ click = "^8.1.7"
python-dotenv = "1.0.0"
embedchain = "^0.1.98"
appdirs = "^1.4.4"
agentops = { version = "^0.1.5", optional = true }
agentops = "^0.1.5"
[tool.poetry.extras]
tools = ["crewai-tools"]
agentops = ["agentops"]
[tool.poetry.group.dev.dependencies]
isort = "^5.13.2"

View File

@@ -26,10 +26,7 @@ from crewai.task import Task
from crewai.telemetry import Telemetry
from crewai.tools.agent_tools import AgentTools
from crewai.utilities import I18N, FileHandler, Logger, RPMController
try:
import agentops
except ImportError:
agentops = None
import agentops
class Crew(BaseModel):
@@ -380,8 +377,7 @@ class Crew(BaseModel):
def _finish_execution(self, output) -> None:
if self.max_rpm:
self._rpm_controller.stop_rpm_counter()
if agentops:
agentops.end_session(end_state="Success", end_state_reason="Finished Execution")
agentops.end_session(end_state="Success", end_state_reason="Finished Execution")
self._telemetry.end_crew(self, output)
def __repr__(self):

View File

@@ -97,7 +97,7 @@ class ToolUsage:
tool: BaseTool,
calling: Union[ToolCalling, InstructorToolCalling],
) -> None:
tool_event = agentops.ToolEvent(name=calling.tool_name) if agentops else None
tool_event = agentops.ToolEvent(name=calling.tool_name)
if self._check_tool_repeated_usage(calling=calling):
try:
result = self._i18n.errors("task_repeated_usage").format(
@@ -161,8 +161,7 @@ class ToolUsage:
self._printer.print(content=f"\n\n{error_message}\n", color="red")
return error
self.task.increment_tools_errors()
if agentops:
agentops.record(agentops.ErrorEvent(exception=e, trigger_event=tool_event))
agentops.record(agentops.ErrorEvent(details=e, trigger_event=tool_event))
return self.use(calling=calling, tool_string=tool_string)
if self.tools_handler:
@@ -183,8 +182,7 @@ class ToolUsage:
)
self._printer.print(content=f"\n\n{result}\n", color="purple")
if agentops:
agentops.record(tool_event)
agentops.record(tool_event)
self._telemetry.tool_usage(
llm=self.function_calling_llm,
tool_name=tool.name,