gpt4all/gpt4all-bindings/cli
cosmic-snow affd0af51f
Fix CLI to work with 1.x.y version of the Python bindings (#1120)
* Fix CLI to work with 1.x.y version of the Python bindings (tentative)
- Adapted to bindings API changes
- Version selection based on package information
- Does not currently work with 1.x.y however, as it's not fully implemented:
  "NotImplementedError: Streaming tokens in a chat session is not currently supported."

* Adapt to the completed streaming API with session support

* Bump CLI version to 1.0.2
2023-07-05 22:42:15 -04:00
..
app.py Fix CLI to work with 1.x.y version of the Python bindings (#1120) 2023-07-05 22:42:15 -04:00
developer_notes.md CLI Improvements (#1021) 2023-06-23 12:09:31 -07:00
README.md CLI Improvements (#1021) 2023-06-23 12:09:31 -07:00

GPT4All Command-Line Interface (CLI)

GPT4All on the command-line.

Documentation

https://docs.gpt4all.io/gpt4all_cli.html

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). As long as its package dependencies are present, you can download and run it from wherever you like.

# 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:

# 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

By default, it will automatically download the groovy model to .cache/gpt4all/ in your user directory, if necessary.

If you have already saved a model beforehand, specify its path with the -m/--model argument, for example:

python app.py repl --model /home/user/my-gpt4all-models/GPT4All-13B-snoozy.ggmlv3.q4_0.bin