2023-06-23 19:09:31 +00:00
|
|
|
# GPT4All Command-Line Interface (CLI)
|
|
|
|
|
|
|
|
GPT4All on the command-line.
|
|
|
|
|
2024-08-04 23:44:01 +00:00
|
|
|
More details on the [wiki](https://github.com/nomic-ai/gpt4all/wiki/Python-CLI).
|
2023-06-23 19:09:31 +00:00
|
|
|
|
|
|
|
## Quickstart
|
|
|
|
|
|
|
|
The CLI is based on the `gpt4all` Python bindings and the `typer` package.
|
|
|
|
|
|
|
|
The following shows one way to get started with the CLI, the documentation has more information.
|
|
|
|
Typically, you will want to replace `python` with `python3` on _Unix-like_ systems and `py -3` on
|
|
|
|
_Windows_. Also, it's assumed you have all the necessary Python components already installed.
|
|
|
|
|
|
|
|
The CLI is a self-contained Python script named [app.py] ([download][app.py-download]). As long as
|
|
|
|
its package dependencies are present, you can download and run it from wherever you like.
|
|
|
|
|
|
|
|
[app.py]: https://github.com/nomic-ai/gpt4all/blob/main/gpt4all-bindings/cli/app.py
|
|
|
|
[app.py-download]: https://raw.githubusercontent.com/nomic-ai/gpt4all/main/gpt4all-bindings/cli/app.py
|
|
|
|
|
|
|
|
```shell
|
|
|
|
# optional but recommended: create and use a virtual environment
|
|
|
|
python -m venv gpt4all-cli
|
|
|
|
```
|
|
|
|
_Windows_ and _Unix-like_ systems differ slightly in how you activate a _virtual environment_:
|
|
|
|
- _Unix-like_, typically: `. gpt4all-cli/bin/activate`
|
|
|
|
- _Windows_: `gpt4all-cli\Scripts\activate`
|
|
|
|
|
|
|
|
Then:
|
|
|
|
```shell
|
|
|
|
# pip-install the necessary packages; omit '--user' if using a virtual environment
|
|
|
|
python -m pip install --user --upgrade gpt4all typer
|
|
|
|
# run the CLI
|
|
|
|
python app.py repl
|
|
|
|
```
|
2024-08-04 23:44:01 +00:00
|
|
|
By default, it will automatically download the `Mistral Instruct` model to `.cache/gpt4all/` in your
|
|
|
|
user directory, if necessary.
|
2023-06-23 19:09:31 +00:00
|
|
|
|
|
|
|
If you have already saved a model beforehand, specify its path with the `-m`/`--model` argument,
|
|
|
|
for example:
|
|
|
|
```shell
|
2024-08-04 23:44:01 +00:00
|
|
|
python app.py repl --model /home/user/my-gpt4all-models/mistral-7b-instruct-v0.1.Q4_0.gguf
|
2023-06-23 19:09:31 +00:00
|
|
|
```
|