Skip to content

Commit

Permalink
[DOCS][GOALS][CORPORATE]
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Oct 10, 2024
1 parent 701d977 commit dbeb6ba
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 17 deletions.
6 changes: 4 additions & 2 deletions agents_from_yaml_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from loguru import logger
from dotenv import load_dotenv
from swarms.agents.create_agents_from_yaml import create_agents_from_yaml
from swarms.agents.create_agents_from_yaml import (
create_agents_from_yaml,
)

# Load environment variables
load_dotenv()
Expand All @@ -13,7 +15,7 @@
task_results = create_agents_from_yaml(
yaml_file, return_type="tasks"
)

logger.info(f"Results from agents: {task_results}")
except Exception as e:
logger.error(f"An error occurred: {e}")
116 changes: 116 additions & 0 deletions docs/corporate/2024_2025_goals.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,4 @@ nav:
- The Ultimate Technical Guide to the Swarms CLI; A Step-by-Step Developers Guide: "swarms/cli/cli_guide.md"
- Corporate:
- Hiring: "corporate/hiring.md"

- Swarms Goals & Milestone Tracking; A Vision for 2024 and Beyond: "corporate/2024_2025_goals.md"
8 changes: 5 additions & 3 deletions swarms/agents/create_agents_from_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ def create_agents_from_yaml(
logger.info(f"Creating agent: {agent_config['agent_name']}")

# Get the OpenAI API key from environment or YAML config
api_key = os.getenv("OPENAI_API_KEY") or agent_config["model"]["openai_api_key"]
api_key = (
os.getenv("OPENAI_API_KEY")
or agent_config["model"]["openai_api_key"]
)

# Create an instance of OpenAIChat model
model = OpenAIChat(
Expand All @@ -78,7 +81,7 @@ def create_agents_from_yaml(
raise ValueError(
f"System prompt is missing for agent: {agent_config['agent_name']}"
)

# Initialize the agent using the configuration
agent = Agent(
agent_name=agent_config["agent_name"],
Expand Down Expand Up @@ -148,4 +151,3 @@ def create_agents_from_yaml(
else:
logger.error(f"Invalid return_type: {return_type}")
raise ValueError(f"Invalid return_type: {return_type}")

6 changes: 3 additions & 3 deletions swarms/cli/create_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ def run_agent_by_name(name: str, task: str, *args, **kwargs):
return output


# Test
out = create_agent("Accountant1", "Prepares financial statements")
print(out)
# # Test
# out = create_agent("Accountant1", "Prepares financial statements")
# print(out)
9 changes: 8 additions & 1 deletion swarms/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ def main():
# Adding arguments for different commands
parser.add_argument(
"command",
choices=["onboarding", "help", "get-api-key", "check-login", "run-agents"],
choices=[
"onboarding",
"help",
"get-api-key",
"check-login",
"run-agents",
],
help="Command to run",
)
parser.add_argument(
Expand Down Expand Up @@ -139,5 +145,6 @@ def main():
"[bold red]Unknown command! Type 'help' for usage.[/bold red]"
)


if __name__ == "__main__":
main()
18 changes: 11 additions & 7 deletions swarms/cli/onboarding_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def save_data(self, retry_attempts: int = 3) -> None:
# # )
# with open(self.cache_save_path, "w") as f:
# json.dump(combined_data, f, indent=4)
# logger.info(
# "User and system data successfully cached in {}",
# self.cache_save_path,
# )
# logger.info(
# "User and system data successfully cached in {}",
# self.cache_save_path,
# )
return # Exit the function if saving was successful
except Exception as e:
logger.error(
Expand Down Expand Up @@ -138,7 +138,7 @@ def ask_input(self, prompt: str, key: str) -> None:
)
self.user_data[key] = response.strip()
self.save_data()

return response
except ValueError as e:
logger.warning(e)
Expand Down Expand Up @@ -175,8 +175,12 @@ def collect_user_info(self) -> None:
"workspace_dir",
)
os.environ["WORKSPACE_DIR"] = workspace
logger.info("Important: Please ensure you have set your WORKSPACE_DIR environment variable as per the instructions provided.")
logger.info("Additionally, remember to add your API keys for your respective models in your .env file.")
logger.info(
"Important: Please ensure you have set your WORKSPACE_DIR environment variable as per the instructions provided."
)
logger.info(
"Additionally, remember to add your API keys for your respective models in your .env file."
)
logger.success("Onboarding process completed successfully!")

def run(self) -> None:
Expand Down

0 comments on commit dbeb6ba

Please sign in to comment.