## Demo
## Installation
### Cargo
```bash
cargo install pgpt
pgpt --help
```
### Source
```bash
git clone https://github.com/ammar-ahmed22/pgpt.git
cd pgpt
cargo install --path .
```
## Usage
When using for the first time, pgpt will prompt you to enter an [OpenAI API key](https://platform.openai.com/api-keys).
The key is saved/encrypted in a local config file to be used later.
Alternatively, you can pass your API key to the environment variable `OPENAI_API_KEY` in order to not save it.
### Configuration (`config set`)
#### `model`
Set the default model to use when asking questions.
```bash
pgpt config set model
```
Currently supported options are `gpt-3`, `gpt-4`, and `gpt-4o`
#### `cache-length`
Sets the number (`positive integer`) of prompt/response pairs to save in cache. Think of this as your chat history.
Defaults to 5.
```bash
pgpt config set cache-length
```
#### `context`
Sets the number (`positive integer`) of previous prompt/response pairs to send with a query. If value is greater than `cache-length`, all saved values will be sent.
Defaults to 0.
```bash
pgpt config set context
```
#### `api-key`
Sets the OpenAI API key.
```bash
pgpt config set api-key
```
To display the configuration values for any of the above options use:
```bash
pgpt config show