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.1.tar.gz (8.8 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.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file llm_editor-0.1.1.tar.gz.

File metadata

  • Download URL: llm_editor-0.1.1.tar.gz
  • Upload date:
  • Size: 8.8 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.1.tar.gz
Algorithm Hash digest
SHA256 ec4cb703d7dd326fcc37eadb68b7a0603f0da35413e26bee42eb645284cbed2e
MD5 c4cc0bad36a03c51a9fe7329083a598d
BLAKE2b-256 0d36f4eaee553559d83204e1d4eaf395212926f9c5616d3331a2a0121ef34957

See more details on using hashes here.

File details

Details for the file llm_editor-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: llm_editor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aca7d08b2db037e70240809bc2ba51bd6da8166778c7c803b54b8c294d80a643
MD5 fdcf57067f8dfe4f68ae7a1d0f35afed
BLAKE2b-256 c272b1552261882725c4979a12b89f0532441a47a517b51a30d5f738128df025

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