Chat with LLM in your terminal, be it shell generator, story teller, linux-terminal, etc.
Project description
ShellGPT
Chat with LLM in your terminal, be it shell generator, story teller, linux-terminal, etc.
Install
pip install -U shgpt
Or install latest version
pip install --force-reinstall -U git+https://github.com/jiacai2050/shellgpt.git
This will install two commands: sg
and shellgpt
, which are identical.
After install, use sg --init
to create required directories(mainly ~/.shellgpt
).
Usage
ShellGPT has three modes to use:
- Direct mode,
sg [question]
or pipeline likeecho question | sg
. - REPL mode,
sg -r
, chat with LLM. - TUI mode,
sg -t
, tailored for infer shell command.
Model
By default, shellgpt
uses Ollama as its language model backend, requiring installation prior to usage.
Alternatively, one can set up shellgpt
to utilize OpenAI compatible API endpoints:
export SHELLGPT_API_URL=https://api.openai.com
export SHELLGPT_API_KEY=<token>
export SHELLGPT_MODEL='gpt-3.5-turbo'
# or Cloudflare Worker AI
export SHELLGPT_API_URL=https://api.cloudflare.com/client/v4/accounts/<account-id>/ai
export SHELLGPT_API_KEY=<token>
export SHELLGPT_MODEL='@cf/meta/llama-3-8b-instruct'
See conf.py for more configs.
TUI
There are 3 key bindings to use in TUI:
ctrl+j
, Infer answerctrl+r
, Run commandctrl+y
, Yank command
System contents
There are some built-in system contents in shellgpt:
default
, used for ask general questionstypo
, used for correct article typos.slug
, used for generate URL slug.code
, used for ask programming questionsshell
, used for infer shell commandcommit
, used for generate git commit message, likegit diff | sg -s commit
Users can define their own content in ~/.shellgpt/contents.json
, it a JSON map with
- key being content name and
- value being content body
Or you can just copy contents.json to play with, it's generated from Awesome ChatGPT Prompts.
$ sg -s linux-terminal pwd
/home/user
$ sg -s javascript-console 0.1 + 0.2
0.3
Users can share their customized contents in discussions.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file shgpt-0.5.3.tar.gz
.
File metadata
- Download URL: shgpt-0.5.3.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50bc13ceacd38dca8dc3f8513da062b4cc7b0a1ee99ea0cfce06ce5843209f1e |
|
MD5 | bf8f33732f88833c02339b15c775876f |
|
BLAKE2b-256 | dc182f2ac8009cd789f3f486575f9ff0e3ca08179844e29073b9d03be60e88c5 |
File details
Details for the file shgpt-0.5.3-py3-none-any.whl
.
File metadata
- Download URL: shgpt-0.5.3-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 869c72baa805baf75ac414db1752ee75ab35f7be6da18d6efc4ea106cdcea8ef |
|
MD5 | d5531bf02f28a45a27c8657096edbf5c |
|
BLAKE2b-256 | 614bfcccf0f59f94c846e9ec71e9694d9dbedd65a37f1ec1618b29096c04488b |