Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev experience tweaks #138

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.env
env
__pycache__
.vscode
.idea
/.idea/
venv/
Expand Down
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug main.py",
"type": "python",
"request": "launch",
"program": "main.py",
"console": "integratedTerminal",
"justMyCode": true,
"args": ["--debug", "'a HTML/JS/CSS Tic Tac Toe Game'"],
"preLaunchTask": "poetry-install",
}
]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python3"
}

12 changes: 12 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "2.0.0",
"tasks": [
// Install or update all dependencies for all projects in the monrepo
{
"label": "poetry-install",
"type": "shell",
"command": "poetry install",
"problemMatcher": [], // Empty so users are not promted to select progress reporting
},
]
}
48 changes: 46 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ readme = "readme.md"
packages = [{ include = "smol_dev" }]

[tool.poetry.dependencies]
python = ">=3.8"
python = ">=3.9, <4.0"
openai = "^0.27.8"
openai-function-call = "^0.0.5"
tenacity = "^8.2.2"
agent-protocol = "^0.2.3"
python-dotenv = "^1.0.0"

[build-system]
requires = ["poetry-core"]
Expand Down
15 changes: 10 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,19 @@ After the [successful initial v0 launch](https://twitter.com/swyx/status/1657578
git clone https://github.com/smol-ai/developer.git
cd developer
poetry install # install dependencies. pip install poetry if you need
poetry shell # activate virtualenv

# run
python main.py "a HTML/JS/CSS Tic Tac Toe Game" # defaults to gpt-4-0613
# python main.py "a HTML/JS/CSS Tic Tac Toe Game" --model=gpt-3.5-turbo-0613
python3 main.py "a HTML/JS/CSS Tic Tac Toe Game" # defaults to gpt-4-0613
# python3 main.py "a HTML/JS/CSS Tic Tac Toe Game" --model=gpt-3.5-turbo-0613

# other cli flags
python main.py --prompt prompt.md # for longer prompts, move them into a markdown file
python main.py --prompt prompt.md --debug True # for debugging
python3 main.py --prompt prompt.md # for longer prompts, move them into a markdown file
python3 main.py --prompt prompt.md --debug True # for debugging
```

> Make sure to copy `.example.env` to `.env` and fill in your OpenAI API key

<details>
<summary>
This lets you develop apps as a human in the loop, as per the original version of smol developer.
Expand Down Expand Up @@ -72,6 +75,8 @@ Loop until happiness is attained. Notice that AI is only used as long as it is a

In this way you can use your clone of this repo itself to prototype/develop your app.

Alternatively, you can install and debug smol-developer in VS Code just by pressing F5 (using the preconfigured `launch.json`).

### In Library mode

This is the new thing in smol developer v1! Add `smol developer` to your own projects!
Expand Down Expand Up @@ -110,7 +115,7 @@ poetry run api
```
or
```bash
python smol_dev/api.py
python3 smol_dev/api.py
```

and then you can call the API using either the following commands:
Expand Down
5 changes: 5 additions & 0 deletions smol_dev/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
wait_random_exponential,
)
import logging
import os
from dotenv import load_dotenv

logger = logging.getLogger(__name__)

load_dotenv()
openai.api_key = os.environ.get("OPENAI_API_KEY")


SMOL_DEV_SYSTEM_PROMPT = """
You are a top tier AI developer who is trying to write a program that will generate code for the user based on their intent.
Expand Down