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

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_editor-0.1.2.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_editor-0.1.2.tar.gz
Algorithm Hash digest
SHA256 42638cc0fe5cd0b4dba378792cf33ab8eb4705599f398a196458d5f35e20fdcf
MD5 4d55752dd3b72affbaf043fcdd8ad082
BLAKE2b-256 0aafb8df124a3feaa2ee63644dd442ccab1a1b439ed80b483cc6e9625ff4533d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llm_editor-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_editor-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 71e638a1dfba2a3f9b97cd63a6a1a7b72be5cce750562ae5178cf7b349c0ec42
MD5 82e1f5a3988167396c2307c7f99998f1
BLAKE2b-256 45e4d97f3d9ab155798e677ee8b8601003f31b434209d389a79f602e63faa3b0

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