Spaces:
Sleeping
Sleeping
| """ | |
| Simple base tool class for enhanced research tools. | |
| This provides a minimal interface compatible with AGNO without requiring agno.tools.base | |
| """ | |
| from typing import Any, Dict, Optional | |
| from abc import ABC, abstractmethod | |
| class BaseTool(ABC): | |
| """ | |
| Simple base class for tools that can be used with AGNO. | |
| This provides the minimal interface needed for AGNO compatibility | |
| without requiring complex dependencies. | |
| """ | |
| def __init__(self, name: str, description: str): | |
| """ | |
| Initialize the base tool. | |
| Args: | |
| name: Tool name | |
| description: Tool description | |
| """ | |
| self.name = name | |
| self.description = description | |
| def __str__(self) -> str: | |
| """String representation of the tool.""" | |
| return f"{self.__class__.__name__}(name='{self.name}')" | |
| def __repr__(self) -> str: | |
| """Detailed representation of the tool.""" | |
| return f"{self.__class__.__name__}(name='{self.name}', description='{self.description}')" | |
| def get_info(self) -> Dict[str, Any]: | |
| """Get tool information.""" | |
| return { | |
| 'name': self.name, | |
| 'description': self.description, | |
| 'class': self.__class__.__name__ | |
| } | |
| class SimpleAGNOTool(BaseTool): | |
| """ | |
| Simple AGNO-compatible tool that can be used directly with AGNO agents. | |
| This class provides the interface that AGNO expects while keeping | |
| the implementation simple and dependency-free. | |
| """ | |
| def __init__(self, name: str, description: str): | |
| """Initialize the AGNO-compatible tool.""" | |
| super().__init__(name, description) | |
| # AGNO expects these attributes | |
| self._name = name | |
| self._description = description | |
| def tool_name(self) -> str: | |
| """Get the tool name (AGNO compatibility).""" | |
| return self.name | |
| def tool_description(self) -> str: | |
| """Get the tool description (AGNO compatibility).""" | |
| return self.description | |
| def to_dict(self) -> Dict[str, Any]: | |
| """Convert tool to dictionary (AGNO compatibility).""" | |
| return { | |
| 'name': self.name, | |
| 'description': self.description, | |
| 'type': 'function' | |
| } |