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

Lite mode - run without pre prompts for execution #733

Merged
merged 6 commits into from
Sep 22, 2023

Conversation

lukaspetersson
Copy link
Contributor

@lukaspetersson lukaspetersson commented Sep 22, 2023

Trying to adress parts of #708

The -l CLI flag runs gpt-engineer in lite mode.
It only includes the main prompt and the fileformat.
The idea is that it should be like normal chatGPT but without copy-paste work.

I ran a few tests, unsurprisingly it is faster and cheaper.
I also experience that the output is better.

Examples:

gpt-engineer txtfile -l
hello_world.txt
\```
Hello world
\```Total api cost: $  0.00438
gpt-engineer db_analytics -l 
Here is the Python script that fetches data from a Redis database and prints it in a table format using the prettytable library. 

Please note that the Python script uses the requests library to fetch data from the database, as the fetch API is not available in Python. 

Also, the Python script assumes that the Redis database returns JSON data. 

main.py
\```python
import requests
import json
from prettytable import PrettyTable

def fetch_data_from_redis():
    url = "https://big-stag-42761.kv.vercel-storage.com/set/user_1_session/session_token_value"
    headers = {
        "Authorization": "Bearer ****"
    }
    response = requests.get(url, headers=headers)
    data = response.json()
    return data

def get_user_ids(data):
    user_ids = []
    for key in data.keys():
        user_id = key.split("_")[0]
        if user_id not in user_ids:
            user_ids.append(user_id)
    return user_ids

def get_user_info(data, user_ids):
    user_info = {}
    for user_id in user_ids:
        user_info[user_id] = {
            "name": data.get(f"{user_id}_name"),
            "last_login": data.get(f"{user_id}_last_login"),
            "email": data.get(f"{user_id}_email"),
            "chats_count": data.get(f"{user_id}_chats_count"),
        }
    return user_info

def print_table(user_info):
    table = PrettyTable()
    table.field_names = ["User ID", "Name", "Last Login", "Email", "Chats Count"]
    for user_id, info in user_info.items():
        table.add_row([user_id, info["name"], info["last_login"], info["email"], info["chats_count"]])
    print(table)

def main():
    data = fetch_data_from_redis()
    user_ids = get_user_ids(data)
    user_info = get_user_info(data, user_ids)
    print_table(user_info)

if __name__ == "__main__":
    main()
\```

@lukaspetersson lukaspetersson marked this pull request as ready for review September 22, 2023 18:38
@AntonOsika
Copy link
Collaborator

Looks good, merging!

Let's encourage people to use it and consider making it the default

@AntonOsika AntonOsika merged commit 830b5c9 into gpt-engineer-org:main Sep 22, 2023
4 checks passed
70ziko pushed a commit to 70ziko/gpt-engineer that referenced this pull request Oct 25, 2023
* cli flag

* lite mode step config

* precommits

* docs

* pre-commits

* rename function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants