Merge branch 'main' into feat/trace-ui-exec-3

This commit is contained in:
Eduardo Chiarotti
2025-04-11 13:08:56 -04:00
committed by GitHub
2 changed files with 79 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
import asyncio
import warnings
from abc import ABC, abstractmethod
from inspect import signature
@@ -65,7 +66,13 @@ class BaseTool(BaseModel, ABC):
**kwargs: Any,
) -> Any:
print(f"Using Tool: {self.name}")
return self._run(*args, **kwargs)
result = self._run(*args, **kwargs)
# If _run is async, we safely run it
if asyncio.iscoroutine(result):
return asyncio.run(result)
return result
@abstractmethod
def _run(