smol-ai / developer

the first library to let you embed a developer agent in your own app!
https://twitter.com/SmolModels
MIT License
11.76k stars 1.03k forks source link

SyntaxError: invalid syntax when running with simple prompt #109

Open ashutoshanand13 opened 1 year ago

ashutoshanand13 commented 1 year ago

Here's what I prompted: modal run main.py --prompt "a Chrome extension that, when clicked, gives me the today date and time in CST timezone"

Here's the error I'm getting right now:

✓ Created objects. ├── 🔨 Created generate_response. ├── 🔨 Created mount C:\Users\ASHUTOSH ANAND\git\AI\developer\main.py ├── 🔨 Created mount C:\Users\ASHUTOSH ANAND\git\AI\developer\utils.py ├── 🔨 Created mount C:\Users\ASHUTOSH ANAND\git\AI\developer\constants.py └── 🔨 Created generate_file. hi its me, the smol developer! you said you wanted: a Chrome extension that, when clicked, gives me the today date and time in CST timezone 106 tokens in prompt: You are an AI developer who is trying to write a p... 18 tokens in prompt: a Chrome extension that, when clicked, gives me th... manifest.json popup.html popup.js ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ <frozen runpy>:198 in _run_module_as_main │ │ │ │ <frozen runpy>:88 in _run_code │ │ │ │ │ │ C:\Users\ASHUTOSH ANAND\AppData\Local\Programs\Python\Python311\Scripts\modal.exe\__main__.py:7 │ │ in <module> │ │ │ │ │ │ C:\Users\ASHUTOSH │ │ ANAND\AppData\Local\Programs\Python\Python311\Lib\site-packages\modal\__main__.py:6 in main │ │ │ │ 5 def main(): │ │ ❱ 6 │ entrypoint_cli() │ │ 7 │ │ │ │ C:\Users\ASHUTOSH │ │ ANAND\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py:1130 in __call__ │ │ │ │ 1129 │ │ """Alias for :meth:main.""" │ │ ❱ 1130 │ │ return self.main(*args, **kwargs) │ │ 1131 │ │ │ │ C:\Users\ASHUTOSH │ │ ANAND\AppData\Local\Programs\Python\Python311\Lib\site-packages\typer\core.py:778 in main │ │ │ │ 777 │ ) -> Any: │ │ ❱ 778 │ │ return _main( │ │ 779 │ │ │ self, │ │ │ │ C:\Users\ASHUTOSH │ │ ANAND\AppData\Local\Programs\Python\Python311\Lib\site-packages\typer\core.py:216 in _main │ │ │ │ 215 │ │ │ with self.make_context(prog_name, args, **extra) as ctx: │ │ ❱ 216 │ │ │ │ rv = self.invoke(ctx) │ │ 217 │ │ │ │ if not standalone_mode: │ │ │ │ C:\Users\ASHUTOSH │ │ ANAND\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py:1657 in invoke │ │ │ │ 1656 │ │ │ │ with sub_ctx: │ │ ❱ 1657 │ │ │ │ │ return _process_result(sub_ctx.command.invoke(sub_ctx)) │ │ 1658 │ │ │ │ C:\Users\ASHUTOSH │ │ ANAND\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py:1657 in invoke │ │ │ │ 1656 │ │ │ │ with sub_ctx: │ │ ❱ 1657 │ │ │ │ │ return _process_result(sub_ctx.command.invoke(sub_ctx)) │ │ 1658 │ │ │ │ C:\Users\ASHUTOSH │ │ ANAND\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py:1404 in invoke │ │ │ │ 1403 │ │ if self.callback is not None: │ │ ❱ 1404 │ │ │ return ctx.invoke(self.callback, **ctx.params) │ │ 1405 │ │ │ │ C:\Users\ASHUTOSH │ │ ANAND\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py:760 in invoke │ │ │ │ 759 │ │ │ with ctx: │ │ ❱ 760 │ │ │ │ return __callback(*args, **kwargs) │ │ 761 │ │ │ │ C:\Users\ASHUTOSH │ │ ANAND\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\decorators.py:26 in │ │ new_func │ │ │ │ 25 │ def new_func(*args, **kwargs): # type: ignore │ │ ❱ 26 │ │ return f(get_current_context(), *args, **kwargs) │ │ 27 │ │ │ │ C:\Users\ASHUTOSH │ │ ANAND\AppData\Local\Programs\Python\Python311\Lib\site-packages\modal\cli\run.py:116 in f │ │ │ │ 115 │ │ │ else: │ │ ❱ 116 │ │ │ │ func(*args, **kwargs) │ │ 117 │ │ │ if app.function_invocations == 0: │ │ │ │ C:\Users\ASHUTOSH ANAND\git\AI\developer\main.py:132 in main │ │ │ │ 131 │ try: │ │ ❱ 132 │ │ list_actual = ast.literal_eval(filepaths_string) │ │ 133 │ │ │ │ C:\Users\ASHUTOSH ANAND\AppData\Local\Programs\Python\Python311\Lib\ast.py:64 in literal_eval │ │ │ │ 63 │ if isinstance(node_or_string, str): │ │ ❱ 64 │ │ node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval') │ │ 65 │ if isinstance(node_or_string, Expression): │ │ │ │ C:\Users\ASHUTOSH ANAND\AppData\Local\Programs\Python\Python311\Lib\ast.py:50 in parse │ │ │ │ 49 │ # Else it should be an int giving the minor version for 3.x. │ │ ❱ 50 │ return compile(source, filename, mode, flags, │ │ 51 │ │ │ │ _feature_version=feature_version) │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │ <unknown>:2 │ │ popup.html │ │ ▲ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ SyntaxError: invalid syntax

Not able to figure out what exactly is wrong here.

harisyammnv commented 1 year ago

@ashutoshanand13 : Can you try changing the prompt to this one I am using the non modal python file and this worked for me

filepaths_string = generate_response(
        """You are an AI developer who is trying to write a program that will generate code for the user based on their intent.

    When given their intent, create a complete, exhaustive list of filepaths that the user would write to make the program.

    only list the filepaths you would write, and return them as a json list of strings.
    do not add any other explanation, only return a json list of strings.
    """,
        prompt,
    )

You should replace these lines