def __init__(self, func: Callable, name: str = None, desc: str = None, args: dict[str, Any] = None):
annotations_func = func if inspect.isfunction(func) or inspect.ismethod(func) else func.__call__
self.func = func
self.name = name or getattr(func, "__name__", type(func).__name__)
self.desc = desc or getattr(func, "__doc__", None) or getattr(annotations_func, "__doc__", "")
self.args = {
k: v.schema()
if isinstance((origin := get_origin(v) or v), type) and issubclass(origin, BaseModel)
else get_annotation_name(v)
for k, v in (args or get_type_hints(annotations_func)).items()
if k != "return"
}