Skip to main content

A CLI tool for prompting an LLM

Project description

cli_lm

Switch context less by using a really cheap LLM at the command line.

Installation

# Install from source
git clone https://github.com/davenpi/cli_lm.git
cd cli_lm
pip install -e .

# Install from PyPI
pip install cli-lm

Quick Start

The first run will prompt for your Open AI API key. Just paste the key in. Or create the key directly in ~/.cli_lm/.env with

echo "OPENAI_API_KEY=your_new_key" > ~/.cli_lm/.env

Note you'll have to pay Open AI to get an API key and start using their models. For now this package sets gpt-4o-mini as the model of choice. It costs 0.15¢/0.60¢ per 1 million input/output tokens. 1 token ~ 1 word.

# Directly ask a question
clm "How do I amend a commit in git?"

# Interactive mode (input in python interpreter)
clm
> How do I list the processes listening on a given port?

Chat is assumed to be multiturn (i.e., you'll always be asked for your next prompt). Just hit Ctrl+c or Ctrl+d to exit.

Configuration

The package looks for your Open AI API key in ~/.cli_lm/.env.

To quickly update your API key run:

echo "OPENAI_API_KEY=your_new_key" > ~/.cli_lm/.env

It works on a Mac, but it hasn't been tested on another system.

Ongoing Improvements

  • Multi turn chat capability
  • Improved multiline input
  • Would be nice to arrow backward on input
  • System prompting for really concise, helpful answers
  • Make set up easier
  • Add token/cost accounting
  • Make it faster (imports can be slow)
  • Add color

License

MIT

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

cli_lm-0.1.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

cli_lm-0.1.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file cli_lm-0.1.3.tar.gz.

File metadata

  • Download URL: cli_lm-0.1.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for cli_lm-0.1.3.tar.gz
Algorithm Hash digest
SHA256 49618aed151289a7d17029dea26d337357371ecd48b0b89d564e2314a3bf1cc4
MD5 20e754a7e343158aa71aa3c72fd7050e
BLAKE2b-256 44f0506075dc4f8e322e66faef80df9891ce0f612de357722cb27767a47b87b0

See more details on using hashes here.

File details

Details for the file cli_lm-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: cli_lm-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for cli_lm-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a75cb22461c44dc9127d813c17750f3a75434f1fddfc4d9e017bdb49566d064c
MD5 a8a8b8768aecc0b490aa173578c77dbb
BLAKE2b-256 9b16b4c20fe253083dc8ec1b1fc5634473d412eb29a5bcd9c7cbdbbc6607ff6d

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