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.4.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.4-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cli_lm-0.1.4.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for cli_lm-0.1.4.tar.gz
Algorithm Hash digest
SHA256 69ff3ca3ed2582ed36d02459cab6710e70cf659e4bcb6149f252fd948d2f3e03
MD5 79c3c37611978964bb0ed4e77e239ba4
BLAKE2b-256 4211c7cfac13a74198f8dfa2bb333cf961da36e9b6cd68c156825aefe5132b8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cli_lm-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for cli_lm-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d959bc1899e249eb122113e9fe0f9f7b14d189ffd17f75d9f1820486ed84ebcc
MD5 2f2b9295c3fbd8a11de2e04310aa31d4
BLAKE2b-256 62b3d45271856450c0b89f9fa6da12683d691afb561324ca883750959a440a48

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