shgpt


Nameshgpt JSON
Version 0.5.1 PyPI version JSON
download
home_pageNone
SummaryChat with LLM in your terminal, be it shell generator, story teller, linux-terminal, etc.
upload_time2024-06-18 00:54:21
maintainerNone
docs_urlNone
authorNone
requires_python>=3.0.0
licenseNone
keywords ai gpt llm shell
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ShellGPT

[![](https://img.shields.io/pypi/v/shgpt)](https://pypi.org/project/shgpt/)
[![](https://github.com/jiacai2050/shellgpt/actions/workflows/ci.yml/badge.svg)](https://github.com/jiacai2050/shellgpt/actions/workflows/ci.yml)
[![](https://github.com/jiacai2050/shellgpt/actions/workflows/release.yml/badge.svg)](https://github.com/jiacai2050/shellgpt/actions/workflows/release.yml)

Chat with LLM in your terminal, be it shell generator, story teller, linux-terminal, etc.

# Install
```bash
pip install -U shgpt
```

Or install latest version
```bash
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 like `echo question | sg`.
- REPL mode, `sg -r`, chat with LLM.
- TUI mode, `sg -t`, tailored for infer shell command.

## Model

By default, `shellgpt` uses [Ollama](https://ollama.com/) as its language model backend, requiring installation prior to usage.

Alternatively, one can set up `shellgpt` to utilize [OpenAI compatible](https://developers.cloudflare.com/workers-ai/configuration/open-ai-compatibility/) API endpoints:

```bash
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](https://github.com/jiacai2050/shellgpt/blob/main/shellgpt/utils/conf.py) for more configs.

## TUI

There are 3 key bindings to use in TUI:
- `ctrl+j`, Infer answer
- `ctrl+r`, Run command
- `ctrl+y`, Yank command

![TUI screenshot](https://github.com/jiacai2050/shellgpt/raw/main/assets/shellgpt-tui.jpg)

## System contents

There are some built-in [system contents](https://platform.openai.com/docs/guides/text-generation/chat-completions-api) in shellgpt:
- `default`, used for ask general questions
- `typo`, used for correct article typos.
- `slug`, used for generate URL slug.
- `code`, used for ask programming questions
- `shell`, used for infer shell command
- `commit`, used for generate git commit message, like `git diff | sg -c 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](https://github.com/jiacai2050/shellgpt/blob/main/contents.json) to play with, it's generated from [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts/blob/main/prompts.csv).

```bash
$ sg -c linux-terminal pwd
/home/user

$ sg -c javascript-console 0.1 + 0.2
0.3

```

Users can share their customized contents in [discuss section](https://github.com/jiacai2050/shellgpt/discussions).

# License

[GPL-3.0](https://opensource.org/license/GPL-3.0)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "shgpt",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.0.0",
    "maintainer_email": null,
    "keywords": "ai, gpt, llm, shell",
    "author": null,
    "author_email": "Jiacai Liu <dev@liujiacai.net>",
    "download_url": "https://files.pythonhosted.org/packages/51/be/54806d3c62df570f4545bb1527f0ececf9c190c3163d615766b430a25f0c/shgpt-0.5.1.tar.gz",
    "platform": null,
    "description": "# ShellGPT\n\n[![](https://img.shields.io/pypi/v/shgpt)](https://pypi.org/project/shgpt/)\n[![](https://github.com/jiacai2050/shellgpt/actions/workflows/ci.yml/badge.svg)](https://github.com/jiacai2050/shellgpt/actions/workflows/ci.yml)\n[![](https://github.com/jiacai2050/shellgpt/actions/workflows/release.yml/badge.svg)](https://github.com/jiacai2050/shellgpt/actions/workflows/release.yml)\n\nChat with LLM in your terminal, be it shell generator, story teller, linux-terminal, etc.\n\n# Install\n```bash\npip install -U shgpt\n```\n\nOr install latest version\n```bash\npip install --force-reinstall -U git+https://github.com/jiacai2050/shellgpt.git\n```\n\nThis will install two commands: `sg` and `shellgpt`, which are identical.\n\nAfter install, use `sg --init` to create required directories(mainly `~/.shellgpt`).\n\n# Usage\n\nShellGPT has three modes to use:\n- Direct mode, `sg [question]` or pipeline like `echo question | sg`.\n- REPL mode, `sg -r`, chat with LLM.\n- TUI mode, `sg -t`, tailored for infer shell command.\n\n## Model\n\nBy default, `shellgpt` uses [Ollama](https://ollama.com/) as its language model backend, requiring installation prior to usage.\n\nAlternatively, one can set up `shellgpt` to utilize [OpenAI compatible](https://developers.cloudflare.com/workers-ai/configuration/open-ai-compatibility/) API endpoints:\n\n```bash\nexport SHELLGPT_API_URL=https://api.openai.com\nexport SHELLGPT_API_KEY=<token>\nexport SHELLGPT_MODEL='gpt-3.5-turbo'\n\n# or Cloudflare Worker AI\nexport SHELLGPT_API_URL=https://api.cloudflare.com/client/v4/accounts/<account-id>/ai\nexport SHELLGPT_API_KEY=<token>\nexport SHELLGPT_MODEL='@cf/meta/llama-3-8b-instruct'\n```\n\nSee [conf.py](https://github.com/jiacai2050/shellgpt/blob/main/shellgpt/utils/conf.py) for more configs.\n\n## TUI\n\nThere are 3 key bindings to use in TUI:\n- `ctrl+j`, Infer answer\n- `ctrl+r`, Run command\n- `ctrl+y`, Yank command\n\n![TUI screenshot](https://github.com/jiacai2050/shellgpt/raw/main/assets/shellgpt-tui.jpg)\n\n## System contents\n\nThere are some built-in [system contents](https://platform.openai.com/docs/guides/text-generation/chat-completions-api) in shellgpt:\n- `default`, used for ask general questions\n- `typo`, used for correct article typos.\n- `slug`, used for generate URL slug.\n- `code`, used for ask programming questions\n- `shell`, used for infer shell command\n- `commit`, used for generate git commit message, like `git diff | sg -c commit`\n\nUsers can define their own content in `~/.shellgpt/contents.json`, it a JSON map with\n- key being content name and\n- value being content body\n\nOr you can just copy [contents.json](https://github.com/jiacai2050/shellgpt/blob/main/contents.json) to play with, it's generated from [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts/blob/main/prompts.csv).\n\n```bash\n$ sg -c linux-terminal pwd\n/home/user\n\n$ sg -c javascript-console 0.1 + 0.2\n0.3\n\n```\n\nUsers can share their customized contents in [discuss section](https://github.com/jiacai2050/shellgpt/discussions).\n\n# License\n\n[GPL-3.0](https://opensource.org/license/GPL-3.0)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Chat with LLM in your terminal, be it shell generator, story teller, linux-terminal, etc.",
    "version": "0.5.1",
    "project_urls": {
        "Issues": "https://github.com/jiacai2050/shellgpt/issues",
        "Repository": "https://github.com/jiacai2050/shellgpt"
    },
    "split_keywords": [
        "ai",
        " gpt",
        " llm",
        " shell"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ba4b58dbadee24f5e5c244b8e8192623ad7f6ac7eb9c2ed27ff7c67c3b9a27a2",
                "md5": "c69fafaf6b4f47ecf4e76ce10d6ce9f3",
                "sha256": "e15672d2c7e2057fbc61ee384cfabf776f0b73e3c27fb0ea11026c72eaa54343"
            },
            "downloads": -1,
            "filename": "shgpt-0.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c69fafaf6b4f47ecf4e76ce10d6ce9f3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.0.0",
            "size": 12275,
            "upload_time": "2024-06-18T00:54:17",
            "upload_time_iso_8601": "2024-06-18T00:54:17.818456Z",
            "url": "https://files.pythonhosted.org/packages/ba/4b/58dbadee24f5e5c244b8e8192623ad7f6ac7eb9c2ed27ff7c67c3b9a27a2/shgpt-0.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "51be54806d3c62df570f4545bb1527f0ececf9c190c3163d615766b430a25f0c",
                "md5": "fb4719e3f07e4dcb5a1cdbfad5eae3a4",
                "sha256": "0524c743577764e30b99d893f540afc4f5f876df1aa87dad4511f1245f10b66a"
            },
            "downloads": -1,
            "filename": "shgpt-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "fb4719e3f07e4dcb5a1cdbfad5eae3a4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.0.0",
            "size": 10282,
            "upload_time": "2024-06-18T00:54:21",
            "upload_time_iso_8601": "2024-06-18T00:54:21.309369Z",
            "url": "https://files.pythonhosted.org/packages/51/be/54806d3c62df570f4545bb1527f0ececf9c190c3163d615766b430a25f0c/shgpt-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-18 00:54:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jiacai2050",
    "github_project": "shellgpt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "shgpt"
}
        
Elapsed time: 0.41632s