| 27 | |
| 28 | |
| 29 | class SolutionConfig(Config): |
| 30 | |
| 31 | required_fields = ["agent_team", "sop"] |
| 32 | |
| 33 | def __init__(self, config_path_or_dict: Union[str, dict] = None) -> None: |
| 34 | super().__init__(config_path_or_dict) |
| 35 | self._validate_config() |
| 36 | |
| 37 | self.task = self.config_dict.get("task", None) |
| 38 | self.agent_team = self.config_dict["agent_team"] |
| 39 | self.sop = self.config_dict["sop"] |
| 40 | |
| 41 | @classmethod |
| 42 | def generate_config(cls, query): |
| 43 | task_config = TaskConfig.generate_config(query) |
| 44 | sop_config = SOPConfig.generate_config(query, task_config.task_description) |
| 45 | |
| 46 | all_node_roles_description = {} |
| 47 | for node_name, node_config in sop_config.nodes.items(): |
| 48 | all_node_roles_description[node_name] = node_config[ |
| 49 | "node_roles_description" |
| 50 | ] |
| 51 | agent_team_config = AgentTeamConfig.generate_config( |
| 52 | task_config.task_description, all_node_roles_description |
| 53 | ) |
| 54 | |
| 55 | return cls( |
| 56 | config_path_or_dict={ |
| 57 | "task": task_config.to_dict(), |
| 58 | "agent_team": agent_team_config.to_dict(), |
| 59 | "sop": sop_config.to_dict(), |
| 60 | } |
| 61 | ) |
| 62 | |
| 63 | |
| 64 | class Solution: |