prabalGaur commited on
Commit
b40ca50
·
verified ·
1 Parent(s): 540ae3b

Upload community_contributions/english_learning_tutor_ns_sly/agents/agent.py with huggingface_hub

Browse files
community_contributions/english_learning_tutor_ns_sly/agents/agent.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+
3
+ class Agent:
4
+ """
5
+ An abstract superclass for Agents
6
+ Used to log messages in a way that can identify each Agent
7
+ """
8
+
9
+ # Foreground colors
10
+ RED = '\033[31m'
11
+ GREEN = '\033[32m'
12
+ YELLOW = '\033[33m'
13
+ BLUE = '\033[34m'
14
+ MAGENTA = '\033[35m'
15
+ CYAN = '\033[36m'
16
+ WHITE = '\033[37m'
17
+
18
+ # Background color
19
+ BG_BLACK = '\033[40m'
20
+
21
+ # Reset code to return to default color
22
+ RESET = '\033[0m'
23
+
24
+ name: str = ""
25
+ color: str = '\033[37m'
26
+
27
+ def log(self, message):
28
+ """
29
+ Log this as an info message, identifying the agent
30
+ """
31
+ color_code = self.BG_BLACK + self.color
32
+ message = f"[{self.name}] {message}"
33
+ logging.info(color_code + message + self.RESET)