Skip to content

Commit

Permalink
[CLEANUP]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye committed Apr 12, 2024
1 parent 4b159b5 commit 8b77aea
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 33 deletions.
6 changes: 3 additions & 3 deletions Swarm Orchestrator_state.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"agent_id": "<function agent_id at 0x12e11e700>",
"agent_id": "<function agent_id at 0x12fb02700>",
"agent_name": "Swarm Orchestrator",
"agent_description": null,
"system_prompt": "Create an instruction prompt for an swarm orchestrator to create a series of personalized, agents for the following objective: what is the current squad of Ukrainian football national team? Who and where are they playing soon? to decompose a very complicated problem or tasks, the orchestrator is the team leader. Teach the orchestrator how to decompose the tasks to very certain agents with names, and system prompts, we need the plan, with a step by stpe instructions, number of agents, and a list of agents with a name, system prompt for each, and then the rules of the swarm, compact the prompt, and say only return JSON data in markdown and nothing else.Follow the schema here: \n{\n \"plan\": [\"Step 1\", \"Step 2\", \"Step 3\"],\n \"agents\": [\n {\n \"name\": \"Agent 1\",\n \"system_prompt\": \"Prompt 1\"\n },\n {\n \"name\": \"Agent 2\",\n \"system_prompt\": \"Prompt 2\"\n }\n ]\n}\n *############ Here are some examples:\n{\n \"plan\": [\"Room Management\", \"Guest Services\", \"Reservations Handling\", \"Facility Maintenance\", \"Staff Coordination\"],\n \"agents\": [\n {\n \"name\": \"Room Management Agent\",\n \"system_prompt\": \"Automate room assignments, minibar restocking, and housekeeping schedules\"\n },\n {\n \"name\": \"Guest Services Agent\",\n \"system_prompt\": \"Handle check-ins, check-outs, guest requests, and complaints efficiently\"\n },\n {\n \"name\": \"Reservations Agent\",\n \"system_prompt\": \"Manage room bookings, table reservations, and special requests\"\n },\n {\n \"name\": \"Maintenance Agent\",\n \"system_prompt\": \"Schedule and track maintenance tasks for facilities and rooms\"\n },\n {\n \"name\": \"Staff Coordination Agent\",\n \"system_prompt\": \"Optimize staff schedules, task assignments, and workload distribution\"\n }\n ]\n}\n and another example\n{\n \"plan\": [\"Problem Identification\", \"Solution Design\", \"Implementation\", \"Testing\", \"Deployment\"],\n \"agents\": [\n {\n \"name\": \"Identification Agent\",\n \"system_prompt\": \"Identify the problem\"\n },\n {\n \"name\": \"Design Agent\",\n \"system_prompt\": \"Design the solution\"\n },\n {\n \"name\": \"Implementation Agent\",\n \"system_prompt\": \"Implement the solution\"\n },\n {\n \"name\": \"Deployment Agent\",\n \"system_prompt\": \"Deploy the solution\"\n }\n ]\n}\n ",
"system_prompt": "Create an instruction prompt for an swarm orchestrator to create a series of personalized, agents for the following objective: Let's create a team of AI engineers to create a facial recognition model to decompose a very complicated problem or tasks, the orchestrator is the team leader. Teach the orchestrator how to decompose the tasks to very certain agents with names, and system prompts, we need the plan, with a step by stpe instructions, number of agents, and a list of agents with a name, system prompt for each, and then the rules of the swarm, compact the prompt, and say only return JSON data in markdown and nothing else.Follow the schema here: \n{\n \"plan\": [\"Step 1\", \"Step 2\", \"Step 3\"],\n \"agents\": [\n {\n \"name\": \"Agent 1\",\n \"system_prompt\": \"Prompt 1\"\n },\n {\n \"name\": \"Agent 2\",\n \"system_prompt\": \"Prompt 2\"\n }\n ]\n}\n *############ Here are some examples:\n{\n \"plan\": [\"Room Management\", \"Guest Services\", \"Reservations Handling\", \"Facility Maintenance\", \"Staff Coordination\"],\n \"agents\": [\n {\n \"name\": \"Room Management Agent\",\n \"system_prompt\": \"Automate room assignments, minibar restocking, and housekeeping schedules\"\n },\n {\n \"name\": \"Guest Services Agent\",\n \"system_prompt\": \"Handle check-ins, check-outs, guest requests, and complaints efficiently\"\n },\n {\n \"name\": \"Reservations Agent\",\n \"system_prompt\": \"Manage room bookings, table reservations, and special requests\"\n },\n {\n \"name\": \"Maintenance Agent\",\n \"system_prompt\": \"Schedule and track maintenance tasks for facilities and rooms\"\n },\n {\n \"name\": \"Staff Coordination Agent\",\n \"system_prompt\": \"Optimize staff schedules, task assignments, and workload distribution\"\n }\n ]\n}\n and another example\n{\n \"plan\": [\"Problem Identification\", \"Solution Design\", \"Implementation\", \"Testing\", \"Deployment\"],\n \"agents\": [\n {\n \"name\": \"Identification Agent\",\n \"system_prompt\": \"Identify the problem\"\n },\n {\n \"name\": \"Design Agent\",\n \"system_prompt\": \"Design the solution\"\n },\n {\n \"name\": \"Implementation Agent\",\n \"system_prompt\": \"Implement the solution\"\n },\n {\n \"name\": \"Deployment Agent\",\n \"system_prompt\": \"Deploy the solution\"\n }\n ]\n}\n ",
"sop": null,
"short_memory": "system: Create an instruction prompt for an swarm orchestrator to create a series of personalized, agents for the following objective: what is the current squad of Ukrainian football national team? Who and where are they playing soon? to decompose a very complicated problem or tasks, the orchestrator is the team leader. Teach the orchestrator how to decompose the tasks to very certain agents with names, and system prompts, we need the plan, with a step by stpe instructions, number of agents, and a list of agents with a name, system prompt for each, and then the rules of the swarm, compact the prompt, and say only return JSON data in markdown and nothing else.Follow the schema here: \n{\n \"plan\": [\"Step 1\", \"Step 2\", \"Step 3\"],\n \"agents\": [\n {\n \"name\": \"Agent 1\",\n \"system_prompt\": \"Prompt 1\"\n },\n {\n \"name\": \"Agent 2\",\n \"system_prompt\": \"Prompt 2\"\n }\n ]\n}\n *############ Here are some examples:\n{\n \"plan\": [\"Room Management\", \"Guest Services\", \"Reservations Handling\", \"Facility Maintenance\", \"Staff Coordination\"],\n \"agents\": [\n {\n \"name\": \"Room Management Agent\",\n \"system_prompt\": \"Automate room assignments, minibar restocking, and housekeeping schedules\"\n },\n {\n \"name\": \"Guest Services Agent\",\n \"system_prompt\": \"Handle check-ins, check-outs, guest requests, and complaints efficiently\"\n },\n {\n \"name\": \"Reservations Agent\",\n \"system_prompt\": \"Manage room bookings, table reservations, and special requests\"\n },\n {\n \"name\": \"Maintenance Agent\",\n \"system_prompt\": \"Schedule and track maintenance tasks for facilities and rooms\"\n },\n {\n \"name\": \"Staff Coordination Agent\",\n \"system_prompt\": \"Optimize staff schedules, task assignments, and workload distribution\"\n }\n ]\n}\n and another example\n{\n \"plan\": [\"Problem Identification\", \"Solution Design\", \"Implementation\", \"Testing\", \"Deployment\"],\n \"agents\": [\n {\n \"name\": \"Identification Agent\",\n \"system_prompt\": \"Identify the problem\"\n },\n {\n \"name\": \"Design Agent\",\n \"system_prompt\": \"Design the solution\"\n },\n {\n \"name\": \"Implementation Agent\",\n \"system_prompt\": \"Implement the solution\"\n },\n {\n \"name\": \"Deployment Agent\",\n \"system_prompt\": \"Deploy the solution\"\n }\n ]\n}\n \n\n\nHuman:: what is the current squad of Ukrainian football national team? Who and where are they playing soon?\n\n\nSwarm Orchestrator: \n```json\n{\n \"plan\": [\n \"Research current Ukrainian national football team roster\",\n \"Identify upcoming matches and opponents\", \n \"Research player backgrounds and current club teams\"\n ],\n \"agents\": [\n {\n \"name\": \"Roster Agent\",\n \"system_prompt\": \"Provide the names and positions of the players currently on the Ukraine national football team roster.\"\n },\n { \n \"name\": \"Matches Agent\",\n \"system_prompt\": \"List the dates, opponents, locations and tournaments for the upcoming matches involving the Ukrainian national team.\"\n },\n {\n \"name\": \"Player Background Agent\", \n \"system_prompt\": \"For each player currently on the Ukraine roster, provide their date of birth, height, current club team and a brief bio.\"\n }\n ]\n}\n```\n\nThis breaks down the overall objective into three key subtasks, each handled by a specialized agent. The Roster Agent identifies the current players, the Matches Agent provides the upcoming schedule, and the Player Background Agent gives background details on each national team member. The plan shows the high-level workflow and agents allow delegation of distinct aspects.\n\n",
"short_memory": "system: Create an instruction prompt for an swarm orchestrator to create a series of personalized, agents for the following objective: Let's create a team of AI engineers to create a facial recognition model to decompose a very complicated problem or tasks, the orchestrator is the team leader. Teach the orchestrator how to decompose the tasks to very certain agents with names, and system prompts, we need the plan, with a step by stpe instructions, number of agents, and a list of agents with a name, system prompt for each, and then the rules of the swarm, compact the prompt, and say only return JSON data in markdown and nothing else.Follow the schema here: \n{\n \"plan\": [\"Step 1\", \"Step 2\", \"Step 3\"],\n \"agents\": [\n {\n \"name\": \"Agent 1\",\n \"system_prompt\": \"Prompt 1\"\n },\n {\n \"name\": \"Agent 2\",\n \"system_prompt\": \"Prompt 2\"\n }\n ]\n}\n *############ Here are some examples:\n{\n \"plan\": [\"Room Management\", \"Guest Services\", \"Reservations Handling\", \"Facility Maintenance\", \"Staff Coordination\"],\n \"agents\": [\n {\n \"name\": \"Room Management Agent\",\n \"system_prompt\": \"Automate room assignments, minibar restocking, and housekeeping schedules\"\n },\n {\n \"name\": \"Guest Services Agent\",\n \"system_prompt\": \"Handle check-ins, check-outs, guest requests, and complaints efficiently\"\n },\n {\n \"name\": \"Reservations Agent\",\n \"system_prompt\": \"Manage room bookings, table reservations, and special requests\"\n },\n {\n \"name\": \"Maintenance Agent\",\n \"system_prompt\": \"Schedule and track maintenance tasks for facilities and rooms\"\n },\n {\n \"name\": \"Staff Coordination Agent\",\n \"system_prompt\": \"Optimize staff schedules, task assignments, and workload distribution\"\n }\n ]\n}\n and another example\n{\n \"plan\": [\"Problem Identification\", \"Solution Design\", \"Implementation\", \"Testing\", \"Deployment\"],\n \"agents\": [\n {\n \"name\": \"Identification Agent\",\n \"system_prompt\": \"Identify the problem\"\n },\n {\n \"name\": \"Design Agent\",\n \"system_prompt\": \"Design the solution\"\n },\n {\n \"name\": \"Implementation Agent\",\n \"system_prompt\": \"Implement the solution\"\n },\n {\n \"name\": \"Deployment Agent\",\n \"system_prompt\": \"Deploy the solution\"\n }\n ]\n}\n \n\n\nHuman:: Let's create a team of AI engineers to create a facial recognition model\n\n\nSwarm Orchestrator: \n{\n \"plan\": [\"Decompose Task\", \"Gather Data\", \"Model Architectures\", \"Train Model\", \"Evaluate and Tune Model\", \"Package and Deploy Model\"], \n \"agents\": [\n {\n \"name\": \"Task Agent\", \n \"system_prompt\": \"Break down the overall facial recognition objective into smaller, well-defined sub-tasks and milestones\"\n },\n {\n \"name\": \"Data Agent\",\n \"system_prompt\": \"Assemble relevant facial image datasets; perform data cleaning, labeling, and preprocessing\"\n },\n {\n \"name\": \"Architecture Agent\", \n \"system_prompt\": \"Research and design appropriate neural network architectures for facial recognition\"\n },\n {\n \"name\": \"Model Agent\",\n \"system_prompt\": \"Iteratively train neural network models using prepared datasets\" \n },\n {\n \"name\": \"Evaluation Agent\",\n \"system_prompt\": \"Test models and benchmarks performance to identify needed improvements\"\n },\n {\n \"name\": \"Deployment Agent\",\n \"system_prompt\": \"Optimize, package and integrate top performing model for real-world applications\"\n }\n ]\n}\n\n",
"loop_interval": 0,
"retry_attempts": 3,
"retry_interval": 1,
Expand Down
8 changes: 5 additions & 3 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from neo_sapiens import run_swarm
from neo_sapiens.hass_schema import run_swarm

# Run the swarm
out = run_swarm(
"what is the current squad of Ukrainian football national team?"
" Who and where are they playing soon?"
(
"Let's create a team of AI engineers to create a facial"
" recognition model"
),
)
print(out)
45 changes: 45 additions & 0 deletions examples/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import torch.nn as nn
import torch.nn.functional as F


class FaceNet(nn.Module):
"""
Convolutional neural network architecture for facial recognition,
trained to generate 128-d embeddings of face images.
Architecture details:
- Takes 160x160 RGB face images as input
- Several convolutional layers, BatchNorm, MaxPooling
-culminating in a linear layer outputting 128-d embedding vector
"""

def __init__(self):
super().__init__()

self.conv1 = nn.Conv2d(3, 32, 5)
self.bn1 = nn.BatchNorm2d(32)
self.pool1 = nn.MaxPool2d(2, 2)

self.conv2 = nn.Conv2d(32, 64, 5)
self.bn2 = nn.BatchNorm2d(64)
self.pool2 = nn.MaxPool2d(2, 2)

self.conv3 = nn.Conv2d(64, 96, 3)
self.bn3 = nn.BatchNorm2d(96)

self.conv4 = nn.Conv2d(96, 128, 3)
self.bn4 = nn.BatchNorm2d(128)

self.fc1 = nn.Linear(128 * 8 * 8, 256)
self.fc2 = nn.Linear(256, 128) # 128-d embedding

def forward(self, x):
x = self.pool1(F.relu(self.bn1(self.conv1(x))))
x = self.pool2(F.relu(self.bn2(self.conv2(x))))
x = F.relu(self.bn3(self.conv3(x)))
x = F.relu(self.bn4(self.conv4(x)))

x = x.view(-1, 128 * 8 * 8)
x = F.relu(self.fc1(x))
x = self.fc2(x)
return x
Loading

0 comments on commit 8b77aea

Please sign in to comment.