A lightweight command-line tool that generates terminal commands from natural language
Project description
llm-cli-lite
一个轻量的命令行工具,通过自然语言生成终端命令,允许用户查看和修改 JSON 配置文件(如 API 密钥、模型名称等),并通过自然语言查询调用 LLM(如 ollama 或 openai_api)生成命令。
安装
方法一:
pip install llm-cli-lite
方法二:
# 克隆或下载项目仓库:
git clone https://github.com/mr-hanlu/llm-cli-lite.git
cd llm-cli-lite
# (可选)创建并激活虚拟环境:
conda create -n llm-cli-lite python=3.12
conda activate llm-cli-lite
# 安装工具及其依赖:
pip install .
# 这会将 llm-cli 安装为可编辑模式。如果需要开发模式(修改代码无需重新安装)可用:
pip install -e .
将安装的环境添加到系统环境变量,这样可以全局使用:YOU_PATH\llm-cli-lite\Scripts
验证安装:
llm-cli --help
config.json 配置文件保存在路径 ~/.llm-cli-lite/config.json 中
功能特性
显示帮助消息:llm-cli --help
查看配置:使用 llm-cli -l 列出所有配置项。
修改配置:支持设置 API 密钥、模型名称、基础 URL 等,例如 llm-cli --api_key "your-key"。
模型选择:支持 ollama 和 openai_api 模型,通过 -m 参数切换。
自然语言查询:输入自然语言描述(如 llm-cli "列出当前目录文件"),生成相应终端命令。
添加新功能
新命令:在 llm_cli_lite/__main__.py 中添加新的 argparse 命令。
新模型支持:扩展 openai_api_fun.py 或添加新模型接口。
配置字段:在 config.json 中添加新字段并更新命令行参数。
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
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_cli_lite-1.0.0.tar.gz.
File metadata
- Download URL: llm_cli_lite-1.0.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ba6c200730b20a9cf21fdfa81a7f8005d71ab08dd6fe65f151d95a18d005a8f
|
|
| MD5 |
996790a1cc3a251dc45055a879326932
|
|
| BLAKE2b-256 |
e3d501ab6f56e1d6a462d436a04ac44ffffa64d94539a5daa776eb830612dbf2
|
File details
Details for the file llm_cli_lite-1.0.0-py3-none-any.whl.
File metadata
- Download URL: llm_cli_lite-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e354c6b2c0c2a45b8492f5380c02ea2c5498d7cbbfc79f78318e7d59dcda185f
|
|
| MD5 |
3d4539dc8a388f853bbc1b600424d351
|
|
| BLAKE2b-256 |
1a1097a474dbb5f1d8c8b409baf5642eb5d97bb272fbb088928a68e576071b51
|