Skip to main content

Command-line interface using GPT4ALL bindings

Project description

A simple GNU Readline-based application for interaction with chat-oriented AI models using GPT4All Python bindings.

Contents

Install

The following installation options are available:

Pip

$ pip install git+https://github.com/sergei-mironov/gpt4all-cli.git

Note: pip install gpt4all-cli might also work, but the git+https method would bring the most recent version.

Nix

$ git clone --depth=1 https://github.com/sergei-mironov/gpt4all-cli && cd gpt4all-cli
# Optionally, change the 'nixpkgs' input of the flake.nix to a more suitable
$ nix profile install ".#python-gpt4all-cli"

Usage

usage: gpt4all-cli [-h] [--model-dir MODEL_DIR] [--model MODEL]
                   [--num-threads NUM_THREADS] [--device DEVICE]
                   [--readline-key-send READLINE_KEY_SEND]
                   [--readline-prompt READLINE_PROMPT] [--revision]

Command-line arguments

options:
  -h, --help            show this help message and exit
  --model-dir MODEL_DIR
                        Model directory to prepend to model file names
  --model MODEL, -m MODEL
                        Model to use for chatbot
  --num-threads NUM_THREADS, -t NUM_THREADS
                        Number of threads to use for chatbot
  --device DEVICE, -d DEVICE
                        Device to use for chatbot, e.g. gpu, amd, nvidia,
                        intel. Defaults to CPU.
  --readline-key-send READLINE_KEY_SEND
                        Terminal code to treat as Ctrl+Enter (default: \C-k)
  --readline-prompt READLINE_PROMPT
                        Input prompt (default: >>>)
  --revision            Print the revision

The console accepts language defined by the following grammar:

start: (command | escape | text)? (command | escape | text)*
escape.3: /\\./
command.2: /\/exit|\/ask|\/help|\/reset/ | \
           /\/model/ / +/ string | \
           /\/nthreads/ / +/ number | \
           /\/echo/ | /\/echo/ / /
string: /"[^\"]+"/ | /""/
number: /[1-9][0-9]*/
text: /(.(?!\/|\\))*./s

Example session

$ gpt4all-cli
Type /help or a question followed by the /ask command (or by pressing `C-k` key).
>>> /model "~/.local/share/nomic.ai/GPT4All/Meta-Llama-3-8B-Instruct.Q4_0.gguf"
>>> Hi!
>>> /ask
Hello! I'm happy to help you. What's on your mind?^C
>>> What's your name?
>>> /ask
I don't really have a personal name, but you can call me "Assistant"

Vim integration

Gpt4all-cli is supported by the Litrepl text processor.

Peek 2024-07-19 00-11

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpt4all_cli-1.1.3.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

gpt4all_cli-1.1.3-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file gpt4all_cli-1.1.3.tar.gz.

File metadata

  • Download URL: gpt4all_cli-1.1.3.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for gpt4all_cli-1.1.3.tar.gz
Algorithm Hash digest
SHA256 0703c00a587de55b3a01bc6f803a38592e694bc038bf75df2c57b3ce7bfa528e
MD5 13a55d2da11bd27d24c75574705286bb
BLAKE2b-256 8e0b04e198baebdc9d412cce87e666eafc4780c1b4c853bfad81e58c62145ddf

See more details on using hashes here.

File details

Details for the file gpt4all_cli-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: gpt4all_cli-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for gpt4all_cli-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ad7bcb02d49f47566db8067f80ab5c73c7f610513900764146a00499a1591ca6
MD5 c334f6b568337c8b7548beec105e4d95
BLAKE2b-256 d8d7d1791ca77cc9257dca4634b6f65ed6e530382b56bda6c2901dc3a2e2a18b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page