Skip to content

Commit 78428a5

Browse files
authored
feat: Nexus Architect (#30)
1 parent e69ab39 commit 78428a5

12 files changed

Lines changed: 3440 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ logs*
44
nexus_workflows
55
chat.rapidgpt
66
.vscode
7+
optimized_workflows/
78

89
# Byte-compiled / optimized / DLL files
910
__pycache__/
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import os, sys
2+
from dotenv import load_dotenv
3+
4+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
5+
6+
from primisai.nexus.architect import Architect
7+
8+
load_dotenv()
9+
10+
llm_config = {'model': os.getenv('LLM_MODEL'), 'api_key': os.getenv('LLM_API_KEY'), 'base_url': os.getenv('LLM_BASE_URL')}
11+
12+
user_query = """Design a workflow to solve GRE/SAT-style riddle questions and math problems. Use 1 supervisor and 1 Question Ansering Agent"""
13+
14+
"""JSON object containing the keys "question" and "answer".
15+
Example line: {"question": "What is 2+2?", "answer": "4"}"""
16+
17+
benchmark_path = "path_to_the_data.jsonl"
18+
19+
architect = Architect(user_query=user_query,
20+
benchmark_path=benchmark_path,
21+
llm_config=llm_config,
22+
workflow_name="math_riddle_solver",
23+
subset_size=5,
24+
max_iterations=2)
25+
26+
results = architect.build_and_optimize()
27+
28+
# --- 3. Review the Results ---
29+
print("\n\n" + "=" * 25 + " FINAL SUMMARY " + "=" * 25)
30+
print(f"✅ Process Completed!")
31+
print(f"Final Accuracy: {results['final_accuracy']:.2%}")
32+
print(f"Final optimized workflow file saved to: {results['output_path']}")
33+
print("\n--- Performance History ---")
34+
for record in results['history']:
35+
print(f" - Iteration {record['iteration']}: Accuracy={record['accuracy']:.2%}, Saved to -> {record['saved_path']}")
36+
print("=" * 67)

0 commit comments

Comments
 (0)