Skip to content
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Sets the default shell for executing commands as /bin/bash and specifies command should be executed in a Bash shell.
# Sets the default shell for executing commands as /bin/bash and specifies command should be executed in a Bash shell.
SHELL := /bin/bash

# Color codes for terminal output
Expand All @@ -9,40 +9,40 @@ COLOR_GREEN=\033[1;32m
# Defines the targets help, install, dev-install, and run as phony targets.
.PHONY: help install run

#sets the default goal to help when no target is specified on the command line.
# Sets the default goal to help when no target is specified on the command line.
.DEFAULT_GOAL := help

#Disables echoing of commands.
# Disables echoing of commands.
.SILENT:

#Sets the variable name to the second word from the MAKECMDGOALS.
# Sets the variable name to the second word from the MAKECMDGOALS.
name := $(word 2,$(MAKECMDGOALS))

#Defines a target named help.
# Defines a target named help.
help:
@echo "Please use 'make <target>' where <target> is one of the following:"
@echo " help Return this message with usage instructions."
@echo " install Will install the dependencies using Poetry."
@echo " run <folder_name> Runs GPT Engineer on the folder with the given name."

#Defines a target named install. This target will install the project using Poetry.
# Defines a target named install. This target will install the project using Poetry.
install: poetry-install install-pre-commit farewell

#Defines a target named poetry-install. This target will install the project dependencies using Poetry.
# Defines a target named poetry-install. This target will install the project dependencies using Poetry.
poetry-install:
@echo -e "$(COLOR_CYAN)Installing project with Poetry...$(COLOR_RESET)" && \
poetry install

#Defines a target named install-pre-commit. This target will install the pre-commit hooks.
# Defines a target named install-pre-commit. This target will install the pre-commit hooks.
install-pre-commit:
@echo -e "$(COLOR_CYAN)Installing pre-commit hooks...$(COLOR_RESET)" && \
poetry run pre-commit install

#Defines a target named farewell. This target will print a farewell message.
# Defines a target named farewell. This target will print a farewell message.
farewell:
@echo -e "$(COLOR_GREEN)All done!$(COLOR_RESET)"

#Defines a target named run. This target will run GPT Engineer on the folder with the given name.
# Defines a target named run. This target will run GPT Engineer on the folder with the given name.
run:
@echo -e "$(COLOR_CYAN)Running GPT Engineer on $(COLOR_GREEN)$(name)$(COLOR_CYAN) folder...$(COLOR_RESET)" && \
poetry run gpt-engineer projects/$(name)
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ We actively support Python 3.10 - 3.12. The last version to support Python 3.8 -
### Setup API key

Choose **one** of:
- Export env variable (you can add this to .bashrc so that you don't have to do it each time you start the terminal)
- Export env variable (you can add this to `.bashrc` so that you don't have to do it each time you start the terminal)
- `export OPENAI_API_KEY=[your api key]`
- .env file:
- Create a copy of `.env.template` named `.env`
- Add your OPENAI_API_KEY in .env
- Add your `OPENAI_API_KEY` in `.env`
- Custom model:
- See [docs](https://gpt-engineer.readthedocs.io/en/latest/open_models.html), supports local model, azure, etc.

Expand All @@ -44,7 +44,8 @@ Check the [Windows README](./WINDOWS_README.md) for Windows usage.
**Other ways to run:**
- Use Docker ([instructions](docker/README.md))
- Do everything in your browser:
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/gpt-engineer-org/gpt-engineer/codespaces)

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/gpt-engineer-org/gpt-engineer/codespaces)

### Create new code (default usage)
- Create an empty folder for your project anywhere on your computer
Expand Down Expand Up @@ -77,21 +78,21 @@ The gptengineer.app team is actively supporting the open source community.
## Features

### Pre Prompts
You can specify the "identity" of the AI agent by overriding the `preprompts` folder with your own version of the `preprompts`. You can do so via the `--use-custom-preprompts` argument.
You can specify the "identity" of the AI agent by overriding the `preprompts` folder with your own version of the `preprompts` using the `--use-custom-preprompts` argument.

Editing the `preprompts` is how you make the agent remember things between projects.

### Vision

By default, gpt-engineer expects text input via a `prompt` file. It can also accept image inputs for vision-capable models. This can be useful for adding UX or architecture diagrams as additional context for GPT Engineer. You can do this by specifying an image directory with the `—-image_directory` flag and setting a vision-capable model in the second CLI argument.
By default, gpt-engineer expects text input via a `prompt` file. It can also accept image inputs for vision-capable models. This can be useful for adding UX or architecture diagrams as additional context for gpt-engineer. You can do this by specifying an image directory with the `—-image_directory` flag and setting a vision-capable model in the second CLI argument.

E.g. `gpte projects/example-vision gpt-4-vision-preview --prompt_file prompt/text --image_directory prompt/images -i`

### Open source, local and alternative models

By default, gpt-engineer supports OpenAI Models via the OpenAI API or Azure OpenAI API, as well as Anthropic models.
By default, gpt-engineer supports OpenAI Models via the OpenAI API or Azure OpenAI API, and Anthropic models.

With a little extra setup, you can also run with open source models like WizardCoder. See the [documentation](https://gpt-engineer.readthedocs.io/en/latest/open_models.html) for example instructions.
With a little extra set up you can also run with open source models, like WizardCoder. See the [documentation](https://gpt-engineer.readthedocs.io/en/latest/open_models.html) for example instructions.

## Mission

Expand All @@ -101,7 +102,7 @@ If you are interested in contributing to this, we are interested in having you.

If you want to see our broader ambitions, check out the [roadmap](https://github.com/gpt-engineer-org/gpt-engineer/blob/main/ROADMAP.md), and join
[discord](https://discord.gg/8tcDQ89Ej2)
to learn how you can [contribute](.github/CONTRIBUTING.md) to it.
to get input on how you can [contribute](.github/CONTRIBUTING.md) to it.

gpt-engineer is [governed](https://github.com/gpt-engineer-org/gpt-engineer/blob/main/GOVERNANCE.md) by a board of long-term contributors. If you contribute routinely and have an interest in shaping the future of gpt-engineer, you will be considered for the board.

Expand Down
47 changes: 47 additions & 0 deletions gpt_engineer/applications/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,42 @@ def prompt_yesno() -> bool:

def get_system_info():
system_info = {
"gpt_engineer_version": get_gpt_engineer_version(),
"os": platform.system(),
"os_version": platform.version(),
"architecture": platform.machine(),
"python_version": sys.version,
"packages": format_installed_packages(get_installed_packages()),
"env_variables": format_env_variables(get_env_variables()),
}
return system_info


def get_gpt_engineer_version():
try:
version = subprocess.run(
[sys.executable, "-m", "pip", "show", "gpt-engineer"],
capture_output=True,
text=True,
).stdout
for line in version.splitlines():
if line.startswith("Version:"):
return f"pip version: {line.split(' ')[1]}"
except Exception as e:
return str(e)

try:
version = subprocess.run(
["git", "describe", "--tags"],
capture_output=True,
text=True,
cwd=Path(__file__).resolve().parent,
).stdout.strip()
return f"repo version: {version}"
except Exception as e:
return f"repo version: unknown ({e})"


def get_installed_packages():
try:
result = subprocess.run(
Expand All @@ -268,6 +295,26 @@ def format_installed_packages(packages):
return "\n".join([f"{name}: {version}" for name, version in packages.items()])


def get_env_variables():
env_vars = {}
for key, value in os.environ.items():
if "KEY" in key or "SECRET" in key or "PASSWORD" in key:
env_vars[key] = "*****"
else:
env_vars[key] = value
return env_vars


def format_env_variables(env_vars):
formatted_vars = []
for key, value in env_vars.items():
if "KEY" in key or "SECRET" in key or "PASSWORD" in key:
formatted_vars.append(f"{key}: *****")
else:
formatted_vars.append(f"{key}: {value}")
return "\n".join(formatted_vars)


@app.command(
help="""
GPT-engineer lets you:
Expand Down