Skip to main content

Creates shell command from a description using an LLM

Project description

nlshell

A very small Python package that generates shell commands from a "natural language" description. It will provide a explanation of the command and prefill the command line with the generated command.

Useses an LLM model to generate the shell commands.

IMPORTANT! Never run a generated command without understanding what it does. The generated command may be harmful. There is no guarantee whatsoever that what the LLM suggests is correct! DON'T BLINDLY TRUST THE GENERATED SUGGESTION!

Table of Contents

Installation

Instructions on how to install your package. Include both the pip and poetry methods.

# Using pip
pip install nlshell

# Using poetry
poetry add nlshell

Usage

Activate the virtual environment where the package is installed to use the nlshell command.

Set the base_url

The package uses the openai client to call an LLM. By specifying a base-url you can use your own model, e.g. a local model.

c --base-url http://localhost:11434/v1

If no base_url is explicitly set, the package will ask which url to use.

Create a command

c list all files in the current directory, including hidden files

where c is the nlshell command. This command will generate a response like this:

The 'ls' command lists directory contents. The option '-l' provides a long listing format which includes file permissions, number of links, owner, group, size, and time of last modification. The '-a' option ensures hidden files (those starting with a dot .) are also listed.
$ ls -la

Set the api_key

c --api-key your-api-key

Even if you run a local model you need to set an api_key since the openai client requires it, even if the key is just a dummy key.

Set the model

c --model-name qwen2.5-coder:7b

If no model is specified the package will ask which model to use.

License

Distributed under the MIT License. See LICENSE for more information.

GitHub

https://github.com/mbrycke/nlshell

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

nlshell-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nlshell-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file nlshell-0.1.0.tar.gz.

File metadata

  • Download URL: nlshell-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure

File hashes

Hashes for nlshell-0.1.0.tar.gz
Algorithm Hash digest
SHA256 117cf3440dedc31cc4efdef7ca4fef3adf639f9f208294f45d87955ff75fc9ff
MD5 bd874d1970d9cd1475a6e515a61d0129
BLAKE2b-256 043f8d103789ba0ad95e3500aa26b3b0224e1e0ea816eca5d0748f1453477851

See more details on using hashes here.

File details

Details for the file nlshell-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nlshell-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure

File hashes

Hashes for nlshell-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c05929572f7e85c2339fa53dac65e411245343447b9a6bb0c3e025c210dfab8
MD5 72874758d6ebf8735cd252cce8947673
BLAKE2b-256 0999c4c1dcbce2b0269b4a072a901e2b6df936df869ec5d1f9c34702d892bc3c

See more details on using hashes here.

Supported by

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