Skip to content

Commit 1e03ffc

Browse files
committed
Improve prompt ...
Add dev instructions to CONTRIBUTING, add default lib install instruction to README
1 parent ea4ea6f commit 1e03ffc

File tree

4 files changed

+68
-4
lines changed

4 files changed

+68
-4
lines changed

.github/CONTRIBUTING.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,44 @@ First of all, thank you for your interest in contributing to gpt-code-ui! We app
1515
- [Commit Messages](#commit-messages)
1616
- [Additional Resources](#additional-resources)
1717

18-
## Code of Conductcode
18+
## Code of Conduct
1919

2020
All contributors are expected to adhere to our [Code of Conduct](CODE_OF_CONDUCT.md). Please read it before participating in the gpt-code-ui community.
2121

2222
## Getting Started
2323

2424
1. Fork the repository and clone it to your local machine.
25-
2. Set up the development environment by following the instructions in the [README.md](https://github.com/ricklamers/gpt-code-ui/tree/main/README.md) file.
25+
2. Set up the development environment as follows:
26+
27+
To install the package as an editable Python package run:
28+
```sh
29+
pip install -e .
30+
```
31+
32+
To run the backend:
33+
```sh
34+
gptcode
35+
```
36+
37+
To run the frontend in dev mode such that frontend code changes automatically update, set
38+
the following environment variable such that the frontend knows where to
39+
find the backend API server.
40+
41+
`export VITE_WEB_ADDRESS=http://localhost:8080`
42+
43+
Run the frontend in development mode (served by Vite):
44+
```sh
45+
cd frontend
46+
npm run dev
47+
```
48+
49+
The HMR/auto reloading version of the frontend can now be found at http://localhost:5173 (default Vite port)
50+
51+
Note, the frontend served at `http://localhost:8080` is stale comes from the static bundled files that can
52+
be generated by running `make compile_frontend`.
53+
54+
With this setup, code changes to the Flask backend still require restarting `gptcode` (backend).
55+
2656
3. Explore the codebase, run tests, and verify that everything works as expected.
2757

2858
## How to Contribute

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ pip install gpt-code-ui
1515
gptcode
1616
```
1717

18+
In order to make basic dependencies available it's recommended to run the following `pip` install
19+
in the Python environment that is used in the shell where you run `gptcode`:
20+
21+
```sh
22+
pip install "numpy>=1.24,<1.25" "dateparser>=1.1,<1.2" "pandas>=1.5,<1.6" "geopandas>=0.13,<0.14" "PyPDF2>=3.0,<3.1" "pdfminer>=20191125,<20191200" "pdfplumber>=0.9,<0.10" "matplotlib>=3.7,<3.8"
23+
```
24+
1825
## User interface
1926
<img src="https://github.com/ricklamers/gpt-code-ui/assets/1309307/c29c504a-a7ed-4ae0-9360-d7224bc3e3d6" alt="GPT-Code logo" width="100%" />
2027

gpt_code_ui/webapp/main.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,34 @@ def allowed_file(filename):
5858

5959
async def get_code(user_prompt, user_openai_key=None, model="gpt-3.5-turbo"):
6060

61-
prompt = f"First, here is a history of what I asked you to do earlier. The actual prompt follows after ENDOFHISTORY. History:\n\n{message_buffer.get_string()}ENDOFHISTORY.\n\nWrite Python code that does the following: \n\n{user_prompt}\n\nNote, the code is going to be executed in a Jupyter Python kernel.\n\nLast instruction, and this is the most important, just return code. No other outputs, as your full response will directly be executed in the kernel. \n\nTeacher mode: if you want to give a download link, just print it as <a href='/download?file=INSERT_FILENAME_HERE'>Download file</a>. Replace INSERT_FILENAME_HERE with the actual filename. So just print that HTML to stdout. No actual downloading of files!"
61+
prompt = f"""First, here is a history of what I asked you to do earlier.
62+
The actual prompt follows after ENDOFHISTORY.
63+
History:
64+
{message_buffer.get_string()}
65+
ENDOFHISTORY.
66+
Write Python code, in a triple backtick Markdown code block, that does the following:
67+
{user_prompt}
68+
69+
Notes:
70+
First, think step by step what you want to do and write it down in English.
71+
Then generate valid Python code in a code block
72+
Make sure all code is valid - it be run in a Jupyter Python 3 kernel environment.
73+
Define every variable before you use it.
74+
For data munging, you can use
75+
'numpy', # numpy==1.24.3
76+
'dateparser' #dateparser==1.1.8
77+
'pandas', # matplotlib==1.5.3
78+
'geopandas' # geopandas==0.13.2
79+
For pdf extraction, you can use
80+
'PyPDF2', # PyPDF2==3.0.1
81+
'pdfminer', # pdfminer==20191125
82+
'pdfplumber', # pdfplumber==0.9.0
83+
For data visualization, you can use
84+
'matplotlib', # matplotlib==3.7.1
85+
Be sure to generate charts with matplotlib. If you need geographical charts, use geopandas with the geopandas.datasets module.
86+
If the user has just uploaded a file, focus on the file that was most recently uploaded (and optionally all previously uploaded files)
87+
88+
Teacher mode: if the code modifies or produces a file, end your output AFTER YOUR CODE BLOCK with a link to it as <a href='/download?file=INSERT_FILENAME_HERE'>Download file</a>. Replace INSERT_FILENAME_HERE with the actual filename. So just print that HTML to stdout at the end, AFTER your code block."""
6289
temperature = 0.7
6390
message_array = [
6491
{

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setup(
99
name='gpt_code_ui',
10-
version='0.42.30',
10+
version='0.42.31',
1111
description="An Open Source version of ChatGPT Code Interpreter",
1212
long_description=long_description,
1313
long_description_content_type='text/markdown', # This field specifies the format of the `long_description`.

0 commit comments

Comments
 (0)