A CLI tool to edit files using LLMs
Project description
LLM Editor
A CLI tool to edit files using LLMs.
Installation
pip install .
Configuration
You can configure the tool using a YAML file, environment variables, or a .env file.
1. YAML Configuration (Recommended)
Run the following command to generate a default configuration file at ~/.llm-editor/config.yaml:
edit --init-config
Then edit the file to add your API key:
llm:
provider: openai
api_key: "your-api-key"
model: "gpt-4o"
app:
backup_enabled: true
backup_suffix: ".backup"
2. Environment Variables
You can also set configuration via environment variables or a .env file in your working directory:
OPENAI_API_KEYorLLM_API_KEYLLM_MODEL(default:gpt-3.5-turbo)LLM_PROVIDER(default:openai)
Usage
1. Using Prompt Tags (Scripting Mode)
Add your instructions directly to the file using <tag> markers.
Example input.txt:
<tag> start_prompt
Convert the following Python code to JavaScript.
<tag> end_prompt
def greet(name):
print(f"Hello, {name}!")
greet("World")
Run the tool:
edit input.txt
2. Interactive Mode
If the input file does not contain prompt tags, the tool will open your default text editor (configured via $EDITOR). You can type your instructions there, save, and close the editor to proceed.
Options
--outfile <path>: Write output to a specific file (input file is preserved).--inplace: Overwrite the input file directly (skips backup).--init-config: Initialize the configuration file.
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_editor-0.1.0.tar.gz.
File metadata
- Download URL: llm_editor-0.1.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ead5e21c7ba0e389453d99a82059ea2429f03e113cac000743927827f4acb59
|
|
| MD5 |
974f2da36d6f760bf4a59290bf1c1e86
|
|
| BLAKE2b-256 |
1abb904711ba0119f3cc0b5d2b89367b3d6d69d3c3cf9a3f6193a9d711fbd2c9
|
File details
Details for the file llm_editor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llm_editor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d15b74c7fc8199450131537f4772e40990a8481c4829c56d986db5b849af2f0e
|
|
| MD5 |
d10d2a5e7556fda56450827ed1d9f1d2
|
|
| BLAKE2b-256 |
23497ce470674b1d3dfbd1f89e57d55bd8d8e50d04a4c627841af9febf188633
|