MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

Generated code not good

Open RomanPolach opened this issue 2 years ago • 2 comments

It generated nice looking clean and totally NOT working, buggy code and it ignored half of the requirements. I think it goes to good direction, but you can not let it run autonomusly and expect it work. It should ask for human feedback, like "Human as a tool" in langchain. This was my prompt:

Create a python script, where i can put my android app project path and it will do following: 1)Find all kotlin classes in root and all subdirectories. 2) Find all hardcoded strings in our Composable functions. They can be with variables or without them. Variables can be in brackets or without them, handle both cases. Ignore empty strings and strings outside of composable functions. 3) Use GPT for making strings.txt file which should contain record for each of our strings in following format: [profile_none_registered_events] cs = Zatim jste se neprihlasili na zadnou akci. Jakmile se prihlasite, uvidite ji zde. en = You haven't registered for any events yet. Once you register for one, you'll see it here. sk = Zatim jste se neprihlasili na zadnou akci. Jakmile se prihlasite, uvidite ji zde. it = Non ti sei ancora registrato per nessun evento. Una volta che ti registri per uno, lo vedrai qui. Let GPT make meaningful and unique titles for each and create all language variants. For strings with variables, create placeholders like %1$s, %2$s. 4) Finally replace all hardcoded strings in composables in all kotlin files with stringResource(R.string.string_title) with corresponding resource title. If our strings had variables, use them as parameters - stringResource(R.string.string_title, variableName).

It generated prompt to translate string to French, which is not even in my prompt, lol. It also ignored other languages. It made some functions which it never used. It called some functions, but never used their return values. It ignored variables in strings, despite being in requirements, etc.

I think it went off the rails very quickly, because these details were ignored already before it started to write code:

Product Goals

[
    "Develop a Python script that can locate all Kotlin classes within an Android app project",
    "Identify and replace hardcoded strings within Composable functions",
    "Generate a strings.txt file with GPT, including creating unique titles and language variants for each string"
] - NO WORD ABOUT VARIABLES

User Stories

[
    "As a developer, I want to easily locate all Kotlin classes within my Android app project",
    "As a developer, I want to identify all hardcoded strings within Composable functions and replace them with string resources",
    "As a developer, I want to generate a strings.txt file that contains all strings in multiple languages, including placeholders for variables"
]

Requirement Pool

[                                                                                                                 
    ("The script should locate all Kotlin classes in the Android app project", "P0"),                             
    ("The script should identify all hardcoded strings within Composable functions", "P0"),                       
    ("The script should replace hardcoded strings with string resources", "P0"),                                  
    ("The script should generate a strings.txt file with GPT", "P0"),                                             
    ("The script should create unique titles and language variants for each string in the strings.txt file", "P0") - (YEAH, BUT FOR WHICH LANGUAGES? ALSO NO WORD ABOUT VARIABLES)
]                                                                                                                 

RomanPolach avatar Aug 09 '23 19:08 RomanPolach

Yes, MetaGPT's ability to handle detailed requirements needs to be further improved.

voidking avatar Aug 10 '23 09:08 voidking

You can try to take over the product manager's PRD

geekan avatar Sep 09 '23 03:09 geekan