Spaces:
Sleeping
Sleeping
Update agents/base_agent.py
Browse files- agents/base_agent.py +10 -2
agents/base_agent.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
# agents/base_agent.py
|
2 |
-
|
3 |
from typing import Literal
|
4 |
from dataclasses import dataclass
|
|
|
|
|
5 |
|
6 |
@dataclass
|
7 |
class ACPMessage:
|
@@ -23,10 +24,17 @@ class BaseAgent:
|
|
23 |
self.name = name
|
24 |
self.role = role
|
25 |
|
26 |
-
def create_message(self, receiver
|
27 |
return ACPMessage(
|
28 |
sender=self.name,
|
29 |
receiver=receiver,
|
30 |
performative=performative,
|
31 |
content=content
|
32 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# agents/base_agent.py
|
|
|
2 |
from typing import Literal
|
3 |
from dataclasses import dataclass
|
4 |
+
import json
|
5 |
+
import os
|
6 |
|
7 |
@dataclass
|
8 |
class ACPMessage:
|
|
|
24 |
self.name = name
|
25 |
self.role = role
|
26 |
|
27 |
+
def create_message(self, receiver, performative, content):
|
28 |
return ACPMessage(
|
29 |
sender=self.name,
|
30 |
receiver=receiver,
|
31 |
performative=performative,
|
32 |
content=content
|
33 |
)
|
34 |
+
|
35 |
+
@staticmethod
|
36 |
+
def load_prompts(json_path="prompts.json"):
|
37 |
+
if os.path.exists(json_path):
|
38 |
+
with open(json_path, "r") as f:
|
39 |
+
return json.load(f)
|
40 |
+
return []
|