Spaces:
Sleeping
Sleeping
| """Base class for all tools.""" | |
| from abc import ABC, abstractmethod | |
| from typing import Any, Dict | |
| class BaseTool(ABC): | |
| """Abstract base class for tools.""" | |
| def __init__(self): | |
| self.name = self.__class__.__name__ | |
| def description(self) -> str: | |
| """Description of what the tool does.""" | |
| pass | |
| def run(self, text: str) -> Dict[str, Any]: | |
| """Execute the tool on the given text. | |
| Args: | |
| text: The input text to analyze | |
| Returns: | |
| Dictionary containing the analysis results | |
| """ | |
| pass | |
| def __str__(self) -> str: | |
| return f"{self.name}: {self.description}" | |