Fix tool usage and event import handling

- Update tool usage to use `.get()` method when checking tool name
- Remove unnecessary `__all__` export list in events/__init__.py
This commit is contained in:
Lorenze Jay
2025-02-12 16:26:15 -08:00
parent fa5d7a2e05
commit 097ed1f0df
2 changed files with 3 additions and 30 deletions

View File

@@ -119,10 +119,9 @@ class ToolUsage:
self._printer.print(content=f"\n\n{error}\n", color="red")
return error
if (
isinstance(tool, CrewStructuredTool)
and tool.name == self._i18n.tools("add_image")["name"]
): # type: ignore
if isinstance(tool, CrewStructuredTool) and tool.name == self._i18n.tools(
"add_image"
).get("name"): # type: ignore
try:
result = self._use(tool_string=tool_string, tool=tool, calling=calling)
return result

View File

@@ -21,29 +21,3 @@ from .tool_usage_events import ToolUsageFinishedEvent, ToolUsageErrorEvent
# events
from .event_listener import EventListener
from .third_party.agentops_listener import agentops_listener
__all__ = [
AgentExecutionStartedEvent,
AgentExecutionCompletedEvent,
AgentExecutionErrorEvent,
CrewKickoffStartedEvent,
CrewKickoffCompletedEvent,
CrewKickoffFailedEvent,
TaskStartedEvent,
TaskCompletedEvent,
TaskFailedEvent,
FlowStartedEvent,
FlowFinishedEvent,
MethodExecutionStartedEvent,
MethodExecutionFinishedEvent,
EventTypes,
event_bus,
ToolUsageFinishedEvent,
ToolUsageErrorEvent,
EventBus,
AgentExecutionErrorEvent,
]