Skip to main content

A Language Model Enhanced Command Line Interface

Project description

LLM-Shell: Language Model Enhanced Command Line Interface

Overview

LLM-Shell is a command-line interface (CLI) tool that enhances your shell experience with the power of large language models (LLMs) such as GPT-4 and GPT-3.5 Turbo. It acts as a wrapper around your standard shell, allowing you to execute regular shell commands while also providing the capability to consult an LLM for programming assistance, code examples, and executing commands with natural language understanding.

Features

  • Execute standard shell commands with real-time output.
  • Use language models to process commands described in natural language.
  • Syntax highlighting for code blocks returned by the language model.
  • Set one or multiple context/summary files to provide additional information to the LLM.
  • Change the underlying LLM backend (e.g., GPT-4 Turbo, GPT-4, GPT-3.5 Turbo).
  • Set or update the instruction for the LLM to change how it assists you.
  • Autocompletion for custom commands and file paths.
  • History tracking of commands and LLM responses.

Prerequisites

  • Python 3
  • requests library for making HTTP requests to the LLM API.
  • pygments library for syntax highlighting.
  • An API key from OpenAI for accessing their language models.

Installation

There are two ways to install LLM-Shell:

Using pip (Recommended)

  1. Ensure you have Python 3 installed on your system.
  2. Install the llm-shell package from PyPI:
    pip install llm-shell
    
  3. Set your OpenAI API key as an environment variable CHATGPT_API_KEY or within a .env file that the script can read.

Using Git Clone (For Developers)

  1. Clone the repository to your local machine.
  2. Navigate to the cloned directory.
  3. Install the required Python packages:
    pip install -r requirements.txt
    
  4. Make sure the script is executable:
    chmod +x llm-shell.py
    

Usage

If Installed Through pip

To start the LLM-Shell, run the following command:

llm-shell

If Installed By Git Cloning the Repository

To start the LLM-Shell, navigate to the bin directory and run the llm_shell script:

./bin/llm_shell

Executing Commands

  • Standard shell commands are executed as normal, e.g., ls -la.
  • To use the LLM, prefix your command with a hash #, followed by the natural language instruction, e.g., # How do I list all files in the current directory?.

Special Commands

  • help - Displays a list of available custom commands within the LLM-Shell.
  • llm-backend [backend] - Changes the LLM backend. Replace [backend] with one of the supported backends (e.g., gpt-4-turbo, gpt-4, gpt-3.5-turbo, claude-instant-v1, claude-v2.1).
  • llm-instruction [instruction] - Sets or updates the instruction for the LLM. Use this command to change how the LLM assists you.
  • llm-reindent-with-tabs [true/false] - Controls auto-reindent with tabs, to help when the LLM doesn't auto-detect it properly.
  • llm-chatgpt-apikey [apikey] - Set API key for OpenAI's models.
  • context [filename1] [filename2] ... - Sets one or multiple context files that will be used to provide additional information to the LLM. Use context none to clear the context files.
  • summary [filename1] [filename2] ... - Sets one or multiple summary files. Similar to context, but it will summarize the file before sending it to the LLM. Useful if you just want to send an outline of a class instead of the entire code.
  • exit - Exits LLM-Shell.

Autocompletion

  • The LLM-Shell supports autocompletion for file paths and custom commands. Press Tab to autocomplete the current input.

Customization

Modify the llm-shell.py script to add new features or change existing behavior to better suit your needs.

License

LLM-Shell is released under the MIT License. See the LICENSE file for more information.

Disclaimer

LLM-Shell is not an official product and is not affiliated with OpenAI. It's just an open-source tool developed to showcase the integration of LLMs into a command-line environment. Use it at your own risk.

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

llm_shell-0.4.2.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

llm_shell-0.4.2-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file llm_shell-0.4.2.tar.gz.

File metadata

  • Download URL: llm_shell-0.4.2.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for llm_shell-0.4.2.tar.gz
Algorithm Hash digest
SHA256 90b0b1bbdbdfd56a8ce7dc839db2b01becb33143b7ee812ccd005cbb26565fa9
MD5 44980b54f343cb9c30b65198d1e151ca
BLAKE2b-256 b61efdb802d556303c80726c05d4c9cbe21f7f5dc09062e5209be8fd82664ddd

See more details on using hashes here.

Provenance

File details

Details for the file llm_shell-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: llm_shell-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for llm_shell-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 70f16d14be883d76be8ca1cee5a1550d211cbdf11fdb3297f4d7699fc904adc2
MD5 32dc5b0a6322223954bfe98a44d03dde
BLAKE2b-256 fe3425c7d2342a23f471fc2ef4f35514d00d656a8fc6c8a3ba1456b69705599b

See more details on using hashes here.

Provenance

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