smol-ai / developer

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

Characters like `+` throws parsing error #78

Open onlyphantom opened 1 year ago

onlyphantom commented 1 year ago

Running python main_no_modal.py with prompt including characters like ; and : would throw the following error, seems to be related to one of the parsing (.lstrip(" \t")).

Edit: After some experimentation, it seems like it is the character + instead.

Traceback (most recent call last):
  File "~/Desktop/developer/main_no_modal.py", line 230, in <module>
    main(prompt, directory, file)
  File "~/Desktop/developer/main_no_modal.py", line 135, in main
    list_actual = ast.literal_eval(filepaths_string)
  File "/usr/lib/python3.10/ast.py", line 62, in literal_eval
    node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
  File "/usr/lib/python3.10/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    - /src/index.js
      ^
SyntaxError: invalid syntax

Just for reproducibility:

  1. install the dependencies
  2. export the OpenAI API Key
  3. runpython main_no_modal.py "a react app that is luxurious and dark-themed, offering a simple form to RSVP to the wedding; Form has following fields: first name, last name, checkbox indicating a +1" -> this will not work and will throw the earlier error
  4. run python main_no_modal.py "a react app that is luxurious and dark-themed, offering a simple form to RSVP to the wedding." -> this will work.
Dip707 commented 1 year ago

@swyxio characters which can't be put directly into a string give syntax error, please look into it, a possible solution is to always to stringify the input to apis and output from api's

swyxio commented 1 year ago

good bug - thank you. i havent really figured out how to fix this properly yet.