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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ logs*
nexus_workflows
chat.rapidgpt
.vscode
optimized_workflows/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
36 changes: 36 additions & 0 deletions examples/create_workflow_using_architect.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os, sys
from dotenv import load_dotenv

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

from primisai.nexus.architect import Architect

load_dotenv()

llm_config = {'model': os.getenv('LLM_MODEL'), 'api_key': os.getenv('LLM_API_KEY'), 'base_url': os.getenv('LLM_BASE_URL')}

user_query = """Design a workflow to solve GRE/SAT-style riddle questions and math problems. Use 1 supervisor and 1 Question Ansering Agent"""

"""JSON object containing the keys "question" and "answer".
Example line: {"question": "What is 2+2?", "answer": "4"}"""

benchmark_path = "path_to_the_data.jsonl"

architect = Architect(user_query=user_query,
benchmark_path=benchmark_path,
llm_config=llm_config,
workflow_name="math_riddle_solver",
subset_size=5,
max_iterations=2)

results = architect.build_and_optimize()

# --- 3. Review the Results ---
print("\n\n" + "=" * 25 + " FINAL SUMMARY " + "=" * 25)
print(f"✅ Process Completed!")
print(f"Final Accuracy: {results['final_accuracy']:.2%}")
print(f"Final optimized workflow file saved to: {results['output_path']}")
print("\n--- Performance History ---")
for record in results['history']:
print(f" - Iteration {record['iteration']}: Accuracy={record['accuracy']:.2%}, Saved to -> {record['saved_path']}")
print("=" * 67)
Loading