Giter Site home page Giter Site logo

Comments (6)

clbarrell avatar clbarrell commented on July 3, 2024 1

Suggest you just add the following to the prompt as another way to increase likelihood of proper output

Example output:
["index.html", "style.css", "script.js"]

from developer.

terrafying avatar terrafying commented on July 3, 2024

Same. For hacking, I replaced the ast.literal_eval line on 135 with

for line in filepaths_string.split('\n'):
    list_actual.append(line.split(' ')[1].replace('`',''))

from developer.

swyxio avatar swyxio commented on July 3, 2024

this is very strange. i definitely use backticks everywhere in my prompt: https://github.com/smol-ai/developer/blob/main/prompt.md

can you report the exact line of code that errors and what the input is? if like @terrafying is reporting, it is

list_actual = ast.literal_eval(filepaths_string)
then i will try to work on a direct solution via smolai itself (i want it to just always return valid json)

from developer.

jdan avatar jdan commented on July 3, 2024

Same issue here. I'm using gpt-3.5-turbo

modal run main.py --prompt test-webapp/prompt.md --file package.json

prompt.md

a nodejs webapp that displays hello :name at the route /:name. include a package.json so I can run it with "npm start"

for the homepage, display a tutorial on how to use the webapp
I'd like an "npm run dev" command as well which reloads the server using nodemon.

## debugging notes

- sh: nodemon: command not found

output

modal run main.py --prompt test-webapp/prompt.md --file package.json
✓ Initialized. View app at https://modal.com/apps/ap-XXXXXXXXX
✓ Created objects.
├── 🔨 Created generate_response.
├── 🔨 Created mount /Users/jdan/Projects/smol-developer/main.py
└── 🔨 Created generate_file.
hi its me, 🐣the smol developer🐣! you said you wanted:
a nodejs webapp that displays hello :name at the route /:name. include a package.json so I can run it with "npm start"

for the homepage, display a tutorial on how to use the webapp
I'd like an "npm run dev" command as well which reloads the server using nodemon.

## debugging notes

- sh: nodemon: command not found
86 tokens in prompt: You are an AI developer who is trying to write a p
80 tokens in prompt: a nodejs webapp that displays hello :name at the r
- `./package.json`
- `./src/index.js`
- `./views/index.html`
- `./views/tutorial.html`

Here is the list of filepaths:

```
"./package.json"
"./src/index.js"
"./views/index.html"
"./views/tutorial.html"
```
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /opt/homebrew/Caskroom/miniforge/base/bin/modal:8 in <module>                                    │
│                                                                                                  │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                         │
│ ❱ 8 │   sys.exit(main())                                                                         │
│   9                                                                                              │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/modal/__main__.py:6 in main   │
│                                                                                                  │
│    5 def main():                                                                                 │
│ ❱  6 │   entrypoint_cli()                                                                        │
│    7                                                                                             │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/click/core.py:1130 in         │
│ __call__                                                                                         │
│                                                                                                  │
│   1129 │   │   """Alias for :meth:`main`."""                                                     │
│ ❱ 1130 │   │   return self.main(*args, **kwargs)                                                 │
│   1131                                                                                           │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/typer/core.py:778 in main     │
│                                                                                                  │
│   777 │   ) -> Any:                                                                              │
│ ❱ 778 │   │   return _main(                                                                      │
│   779 │   │   │   self,                                                                          │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/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:                                                    │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/click/core.py:1657 in invoke  │
│                                                                                                  │
│   1656 │   │   │   │   with sub_ctx:                                                             │
│ ❱ 1657 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))               │
│   1658                                                                                           │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/click/core.py:1657 in invoke  │
│                                                                                                  │
│   1656 │   │   │   │   with sub_ctx:                                                             │
│ ❱ 1657 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))               │
│   1658                                                                                           │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/click/core.py:1404 in invoke  │
│                                                                                                  │
│   1403 │   │   if self.callback is not None:                                                     │
│ ❱ 1404 │   │   │   return ctx.invoke(self.callback, **ctx.params)                                │
│   1405                                                                                           │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/click/core.py:760 in invoke   │
│                                                                                                  │
│    759 │   │   │   with ctx:                                                                     │
│ ❱  760 │   │   │   │   return __callback(*args, **kwargs)                                        │
│    761                                                                                           │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/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                                                                                            │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/modal/cli/run.py:116 in f     │
│                                                                                                  │
│   115 │   │   │   else:                                                                          │
│ ❱ 116 │   │   │   │   func(*args, **kwargs)                                                      │
│   117 │   │   │   if app.function_invocations == 0:                                              │
│                                                                                                  │
│ /Users/jdan/Projects/smol-developer/main.py:135 in main                                          │
│                                                                                                  │
│   134 │   try:                                                                                   │
│ ❱ 135 │   │   list_actual = ast.literal_eval(filepaths_string)                                   │
│   136                                                                                            │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/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):                                            │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/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)                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ - `./package.json`                                                                               │
│   ▲                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
SyntaxError: invalid syntax

from developer.

jdan avatar jdan commented on July 3, 2024

Printing filepaths_string shows:

- `./package.json`
- `./src/index.js`
- `./views/index.html`
- `./public/styles.css`

Here is the list of filepaths:

```
"./package.json",
"./src/index.js",
"./views/index.html",
"./public/styles.css"
```

from developer.

swyxio avatar swyxio commented on July 3, 2024

hey jdan! yeah ok this is another "doesnt return json" issue. short fix is to improve the prompt to not give us backticks like that. actual fix is to fix it at source... which i plan to do for smol.ai

from developer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.