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.2.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.

cli_lm-0.1.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cli_lm-0.1.2.tar.gz
  • Upload date:
  • Size: 5.0 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.2.tar.gz
Algorithm Hash digest
SHA256 838923f743318f1013e58a76a81aeba63c9a10faf34d682824ad56ac90b2a533
MD5 6ef50fdcdec8d962382d18d40c4fdade
BLAKE2b-256 9fe371bca8d834be47632cd994c75b9f6fbe7d3daf73a060baa0469c634d0fa0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cli_lm-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 541238fed150b9c948ff0f50e5000a01b608ce1c880f71043a0a2902e5d370a7
MD5 d8aa57031f24cb2f96dd7ad02f0294a6
BLAKE2b-256 62a2e18dc5fc26a656ebd64688bb761c2d5669e2136c54a1a6788672cb13f603

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