From 0787e2ac558c51e5300f77d6142b47ce149ee749 Mon Sep 17 00:00:00 2001 From: Brandon Hancock Date: Mon, 4 Nov 2024 10:55:59 -0500 Subject: [PATCH] fix missing config --- src/crewai/cli/add_crew_to_flow.py | 2 +- src/crewai/cli/templates/crew/crew.py | 7 +++++-- src/crewai/cli/templates/crew/main.py | 10 +++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/crewai/cli/add_crew_to_flow.py b/src/crewai/cli/add_crew_to_flow.py index e4901fa899..ef693a22b4 100644 --- a/src/crewai/cli/add_crew_to_flow.py +++ b/src/crewai/cli/add_crew_to_flow.py @@ -54,7 +54,7 @@ def create_embedded_crew(crew_name: str, parent_folder: Path) -> None: templates_dir = Path(__file__).parent / "templates" / "crew" config_template_files = ["agents.yaml", "tasks.yaml"] - crew_template_file = f"{folder_name}_crew.py" # Updated file name + crew_template_file = f"{folder_name}.py" # Updated file name for file_name in config_template_files: src_file = templates_dir / "config" / file_name diff --git a/src/crewai/cli/templates/crew/crew.py b/src/crewai/cli/templates/crew/crew.py index f950d13d43..c473154156 100644 --- a/src/crewai/cli/templates/crew/crew.py +++ b/src/crewai/cli/templates/crew/crew.py @@ -8,9 +8,12 @@ # from crewai_tools import SerperDevTool @CrewBase -class {{crew_name}}Crew(): +class {{crew_name}}(): """{{crew_name}} crew""" + agents_config = 'config/agents.yaml' + tasks_config = 'config/tasks.yaml' + @agent def researcher(self) -> Agent: return Agent( @@ -48,4 +51,4 @@ def crew(self) -> Crew: process=Process.sequential, verbose=True, # process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/ - ) \ No newline at end of file + ) diff --git a/src/crewai/cli/templates/crew/main.py b/src/crewai/cli/templates/crew/main.py index 88edfcbffc..52dbe8c7de 100644 --- a/src/crewai/cli/templates/crew/main.py +++ b/src/crewai/cli/templates/crew/main.py @@ -1,6 +1,6 @@ #!/usr/bin/env python import sys -from {{folder_name}}.crew import {{crew_name}}Crew +from {{folder_name}}.crew import {{crew_name}} # This main file is intended to be a way for you to run your # crew locally, so refrain from adding unnecessary logic into this file. @@ -14,7 +14,7 @@ def run(): inputs = { 'topic': 'AI LLMs' } - {{crew_name}}Crew().crew().kickoff(inputs=inputs) + {{crew_name}}().crew().kickoff(inputs=inputs) def train(): @@ -25,7 +25,7 @@ def train(): "topic": "AI LLMs" } try: - {{crew_name}}Crew().crew().train(n_iterations=int(sys.argv[1]), filename=sys.argv[2], inputs=inputs) + {{crew_name}}().crew().train(n_iterations=int(sys.argv[1]), filename=sys.argv[2], inputs=inputs) except Exception as e: raise Exception(f"An error occurred while training the crew: {e}") @@ -35,7 +35,7 @@ def replay(): Replay the crew execution from a specific task. """ try: - {{crew_name}}Crew().crew().replay(task_id=sys.argv[1]) + {{crew_name}}().crew().replay(task_id=sys.argv[1]) except Exception as e: raise Exception(f"An error occurred while replaying the crew: {e}") @@ -48,7 +48,7 @@ def test(): "topic": "AI LLMs" } try: - {{crew_name}}Crew().crew().test(n_iterations=int(sys.argv[1]), openai_model_name=sys.argv[2], inputs=inputs) + {{crew_name}}().crew().test(n_iterations=int(sys.argv[1]), openai_model_name=sys.argv[2], inputs=inputs) except Exception as e: raise Exception(f"An error occurred while replaying the crew: {e}")