Skip to content

Commit

Permalink
[GoEx] Undo Minor Bug Fix + README Minor Improvement (#468)
Browse files Browse the repository at this point in the history
- Fixes a bug where undoing a database call would not actually go
through occasionally
- Added additional steps in the README to streamline onboarding
- Finished all platform instructions for mkcert install
- Fixes issue with Docker build failing for newer Ubuntu images upon pip
installing without a venv

---------

Co-authored-by: Shishir Patil <30296397+ShishirPatil@users.noreply.github.com>
  • Loading branch information
royh02 and ShishirPatil authored Jul 3, 2024
1 parent d381fe8 commit 5c1a5e9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 19 deletions.
39 changes: 20 additions & 19 deletions goex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,19 @@ pip install -e .

**3.)** Install and initialize Mkcert to support OAuth2 token exchange [required for services that require https for redirect URL e.g Slack]

Mac:
**Mac**

```sh
brew install mkcert
mkcert -install
mkcert localhost
```

Windows:
**Linux**

Refer to the official [**Mkcert Linux Installation Instructions**](https://github.com/FiloSottile/mkcert?tab=readme-ov-file#linux)

**Windows**

```sh
choco install mkcert
Expand All @@ -57,6 +61,8 @@ Mkcert creates a local certificate authority, enabling Gorilla to establish secu

**4.)** Install [**Docker**](https://docs.docker.com/engine/install/). Docker is necessary for Goex to execute LLM-generated code in a sandboxed environment. Executions via the CLI will not be successful without Docker running locally.

- At this point you should have Docker running in the background

## CLI Usage

List all commands Gorilla currently supports and their usage:
Expand All @@ -65,6 +71,12 @@ List all commands Gorilla currently supports and their usage:
goex -h
```

Make sure to export your OpenAI API key as an environment variable.

```sh
export OPENAI_API_KEY=your_key
```

### RESTful API

Give authorizations and perform OAuth2 token exchanges with services Gorilla currently support.
Expand Down Expand Up @@ -156,17 +168,18 @@ goex execute -prompt "In the users table, add 500 to everyone's current balance"
brew install mysql
```

- If you don't have your own server, import the example database using `demo/mysql_setup.py` by running:
```sh
cd demo
python3 mysql_setup.py testdb
```
- Put the user, password, host, and database name info into `.env` by running this script

```
python3 demo/env_setup.py
```

- If you don't have your own server, import the example database using `demo/mysql_setup.py` by running:

```sh
python3 demo/mysql_setup.py testdb
```

- Set GoEx to use MySQL for DB operations
```
goex -set_config dbtype mysql
Expand Down Expand Up @@ -204,18 +217,6 @@ You can tell Gorilla-Ex to write code for you, and directly have it be written o
goex execute -prompt "Write a Python program that is a calculator into a file called calculator.py" -type fs
```
##### Log Compilation
```
goex execute -prompt "Create 5 log files named according to some fake dates and insert some placeholder log content into them" -type fs
```
Here you will have 5 log files with some placeholder content. You can execute the command below to compile the log file contents into a single CSV for easy analysis.
```
goex execute -prompt "Compile the log file contents into a single CSV with the date as the identifying column here." -type fs
```
## Credentials & Authorization Token
There are two types of credentials the user can add to the execution engine.
Expand Down
1 change: 1 addition & 0 deletions goex/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ def db_callback(prompt, generate_mode):
print("Execution completed!")
else:
engine.exec_api_call(neg_api_call, api_type=SQL_Type)
engine.commit_api_call(SQL_Type)
print("Execution undone.")


Expand Down
2 changes: 2 additions & 0 deletions goex/docker/docker/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM ubuntu:latest

ENV DEBIAN_FRONTEND=noninteractive

ENV PIP_BREAK_SYSTEM_PACKAGES=1

RUN apt-get update \
&& apt-get install -y python3-pip python3-dev \
&& cd /usr/local/bin \
Expand Down
2 changes: 2 additions & 0 deletions goex/docker/mysql_docker/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM ubuntu:latest

ENV DEBIAN_FRONTEND=noninteractive

ENV PIP_BREAK_SYSTEM_PACKAGES=1

RUN apt-get update \
&& apt-get install -y python3-pip python3-dev \
&& cd /usr/local/bin \
Expand Down
2 changes: 2 additions & 0 deletions goex/docker/sqllite_docker/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM ubuntu:latest

ENV DEBIAN_FRONTEND=noninteractive

ENV PIP_BREAK_SYSTEM_PACKAGES=1

RUN apt-get update \
&& apt-get install -y python3-pip python3-dev \
&& cd /usr/local/bin \
Expand Down

0 comments on commit 5c1a5e9

Please sign in to comment.