Access large language models from the command-line
Project description
llm
Access large language models from the command-line
Installation
Install this tool using pip:
pip install llm
You need an OpenAI API key, which should either be set in the OPENAI_API_KEY environment variable, or saved in a plain text file called ~/.openai-api-key.txt in your home directory.
Usage
The default command for this is llm chatgpt - you can use llm instead if you prefer.
To run a prompt:
llm 'Ten names for cheesecakes'
To stream the results a token at a time:
llm 'Ten names for cheesecakes' -s
To switch from ChatGPT 3.5 (the default) to GPT-4 if you have access:
llm 'Ten names for cheesecakes' -4
Pass --model <model name> to use a different model.
Logging to SQLite
If a SQLite database file exists in ~/.llm/log.db then the tool will log all prompts and responses to it.
You can create that file by running the init-db command:
llm init-db
Now any prompts you run will be logged to that database.
To avoid logging a prompt, pass --no-log or -n to the command:
llm 'Ten names for cheesecakes' -n
Help
For help, run:
llm --help
You can also use:
python -m llm --help
Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd llm
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm-0.2.tar.gz.
File metadata
- Download URL: llm-0.2.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6015b0d9adc5693068d1c3c0ae098cf11424fd911ea255ecb8b99ed514ce2971
|
|
| MD5 |
5921df0058f835d4ba0ad1dd677bf320
|
|
| BLAKE2b-256 |
e92397495befd67b97e8ace3d859cc44fe57a48208d4913df4d7ac5cbcae9716
|
File details
Details for the file llm-0.2-py3-none-any.whl.
File metadata
- Download URL: llm-0.2-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab0a509abfe87c7b8a0c9db75e28b3d5ea2bc8289f054fcccacb21eef1f1daec
|
|
| MD5 |
dbdbe47ec9d19712eebd149a3f63b3ab
|
|
| BLAKE2b-256 |
7f1e653e498190d9635dae47240a0527dcfd993d93f75a23818fba2cae52436a
|