mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
fix: ensure _run backward compat
This commit is contained in:
@@ -330,12 +330,7 @@ class Tool(BaseTool, Generic[P, R]):
|
||||
|
||||
def _run(self, *args: P.args, **kwargs: P.kwargs) -> R:
|
||||
"""Execute the wrapped function."""
|
||||
result = self.func(*args, **kwargs)
|
||||
if _is_awaitable(result):
|
||||
raise NotImplementedError(
|
||||
f"{self.name} is an async function. Use arun() for async execution."
|
||||
)
|
||||
return result
|
||||
return self.func(*args, **kwargs) # type: ignore[return-value]
|
||||
|
||||
async def arun(self, *args: P.args, **kwargs: P.kwargs) -> R:
|
||||
"""Execute the tool asynchronously with type-safe parameters."""
|
||||
|
||||
Reference in New Issue
Block a user