Spaces:
Running on Zero
Running on Zero
Download agents/agent.py from prabalGaur/Capstone: direct link, hf CLI and curl.
- Browser
- Download file 796 Bytes
-
https://huggingface.co/spaces/prabalGaur/Capstone/resolve/main/agents/agent.py
- Command line
-
hf download hf://spaces/prabalGaur/Capstone/agents/agent.py
-
curl -L -o agent.py https://huggingface.co/spaces/prabalGaur/Capstone/resolve/main/agents/agent.py
796 Bytes
| import logging | |
| class Agent: | |
| """ | |
| An abstract superclass for Agents | |
| Used to log messages in a way that can identify each Agent | |
| """ | |
| # Foreground colors | |
| RED = '\033[31m' | |
| GREEN = '\033[32m' | |
| YELLOW = '\033[33m' | |
| BLUE = '\033[34m' | |
| MAGENTA = '\033[35m' | |
| CYAN = '\033[36m' | |
| WHITE = '\033[37m' | |
| # Background color | |
| BG_BLACK = '\033[40m' | |
| # Reset code to return to default color | |
| RESET = '\033[0m' | |
| name: str = "" | |
| color: str = '\033[37m' | |
| def log(self, message): | |
| """ | |
| Log this as an info message, identifying the agent | |
| """ | |
| color_code = self.BG_BLACK + self.color | |
| message = f"[{self.name}] {message}" | |
| logging.info(color_code + message + self.RESET) |