FSoft-AI4Code / AgileCoder

Incorporating Agile methodology into agents to create complex real-world softwares
MIT License
329 stars 41 forks source link

Unable to Generate a Software w/ AgileCoder #3

Open diopresi opened 1 month ago

diopresi commented 1 month ago

Description:

I encountered multiple issues while trying to create a software project using AgileCoder.

Steps to Reproduce:

  1. Using the Command-Line Interface from PyPi:

    • Run the command:
      agilecoder --task "create a tic-tac-toe game in python"
    • During execution, I faced an issue related to tree-sitter-python.
    • I attempted to resolve this by installing the package as suggested in the error message:
      pip install git+https://github.com/tree-sitter/tree-sitter-python.git@master
    • After retrying, I encountered the following errors:

      /Users/admin/Desktop/git/augest/poc/agile-coder-poc-off/venv/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
      warnings.warn(
      ------------------------------
      /Users/admin/Desktop/git/augest/poc/agile-coder-poc-off/venv/lib/python3.9/site-packages/nltk/translate/bleu_score.py:552: UserWarning:
      The hypothesis contains 0 counts of 4-gram overlaps.
      Therefore the BLEU score evaluates to 0, independently of
      how many N-gram overlaps of lower order it contains.
      Consider using lower n-gram order or use SmoothingFunction()
      warnings.warn(_msg)
      Traceback (most recent call last):
      File "/Users/admin/Desktop/git/augest/poc/agile-coder-poc-off/venv/bin/agilecoder", line 8, in <module>
       sys.exit(main())
      File "/Users/admin/Desktop/git/augest/poc/agile-coder-poc-off/venv/lib/python3.9/site-packages/agilecoder/cli.py", line 24, in main
       run_task(args)
      File "/Users/admin/Desktop/git/augest/poc/agile-coder-poc-off/venv/lib/python3.9/site-packages/agilecoder/run_api.py", line 114, in run_task
       chat_chain.execute_chain()
      File "/Users/admin/Desktop/git/augest/poc/agile-coder-poc-off/venv/lib/python3.9/site-packages/agilecoder/components/chat_chain.py", line 165, in execute_chain
       self.execute_step(phase_item)
      File "/Users/admin/Desktop/git/augest/poc/agile-coder-poc-off/venv/lib/python3.9/site-packages/agilecoder/components/chat_chain.py", line 154, in execute_step
       self.chat_env = compose_phase_instance.execute(self.chat_env)
      File "/Users/admin/Desktop/git/augest/poc/agile-coder-poc-off/venv/lib/python3.9/site-packages/agilecoder/components/composed_phase.py", line 148, in execute
       self.phases[phase].update_phase_env(chat_env)
      File "/Users/admin/Desktop/git/augest/poc/agile-coder-poc-off/venv/lib/python3.9/site-packages/agilecoder/components/phase.py", line 600, in update_phase_env
       all_done_tasks = '\n'.join(chat_env.env_dict['done-works'])
      KeyError: 'done-works'
  2. Running Directly from Source Code:

    • I also tried running the project directly from the source code and encountered the following error:

      /Users/admin/Desktop/git/augest/poc/AgileCoder/venv/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
      warnings.warn(
      ------------------------------
      Traceback (most recent call last):
      File "/Users/admin/Desktop/git/augest/poc/AgileCoder/venv/bin/agilecoder", line 33, in <module>
       sys.exit(load_entry_point('agilecoder', 'console_scripts', 'agilecoder')())
      File "/Users/admin/Desktop/git/augest/poc/AgileCoder/agilecoder/cli.py", line 24, in main
       run_task(args)
      File "/Users/admin/Desktop/git/augest/poc/AgileCoder/agilecoder/run_api.py", line 114, in run_task
       chat_chain.execute_chain()
      File "/Users/admin/Desktop/git/augest/poc/AgileCoder/agilecoder/components/chat_chain.py", line 165, in execute_chain
       self.execute_step(phase_item)
      File "/Users/admin/Desktop/git/augest/poc/AgileCoder/agilecoder/components/chat_chain.py", line 135, in execute_step
       self.chat_env = self.phases[phase].execute(self.chat_env,
      File "/Users/admin/Desktop/git/augest/poc/AgileCoder/agilecoder/components/phase.py", line 310, in execute
       self.chatting(chat_env=chat_env,
      File "/Users/admin/Desktop/git/augest/poc/AgileCoder/agilecoder/components/utils.py", line 110, in wrapper
       return func(*args, **kwargs)
      File "/Users/admin/Desktop/git/augest/poc/AgileCoder/agilecoder/components/phase.py", line 157, in chatting
       if isinstance(user_response.msg, ChatMessage):
      File "/Users/admin/Desktop/git/augest/poc/AgileCoder/agilecoder/camel/agents/chat_agent.py", line 53, in msg
       raise RuntimeError("error in ChatAgentResponse, info:{}".format(str(self.info)))
      RuntimeError: error in ChatAgentResponse, info:{'id': None, 'usage': None, 'termination_reasons': ['max_tokens_exceeded_by_camel'], 'num_tokens': 4125}

Additional Context: I am running this inside a virtual environment. Please advise on potential fixes or workarounds.

Expected Behavior: The command should execute without errors and generate the tic-tac-toe game.

Actual Behavior: The command fails with a KeyError: 'done-works' and other warnings when using the CLI. Running directly from the source code results in a RuntimeError due to exceeding the maximum token limit.

minhngh commented 1 month ago

Hi diopres,

Thank you for your feedback. I'm happy to address your concern.

If you have any concerns, don't hesitate to reach out to us.

svanschalkwyk commented 1 month ago

checked out new-flow, pip install -e AgileCoder. "Successfully installed agilecoder-0.2.0 codebleu-0.7.0 google-auth-oauthlib-1.2.1 markdown-3.5.2 nltk-3.8.1 oauthlib-3.2.2 pygame-2.6.0 requests-oauthlib-2.0.0 tenacity-8.2.3 tiktoken-0.6.0 tree-sitter-0.22.3" so tree-sitter is there.

import tree_sitter_python

ModuleNotFoundError: No module named 'tree_sitter_python'

pip install git+https://github.com/tree-sitter/tree-sitter-python.git@master seems to work

diopresi commented 1 month ago

Hi @minhngh,

The issues persist despite trying several approaches. Here’s a summary of what I’ve attempted so far:

Using PyPi Installation:

Using Source Code:

On both case, When passing the --model parameter with GPT_4, the following error occurs:

File "/AgileCoder/agilecoder/camel/agents/chat_agent.py", line 53, in msg
    raise RuntimeError("error in ChatAgentResponse, info:{}".format(str(self.info)))
RuntimeError: error in ChatAgentResponse, info:{'id': None, 'usage': None, 'termination_reasons': ['max_tokens_exceeded_by_camel'], 'num_tokens': 4123}

Any insights or further steps to resolve this issue would be appreciated. If you don't mind could you share the baseline requirement to run it?

Hi diopres,

Thank you for your feedback. I'm happy to address your concern.

  • Regarding the error: KeyError: 'done-works': we speculate there is a potential issue with the installation, which may lead to this bug. To resolve this error, we recommend that you create a new environment and then reinstall by running pip install agilecoder pip install git+https://github.com/tree-sitter/tree-sitter-python.git@master Be sure to check whether tree-sitter-python is installed successully by testing the statement: _import tree_sitterpython If you still have the problem, please provide more details about your system (OS, python version).
  • Regarding the problem with the source code: In fact, the source code on the master branch is obsolete, so there may be some problems with this branch. The latest source code is on the new-flow branch, but it should be noted that it hasn't been tested carefully. If you want to run from source code, you can clone the new-flow branch at the 4a1b863 commit.

If you have any concerns, don't hesitate to reach out to us.

minhngh commented 1 month ago

Hi diopres,

Thank you for your feedback. Below are our responses:

You can try following our steps. If the error still persists, our library actually logs each run in a file in the folder ~/WareHouse/. Can you provide log files with erroneous runs for deeper analysis?