yanniedog / autocrew Goto Github PK
View Code? Open in Web Editor NEWAutomatically create a crew and tasks for CrewAI
License: Creative Commons Zero v1.0 Universal
Automatically create a crew and tasks for CrewAI
License: Creative Commons Zero v1.0 Universal
python autocrew.py
Traceback (most recent call last):
File "/home/chris/ai/aiprojects/crewai-autocrew/autocrew.py", line 28, in <module>
from core import AutoCrew
File "/home/chris/ai/aiprojects/crewai-autocrew/core.py", line 13, in <module>
from openai import OpenAI
ImportError: cannot import name 'OpenAI' from 'openai' (/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/openai/__init__.py)
from openai import OpenAI should be
import openai
Hi,
adding goal description to a filename gives error for long goals.
Idea is perfect but brings error as users cant use long texts.
Its in line #31
I would trunctate this to , lets say, 10 letters.
This should be filtered as it is treating the ++ as letters. Perhaps subsitute any ++ in an agent or taskname to pp
So C++_developer becomes Cpp_developer
Here is a variation of your autocrew script. Thanks very much for writing it and making it available.
Since I use LM Studio, I used the OpenAI llm rather than the Ollama. It would be nice if there were a more convenient way to configure this, both for the autocrew program and the script it generates.
I am using openhermes-2.5, so maybe it doesn't want to change the delimiter for the CSV format. I basically disabled anything about using a different delimiter. If a field value has a comma in it, parsing will break, but it might work better to use '",' as the delimiter, except for the last field. I'll probably work on that.
I added a function to first extract the CSV lines from a response containing csv ...
, since that's what I always saw from openhermes.
I hard-coded the overall goal, since I was always entering the same thing manually. But entering this is a separate configuration file would be better.
import csv
import io
import os
import re
from langchain.tools import DuckDuckGoSearchRun
from crewai import Agent, Task, Crew, Process
# Configure the openai api llm
from langchain.llms import OpenAI
# from langchain_community.chat_models import ChatOpenAI
your_OPENAI_api_key_here = "NULL"
YOUR_LLM_ENDPOINT = "http://your.IP.number:1234/v1"
openai_llm = OpenAI(
temperature=0,
model="whatever",
openai_api_key=f"{your_OPENAI_api_key_here}",
openai_api_base=f"{YOUR_LLM_ENDPOINT}"
)
llm = openai_llm
# Initialize LLMClass
def initialize_llm(model='openhermes'):
return llm # LLMClass(model=model, verbose=True)
# Get agent data from LLM
def get_agent_data(llm, overall_goal, delimiter):
instruction = (
f"Create a dataset in a CSV format with each field enclosed in double quotes, for a team of agents with the goal: '{overall_goal}'. "
"Include columns 'role', 'goal', 'backstory', 'assigned_task', 'allow_delegation'. "
"Provide a single-word role, a specific goal, a brief backstory, an assigned task, and delegation ability (True/False) for each agent."
"Every field, including the role, should be in double quotes to avoid confusion with the delimiter."
)
response = llm.invoke(instruction.format(overall_goal=overall_goal, delimiter=delimiter))
print("LLM's CSV Output:")
print(response)
return response
def extract_csv_lines(response):
# if response contains "```csv" then extract the lines between ```csv and ```.
match = re.search(r'```csv(.*)```', response, re.DOTALL)
if match:
csv_lines = match.group(1)
# print('csv lines: ' + csv_lines)
return csv_lines
else:
return response
# Parse CSV data from LLM's response
def parse_csv_data(response, delimiter=','):
header = ['role', 'goal', 'backstory', 'assigned_task', 'allow_delegation']
agents_data = []
response = extract_csv_lines(response)
lines = response.strip().split('\n')
for line in lines[1:]: # Skip header line
# print('parse csv line: ' + line)
if (line == '```'):
break
row = line.strip().split(delimiter)
# Remove quotes from each value in row
for i in range(len(row)):
row[i] = row[i].strip('"')
# if len(row) > len(header):
# # Concatenate the role component if it is split across multiple fields
# role = delimiter.join(row[:len(header)-1])
# agent_data = dict(zip(header, [role] + row[len(header)-1:]))
# else:
agent_data = dict(zip(header, row))
if 'role' not in agent_data or not agent_data['role']:
raise ValueError("Role component missing in CSV data")
agents_data.append(agent_data)
return agents_data
# Define an agent for the CrewAI script
def define_agent(agent, search_tool):
role_var = agent['role'].replace(" ", "_").replace("-", "_")
delegation = 'True' if agent['allow_delegation'] == 'True' else 'False'
return (f"{role_var} = Agent(\n"
f" role=\"\"\"{agent['role']}\"\"\",\n"
f" goal=\"\"\"{agent['goal']}\"\"\",\n"
f" backstory=\"\"\"{agent['backstory']}\"\"\",\n"
f" verbose=True,\n"
f" allow_delegation={delegation},\n"
f" llm=llm,\n"
f" tools=[search_tool]\n"
")\n\n")
# Define a task for the CrewAI script
def define_task(agent):
role_var = agent['role'].replace(" ", "_").replace("-", "_")
return (f"task_{role_var} = Task(\n"
f" description=\"\"\"{agent['assigned_task']}\"\"\",\n"
f" agent={role_var},\n"
f" verbose=True,\n"
")\n\n")
# Write the CrewAI script based on the agent and task data
def write_crewai_script(agents_data, file_path, llm, search_tool):
with open(file_path, 'w') as file:
# Writing imports and initializations
file.write(
"import os\n"
# "from langchain_community.chat_models import ChatOpenAI\n"
f"from langchain_community.llms import OpenAI\n"
"from langchain_community.tools import DuckDuckGoSearchRun\n"
"from crewai import Agent, Task, Crew, Process\n\n"
f"os.environ['OPENAI_API_KEY'] = '{your_OPENAI_api_key_here}'\n\n"
"search_tool = DuckDuckGoSearchRun()\n\n"
"openai_llm = OpenAI(\n"
" temperature=0,\n"
" model='whatever',\n"
f" openai_api_key='{your_OPENAI_api_key_here}',\n"
f" openai_api_base='{YOUR_LLM_ENDPOINT}')\n"
"llm = openai_llm\n\n"
)
for agent in agents_data:
file.write(define_agent(agent, search_tool))
for agent in agents_data:
file.write(define_task(agent))
crew_agents = ", ".join([agent['role'].replace(" ", "_").replace("-", "_") for agent in agents_data])
crew_tasks = ", ".join([f"task_{agent['role'].replace(' ', '_').replace('-', '_')}" for agent in agents_data])
file.write(
"crew = Crew(\n"
f" agents=[{crew_agents}],\n"
f" tasks=[{crew_tasks}],\n"
" verbose=True,\n"
" process=Process.sequential,\n"
")\n\n"
"# Kickoff the crew tasks\n"
"result = crew.kickoff()\n\n"
"# Handle the 'result' as needed\n"
)
# Main function
def main():
try:
llm = initialize_llm()
# overall_goal = input("Please specify the overall goal: ")
# delimiter = input("Please specify the delimiter used in the CSV data: ")
overall_goal = """
Starting with a random complex problem, recursively subdivide it into a sequence of
simpler problems until each problem is simple enough to solve directly.
Do not attempt to solve any problems now; only subdivide them.
"""
delimiter = ',' # local LLM always ignores this anyway.
response = get_agent_data(llm, overall_goal, delimiter)
if not response:
raise ValueError("No response from LLM")
agents_data = parse_csv_data(response, delimiter)
if not agents_data:
raise ValueError("No agent data parsed")
file_path = os.path.join(os.getcwd(), 'crewai-script.py')
write_crewai_script(agents_data, file_path, llm, DuckDuckGoSearchRun())
print(f"\nScript written to {file_path}")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
main()
Embed creation date/time, autocrew version number, overall_goal, autocrew parameters used, LLM used for generation, langchain tools used during generation, any recommendations received, LLM used for ranking (if applicable). Enable by default, disable via -s parameter
I've been encountering the following error upon running welcome.py (& autocrew.py)
ValueError: Missing or incomplete data for "role"
I'm running autocrew on Windows 10 WSL Ubuntu.
Here's the log: autocrew.log
EDIT: I've had this error using both ollama models & openai.
That's hardly in tune with the user-friendliness objective :)
Errors when finishing to execute autocrew :
2024-02-22 15:01:52,205 - [DEBUG] [utils.py:save_csv_output:156] CSV file saved at: /opt/autocrew/scripts/crewai-autocrew-20240222-150152-given-a-step-of-debian-type-linux-messag-alpha.csv
2024-02-22 15:01:52,205 - [ERROR] [utils.py:parse_csv_data:68] CSV data not found in the response.
2024-02-22 15:01:52,211 - [DEBUG] [welcome.py:run_autocrew_script:116] CSV data not found in the response.
2024-02-22 15:01:52,217 - [ERROR] [core.py:generate_single_script:260] Failed to process LLM response: CSV data not found in the response
2024-02-22 15:01:52,217 - [DEBUG] [welcome.py:run_autocrew_script:116] Failed to process LLM response: CSV data not found in the response
2024-02-22 15:01:52,218 - [ERROR] [autocrew.py:generate_and_run_scripts:293] An error occurred during script generation.
Traceback (most recent call last):
File "/opt/autocrew/autocrew.py", line 286, in generate_and_run_scripts
csv_file_paths = autocrew.generate_scripts(truncated_overall_goal, num_scripts_to_generate)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/autocrew/core.py", line 210, in generate_scripts
file_path = self.generate_single_script(i, num_scripts, overall_goal, crew_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/autocrew/core.py", line 258, in generate_single_script
return process_response(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/autocrew/core.py", line 222, in process_response
agents_data = parse_csv_data(response, delimiter=',', filename=file_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/autocrew/utils.py", line 69, in parse_csv_data
raise ValueError('CSV data not found in the response')
ValueError: CSV data not found in the response
2024-02-22 15:01:52,220 - [DEBUG] [welcome.py:run_autocrew_script:116] An error occurred during script generation.
2024-02-22 15:01:52,220 - [DEBUG] [welcome.py:run_autocrew_script:116] Traceback (most recent call last):
2024-02-22 15:01:52,220 - [DEBUG] [welcome.py:run_autocrew_script:116] File "/opt/autocrew/autocrew.py", line 286, in generate_and_run_scripts
2024-02-22 15:01:52,220 - [DEBUG] [welcome.py:run_autocrew_script:116] csv_file_paths = autocrew.generate_scripts(truncated_overall_goal, num_scripts_to_generate)
2024-02-22 15:01:52,220 - [DEBUG] [welcome.py:run_autocrew_script:116] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-22 15:01:52,221 - [DEBUG] [welcome.py:run_autocrew_script:116] File "/opt/autocrew/core.py", line 210, in generate_scripts
2024-02-22 15:01:52,221 - [DEBUG] [welcome.py:run_autocrew_script:116] file_path = self.generate_single_script(i, num_scripts, overall_goal, crew_name)
2024-02-22 15:01:52,221 - [DEBUG] [welcome.py:run_autocrew_script:116] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-22 15:01:52,221 - [DEBUG] [welcome.py:run_autocrew_script:116] File "/opt/autocrew/core.py", line 258, in generate_single_script
2024-02-22 15:01:52,221 - [DEBUG] [welcome.py:run_autocrew_script:116] return process_response(response)
2024-02-22 15:01:52,221 - [DEBUG] [welcome.py:run_autocrew_script:116] ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-22 15:01:52,221 - [DEBUG] [welcome.py:run_autocrew_script:116] File "/opt/autocrew/core.py", line 222, in process_response
2024-02-22 15:01:52,222 - [DEBUG] [welcome.py:run_autocrew_script:116] agents_data = parse_csv_data(response, delimiter=',', filename=file_path)
2024-02-22 15:01:52,222 - [DEBUG] [welcome.py:run_autocrew_script:116] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-22 15:01:52,222 - [DEBUG] [welcome.py:run_autocrew_script:116] File "/opt/autocrew/utils.py", line 69, in parse_csv_data
2024-02-22 15:01:52,222 - [DEBUG] [welcome.py:run_autocrew_script:116] raise ValueError('CSV data not found in the response')
2024-02-22 15:01:52,222 - [DEBUG] [welcome.py:run_autocrew_script:116] ValueError: CSV data not found in the response
2024-02-22 15:01:53,237 - [ERROR] [welcome.py:run_autocrew_script:122] Autocrew script returned a non-zero exit code.
2024-02-22 15:01:53,237 - [ERROR] [welcome.py:main:374] Autocrew script execution failed.
Hi,
i trthonk tutorial should mention to=
pip install -r requirements.txt
It looks like (at least on my ollama) the response coming back from ollama contains \n\n between each line which messes up csv parsing later on.
simple fix in core.py line 179:
try:
if self.llm_endpoint == 'ollama' and self.ollama:
response = self.ollama.invoke(instruction)
+ response = response.replace("\n\n", "\n")
# Log the raw LLM output
logging.debug(f"Raw LLM output (Ollama):\n{response}")
logging.debug(f"Number of tokens in the response: {count_tokens(response)}")
Also I noticed that your editor saves lines with 0x0d,0x0a (CR and NL).
I've found things go easier if you can save things with only the newline.
Ranking process completed.
AutoCrew script finished successfully
Select the crew you wish to run:
a) Alpha Crew
b) Beta Crew
g) Gamma Crew
Enter your choice (letter): g
No script file found for the selected crew: Gamma Crew
Ranking CSV file not found.
Ranking CSV file not found.
It'll likely be a case of adding your OpenAI API key to a config file
seems the code is not reading the OPENAI_BASE_URL from the env?
issue for different repo, closed.
Create chess program in c++ gave this. Note that allow_delegation is text, it looks like the goal is spilling over into allow_delegation.
agent_Team_Leader = Agent(
role="Team Leader",
backstory=dedent("""A seasoned chess player and programmer with extensive experience leading teams."""),
goal=dedent("""Oversee the project and ensure effective collaboration between agents."""),
allow_delegation=assign tasks based on individual strengths,
verbose=True,
llm=llm,
)
task_Team_Leader = Task(
description=dedent(""""Coordinate efforts among team members"""),
agent=agent_Team_Leader,
)
agent_Chess_Expert = Agent(
role="Chess Expert",
backstory=dedent("""International Master with a deep understanding of chess strategy and tactics."""),
goal=dedent("""Develop the core chess algorithm using advanced techniques."""),
allow_delegation=middle game,
verbose=True,
llm=llm,
)
task_Chess_Expert = Task(
description=dedent(""""Design the opening"""),
agent=agent_Chess_Expert,
)
agent_AI_Designer = Agent(
role="AI Designer",
backstory=dedent("""Passionate about AI, holds a PhD in computer science, and has experience developing autonomous systems."""),
goal=dedent("""Create an intelligent design for the chess program, implementing machine learning models."""),
allow_delegation=train the models using large datasets,
verbose=True,
llm=llm,
)
task_AI_Designer = Task(
description=dedent(""""Design the neural network architecture"""),
agent=agent_AI_Designer,
)
agent_C++_Developer = Agent(
role="C++ Developer",
backstory=dedent("""Highly skilled C++ developer with extensive experience in writing efficient and scalable code."""),
goal=dedent("""Write the C++ codebase for the chess program."""),
allow_delegation=as well as the AI Designer's machine learning models,
verbose=True,
llm=llm,
Hi, script is becoming a separate valuable system now. Great!! I just found issue. I have Ollama server as separate instance. Its accessible in default port but during crew creation it turns out its looking for ollama folder. 👍
Welcome to AutoCrew!
Use the -? or -h command line options to display help information.
Settings can be modified within "config.ini". Scripts are saved in the "scripts" subdirectory.
If you experience any errors, please create an issue on Github and attach "autocrew.log":
https://github.com/yanniedog/autocrew/issues/new
AutoCrew version: 3.1.0
You are running the latest version of AutoCrew.
Please specify your overall goal: research newest trends in fashion
How many alternative crews do you wish to generate? [3]:
Do you want the crews to be ranked afterwards? (yes/no) [yes]: yes
Use existing settings (LLM endpoint: openai, Model: gpt-3.5-turbo)? (y/n) [yes]: n
1) ollama
2) openai
Select the LLM endpoint: 1
Your downloaded models:
1. codellama:13b-python-q6_K
2. dolphin-mixtral:latest
3. llama-pro:8b-instruct-q8_0
4. llama-pro:8b-text-q8_0
5. llama-pro:latest
6. mistral:latest
7. mixtral:latest
8. neural-chat:latest
9. nous-hermes2-mixtral:latest
10. openhermes:7b-mistral-v2.5-q8_0
11. openhermes:latest
12. phi:latest
13. tinyllama:latest
14. [Download a NEW model]
Enter the number of the model to download, or type a model name:
Your choice (type 'back' to go back): 11
You have selected the model: openhermes:latest
Use the same settings for CrewAI scripts? (y/n): y
Initializing local connection to Ollama using model openhermes:latest...
Traceback (most recent call last):
File "/home/piotr/CrewAI/Tutorials/autocrew/core.py", line 120, in start_ollama_service
subprocess.check_output(["pgrep", "-f", "ollama serve"])
File "/home/piotr/anaconda3/envs/AutoCrewTutorials/lib/python3.12/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/piotr/anaconda3/envs/AutoCrewTutorials/lib/python3.12/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['pgrep', '-f', 'ollama serve']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/piotr/CrewAI/Tutorials/autocrew/welcome.py", line 378, in <module>
main()
File "/home/piotr/CrewAI/Tutorials/autocrew/welcome.py", line 362, in main
autocrew = AutoCrew(config_path) # Pass the path to the config.ini file to the AutoCrew constructor
^^^^^^^^^^^^^^^^^^^^^
File "/home/piotr/CrewAI/Tutorials/autocrew/core.py", line 87, in __init__
self.ollama = self.initialize_ollama() if self.llm_endpoint == 'ollama' else None
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/piotr/CrewAI/Tutorials/autocrew/core.py", line 105, in initialize_ollama
self.start_ollama_service()
File "/home/piotr/CrewAI/Tutorials/autocrew/core.py", line 125, in start_ollama_service
subprocess.Popen(["ollama", "serve"], start_new_session=True)
File "/home/piotr/anaconda3/envs/AutoCrewTutorials/lib/python3.12/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/piotr/anaconda3/envs/AutoCrewTutorials/lib/python3.12/subprocess.py", line 1950, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ollama'
I have Win11pro, WSL2 and Ubuntu22.04. Autocrew - freshly start with cleans Ubuntu.
Query, create a program to play chess in C++.
Resulted in C++_Developer, probably better to only allow Alphnumberical plus _ in names.
import os
from langchain_community.llms import Ollama
from langchain_community.tools import DuckDuckGoSearchRun
from crewai import Agent, Task, Crew, Process
import openai
ollama_host = "http://localhost:11434"
ollama = Ollama(model="openhermes", base_url='http://localhost:11434')
search_tool = DuckDuckGoSearchRun()
Project_Manager = Agent(
role="Project Manager",
goal="Organize team and manage resources",
backstory="Experienced in team management and resource allocation.",
verbose=True,
allow_delegation=False,
llm=ollama,
tools=[search_tool]
)
task_Project_Manager = Task(
description="Oversee the project and assign tasks to agents.",
agent=Project_Manager,
verbose=True,
)
Chess_Expert = Agent(
role="Chess Expert",
goal="Create an algorithm for chess moves.",
backstory="Highly skilled in chess strategy and tactics.",
verbose=True,
allow_delegation=True,
llm=ollama,
tools=[search_tool]
)
task_Chess_Expert = Task(
description="Develop a program that can play chess at an advanced level.",
agent=Chess_Expert,
verbose=True,
)
C++_Developer = Agent(
role="C++ Developer",
goal="Code the program in C++",
backstory="Proficient in C++ programming language.",
verbose=True,
allow_delegation=False,
llm=ollama,
tools=[search_tool]
)
task_C++_Developer = Task(
description="Implement the chess algorithm into a functioning program.",
agent=C++_Developer,
verbose=True,
)
QA_Tester = Agent(
role="QA Tester",
goal="Test the program for bugs and errors",
backstory="Experienced in software testing.",
verbose=True,
allow_delegation=True,
llm=ollama,
tools=[search_tool]
)
task_QA_Tester = Task(
description="Ensure the program functions correctly and without errors.",
agent=QA_Tester,
verbose=True,
)
crew = Crew(
agents=[Project_Manager, Chess_Expert, C++_Developer, QA_Tester],
tasks=[task_Project_Manager, task_Chess_Expert, task_C++_Developer, task_QA_Tester],
verbose=True,
process=Process.sequential,
)
# Kickoff the crew tasks
result = crew.kickoff()
# Handle the "result" as needed
Why script ask for delimiter? Why we need it?
python autocrew.py
.ValueError
after 3 failed attempts.autocrew.log
file for more details. autocrew.logIf anyone knows how to use the OpenAI api within a CrewAI script, please let me know, so I can ensure Autocrew generates scripts with the required structure
{logs} autocrew.log
AutoCrew failed during the script generation phase due to a specific error encountered when attempting to process the response from the Large Language Model (LLM). The core issue that led to the failure was the inability of the AutoCrew system to find and extract CSV data from the LLM's response. This situation is highlighted by the error message "No CSV data found in the response", which was encountered after attempting to generate agent data based on the provided instructions and overall goal.
Here's a breakdown of what happened, why it failed, and how the failure occurred:
To address this issue, the AutoCrew system or the user would need to ensure that the instructions to the LLM are clear and explicit about the required CSV format, possibly including more detailed guidance on how the data should be structured. Additionally, enhancing AutoCrew's response processing logic to more flexibly interpret and format LLM outputs into the desired CSV structure could mitigate similar failures in the future.
I used wsl to run autocrew.py from ubuntu terminal.
I believe, given they're only up to version 0.0.15, langchain community should be 0.0.1 (requirements.txt has 0.1.0)
Running python autocrew.py
gives me:
Here's my stack trace:
Welcome to AutoCrew!
Use the -? or -h command line options to display help information.
Settings can be modified within "config.ini". Scripts are saved in the "scripts" subdirectory.
If you experience any errors, please create an issue on Github and attach "autocrew.log":
https://github.com/yanniedog/autocrew/issues/new
AutoCrew version: 3.1.0
You are running the latest version of AutoCrew.
Generating 3 alternative scripts...
Generating crew 1 of 3 ('alpha' crew)...
No CSV data found in the response.
Failed to process LLM response: No CSV data found in the response
An error occurred during script generation.
Traceback (most recent call last):
File "/Users/slava/dev/testing/Autocrew/autocrew.py", line 286, in generate_and_run_scripts
csv_file_paths = autocrew.generate_scripts(truncated_overall_goal, num_scripts_to_generate)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/slava/dev/testing/Autocrew/core.py", line 210, in generate_scripts
file_path = self.generate_single_script(i, num_scripts, overall_goal, crew_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/slava/dev/testing/Autocrew/core.py", line 258, in generate_single_script
return process_response(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/slava/dev/testing/Autocrew/core.py", line 221, in process_response
file_path = save_csv_output(response, overall_goal, truncation_length=self.overall_goal_truncation_for_filenames, greek_suffix=greek_suffix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/slava/dev/testing/Autocrew/utils.py", line 140, in save_csv_output
raise ValueError("No CSV data found in the response")
ValueError: No CSV data found in the response
Autocrew script returned a non-zero exit code.
Autocrew script execution failed.
Any ideas?
Goal is 'Create a c++ program to play chess'
1st error is:
UI/UX = Agent(
2nd error variable renaming:
Dev_Lead = Agent(....
crew = Crew(
agents=[PM, DevLead, QA, UI/UX, Database],
Complete result is:
import os
from langchain_community.chat_models import ChatOpenAI
from langchain_community.llms import Ollama
from langchain_community.tools import DuckDuckGoSearchRun
from crewai import Agent, Task, Crew, Process
os.environ["OPENAI_API_KEY"] = "your_OPENAI_api_key_here"
ollama_openhermes = Ollama(model="openhermes")
search_tool = DuckDuckGoSearchRun()
PM = Agent(
role="PM",
goal="Manage team",
backstory="Experienced project manager with a background in software development.",
verbose=True,
allow_delegation=False,
llm=ollama_openhermes,
tools=[search_tool]
)
Dev_Lead = Agent(
role="Dev Lead",
goal="Develop algorithm",
backstory="Skilled developer with expertise in C++ and algorithms.",
verbose=True,
allow_delegation=True,
llm=ollama_openhermes,
tools=[search_tool]
)
QA = Agent(
role="QA",
goal="Test program",
backstory="Experienced QA engineer with a passion for detail and quality assurance.",
verbose=True,
allow_delegation=True,
llm=ollama_openhermes,
tools=[search_tool]
)
UI/UX = Agent(
role="UI/UX",
goal="Design interface",
backstory="Creative UI/UX designer with experience in creating intuitive and user-friendly interfaces.",
verbose=True,
allow_delegation=True,
llm=ollama_openhermes,
tools=[search_tool]
)
Database = Agent(
role="Database",
goal="Implement database",
backstory="Skilled database administrator with experience in optimizing performance and ensuring data integrity.",
verbose=True,
allow_delegation=True,
llm=ollama_openhermes,
tools=[search_tool]
)
task_PM = Task(
description="Create C++ program to play chess.",
agent=PM,
verbose=True,
)
task_Dev_Lead = Task(
description="Create algorithm for chess moves and evaluation function.",
agent=Dev_Lead,
verbose=True,
)
task_QA = Task(
description="Test the C++ program to ensure it is working correctly and accurately.",
agent=QA,
verbose=True,
)
task_UI/UX = Task(
description="Create a user-friendly and visually appealing chess interface for our C++ program.",
agent=UI/UX,
verbose=True,
)
task_Database = Task(
description="Implement the necessary database to store game states and other relevant information.",
agent=Database,
verbose=True,
)
crew = Crew(
agents=[PM, DevLead, QA, UI/UX, Database],
tasks=[task_PM, task_Dev_Lead, task_QA, task_UI/UX, task_Database],
verbose=True,
process=Process.sequential,
)
# Kickoff the crew tasks
result = crew.kickoff()
# Handle the "result" as needed
what is ranking mode?
Your CrewAI script is saved here: scripts/crewai-autocrew-20240201-095215-A-hypothetical-software-development-comp-gamma.py
File "/mnt/d/interpreter/autocrew/scripts/crewai-autocrew-20240201-095058-A-hypothetical-software-development-comp-alpha.py", line 37
agent_UX/UI_Designer = Agent(
^^^^^^^^^^^^^^^^^^^^
SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
File "/mnt/d/interpreter/autocrew/scripts/crewai-autocrew-20240201-095131-A-hypothetical-software-development-comp-beta.py", line 24
agent_UI/UX_Designer = Agent(
^^^^^^^^^^^^^^^^^^^^
SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
File "/mnt/d/interpreter/autocrew/scripts/crewai-autocrew-20240201-095215-A-hypothetical-software-development-comp-gamma.py", line 37
agent_UX/UI_Designer = Agent(
^^^^^^^^^^^^^^^^^^^^
SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
AutoCrew script finished successfully
crew = Crew(
agents=[PM, AIExpert, Cpp_Developer, QATester, ProductOwner],
tasks=[task_PM, task_AI_Expert, task_Cpp_Developer, task_QA_Tester, task_Product_Owner],
verbose=True,
process=Process.sequential,
)```
should have been
```crew = Crew(
agents=[PM, AI_Expert, Cpp_Developer, QA_Tester, ProductOwner],
tasks=[task_PM, task_AI_Expert, task_Cpp_Developer, task_QA_Tester, task_Product_Owner],
verbose=True,
process=Process.sequential,
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.