mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-06 17:52:35 +00:00
remove ActionEvent from on_tool_use and on_tool_use_finished methods
This commit is contained in:
@@ -26,20 +26,6 @@ class ToolsHandler:
|
|||||||
"""Run when tool ends running."""
|
"""Run when tool ends running."""
|
||||||
self.last_used_tool = calling # type: ignore # BUG?: Incompatible types in assignment (expression has type "Union[ToolCalling, InstructorToolCalling]", variable has type "ToolCalling")
|
self.last_used_tool = calling # type: ignore # BUG?: Incompatible types in assignment (expression has type "Union[ToolCalling, InstructorToolCalling]", variable has type "ToolCalling")
|
||||||
|
|
||||||
if agentops:
|
|
||||||
agentops.record(
|
|
||||||
agentops.ActionEvent(
|
|
||||||
action_type="on_tool_use",
|
|
||||||
params=calling.arguments,
|
|
||||||
returns=output,
|
|
||||||
logs={
|
|
||||||
"tool": calling.tool_name,
|
|
||||||
"tool_calling": calling,
|
|
||||||
"should_cache": should_cache,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if self.cache and should_cache and calling.tool_name != CacheTools().name:
|
if self.cache and should_cache and calling.tool_name != CacheTools().name:
|
||||||
self.cache.add(
|
self.cache.add(
|
||||||
tool=calling.tool_name,
|
tool=calling.tool_name,
|
||||||
|
|||||||
@@ -525,19 +525,6 @@ class ToolUsage:
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if agentops:
|
|
||||||
agentops.record(
|
|
||||||
agentops.ActionEvent(
|
|
||||||
action_type="on_tool_use_finished",
|
|
||||||
params=tool_calling.arguments,
|
|
||||||
returns=event_data,
|
|
||||||
logs={
|
|
||||||
"tool": tool,
|
|
||||||
"tool_calling": tool_calling,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
events.emit(source=self, event=ToolUsageFinished(**event_data))
|
events.emit(source=self, event=ToolUsageFinished(**event_data))
|
||||||
|
|
||||||
def _prepare_event_data(self, tool: Any, tool_calling: ToolCalling) -> dict:
|
def _prepare_event_data(self, tool: Any, tool_calling: ToolCalling) -> dict:
|
||||||
|
|||||||
Reference in New Issue
Block a user