Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion primisai/nexus/architect/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def _update_system_messages(self, agent_messages: Dict[str, str]):
if agent.name in agent_messages:
agent.system_message = agent_messages[agent.name]

def build_and_validate(self) -> Supervisor:
def build_component_and_validate(self) -> Supervisor:
"""Build and validate all components, then assemble the workflow"""
# 1. Build and validate main supervisor
main_sup_builder = SupervisorBuilder(self.definition.main_supervisor, self.llm_config)
Expand Down
2 changes: 1 addition & 1 deletion primisai/nexus/architect/expander.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, llm_config: Dict[str, str]):
"""
self.ai = AI(llm_config)

def expand_workflow_query(self, user_query: str, nexus_guidelines: str) -> str:
def decompose_and_plan_tasks(self, user_query: str, nexus_guidelines: str) -> str:
"""
Expand a high-level workflow query into detailed component pseudocode.

Expand Down
9 changes: 4 additions & 5 deletions primisai/nexus/architect/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def _create_supervisor_instance(self, workflow_id: str, unique_suffix: int):
"""Factory function to create a supervisor instance for evaluation."""
run_id = f"{workflow_id}_{unique_suffix}"
builder = WorkflowBuilder(self.system_messages, self.structured_workflow, self.llm_config, run_id)
return builder.build_and_validate()
return builder.build_component_and_validate()

def _save_workflow_to_file(self, accuracy: float, iteration: int) -> str:
"""Builds the workflow with current system messages and saves it to a file."""
Expand All @@ -119,7 +119,7 @@ def _save_workflow_to_file(self, accuracy: float, iteration: int) -> str:
output_path = os.path.join(self.output_dir, filename)

builder = WorkflowBuilder(self.system_messages, self.structured_workflow, self.llm_config, self.workflow_id)
builder.build_and_validate()
builder.build_component_and_validate()
builder.save_workflow_to_file(output_path)
logger.info(f"Workflow saved to: {output_path}")
return output_path
Expand All @@ -133,8 +133,8 @@ def build_and_optimize(self) -> Dict[str, Any]:
final accuracy, path to the saved file, and performance history.
"""
logger.info("Step 1: Designing initial workflow from user query...")
expanded_workflow = self.expander.expand_workflow_query(self.user_query, prompts.nexus_guidelines)
self.structured_workflow = self.structurer.structure_workflow(expanded_workflow)
expanded_workflow = self.expander.decompose_and_plan_tasks(self.user_query, prompts.nexus_guidelines)
self.structured_workflow = self.structurer.reasoning_workflow_design(expanded_workflow)

agents_names = [self.structured_workflow.main_supervisor.name] + [agent.name for agent in self.structured_workflow.agents]
logger.info(f"Created agents: {', '.join(agents_names)}")
Expand All @@ -156,7 +156,6 @@ def build_and_optimize(self) -> Dict[str, Any]:
self.workflow_id,
iteration=i,
is_factory=True)

accuracy = evaluation_results['accuracy']
final_accuracy = accuracy

Expand Down
2 changes: 1 addition & 1 deletion primisai/nexus/architect/structurer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, llm_config: Dict[str, str]):
with open(doc_path, "r", encoding="utf-8") as file:
self.nexus_documentation = file.read()

def structure_workflow(self, expanded_workflow: str) -> WorkflowDefinition:
def reasoning_workflow_design(self, expanded_workflow: str) -> WorkflowDefinition:
"""
Convert expanded workflow description into structured component definitions.

Expand Down
Loading