mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +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:
|
def _run(self, *args: P.args, **kwargs: P.kwargs) -> R:
|
||||||
"""Execute the wrapped function."""
|
"""Execute the wrapped function."""
|
||||||
result = self.func(*args, **kwargs)
|
return self.func(*args, **kwargs) # type: ignore[return-value]
|
||||||
if _is_awaitable(result):
|
|
||||||
raise NotImplementedError(
|
|
||||||
f"{self.name} is an async function. Use arun() for async execution."
|
|
||||||
)
|
|
||||||
return result
|
|
||||||
|
|
||||||
async def arun(self, *args: P.args, **kwargs: P.kwargs) -> R:
|
async def arun(self, *args: P.args, **kwargs: P.kwargs) -> R:
|
||||||
"""Execute the tool asynchronously with type-safe parameters."""
|
"""Execute the tool asynchronously with type-safe parameters."""
|
||||||
|
|||||||
Reference in New Issue
Block a user