Skip to main content

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_KEY or LLM_API_KEY
  • LLM_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

llm_editor-0.1.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_editor-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

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

Hashes for llm_editor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ead5e21c7ba0e389453d99a82059ea2429f03e113cac000743927827f4acb59
MD5 974f2da36d6f760bf4a59290bf1c1e86
BLAKE2b-256 1abb904711ba0119f3cc0b5d2b89367b3d6d69d3c3cf9a3f6193a9d711fbd2c9

See more details on using hashes here.

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

Hashes for llm_editor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d15b74c7fc8199450131537f4772e40990a8481c4829c56d986db5b849af2f0e
MD5 d10d2a5e7556fda56450827ed1d9f1d2
BLAKE2b-256 23497ce470674b1d3dfbd1f89e57d55bd8d8e50d04a4c627841af9febf188633

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