Spaces:
Runtime error
Runtime error
Download src/tools/base_tool.py from Easonwangzk/ReAct-Text-Analyzer: direct link, hf CLI and curl.
- Browser
- Download file 716 Bytes
-
https://huggingface.co/spaces/Easonwangzk/ReAct-Text-Analyzer/resolve/main/src/tools/base_tool.py
- Command line
-
hf download hf://spaces/Easonwangzk/ReAct-Text-Analyzer/src/tools/base_tool.py
-
curl -L -o base_tool.py https://huggingface.co/spaces/Easonwangzk/ReAct-Text-Analyzer/resolve/main/src/tools/base_tool.py
716 Bytes
| """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}" | |