Spaces:
Paused
Paused
Modularised the agents 6
Browse files- __pycache__/crew.cpython-310.pyc +0 -0
- crew.py +10 -19
__pycache__/crew.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/crew.cpython-310.pyc and b/__pycache__/crew.cpython-310.pyc differ
|
|
|
crew.py
CHANGED
|
@@ -91,6 +91,15 @@ def get_tools_for(agent_name: str):
|
|
| 91 |
class GAIACrew():
|
| 92 |
tasks: List[Task]
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
@property
|
| 95 |
def agents(self) -> List[Agent]:
|
| 96 |
return [
|
|
@@ -102,27 +111,9 @@ class GAIACrew():
|
|
| 102 |
tools=get_tools_for(name),
|
| 103 |
verbose=True
|
| 104 |
)
|
| 105 |
-
for name in self.agents_config
|
| 106 |
]
|
| 107 |
|
| 108 |
-
@task
|
| 109 |
-
def manager_task(self) -> Task:
|
| 110 |
-
task = Task(
|
| 111 |
-
config=self.tasks_config["manager_task"]
|
| 112 |
-
)
|
| 113 |
-
task.agent = next(agent for agent in self.agents if agent.config["name"] == "manager_agent")
|
| 114 |
-
return task
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
@crew
|
| 119 |
-
def crew(self) -> Crew:
|
| 120 |
-
return Crew(
|
| 121 |
-
agents=self.agents,
|
| 122 |
-
tasks=[self.manager_task()],
|
| 123 |
-
verbose=True
|
| 124 |
-
)
|
| 125 |
-
|
| 126 |
|
| 127 |
def run_crew(question, file_path):
|
| 128 |
final_question = question
|
|
|
|
| 91 |
class GAIACrew():
|
| 92 |
tasks: List[Task]
|
| 93 |
|
| 94 |
+
def __init__(self):
|
| 95 |
+
self.agents_config = self._load_yaml("config/agents.yaml")
|
| 96 |
+
self.tasks_config = self._load_yaml("config/tasks.yaml")
|
| 97 |
+
|
| 98 |
+
def _load_yaml(self, path):
|
| 99 |
+
import yaml
|
| 100 |
+
with open(path, "r") as f:
|
| 101 |
+
return yaml.safe_load(f)
|
| 102 |
+
|
| 103 |
@property
|
| 104 |
def agents(self) -> List[Agent]:
|
| 105 |
return [
|
|
|
|
| 111 |
tools=get_tools_for(name),
|
| 112 |
verbose=True
|
| 113 |
)
|
| 114 |
+
for name in self.agents_config
|
| 115 |
]
|
| 116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
def run_crew(question, file_path):
|
| 119 |
final_question = question
|