--- sdk: gradio --- # LLM LSP A proof of concept for intelligent document editing that works like humans do - scan, jump, edit. ## The Idea Instead of making AI read entire documents, we let it: 1. Scan headers to find location (like grep) 2. Jump to right section (like sed) 3. Make targeted changes 4. Put it back (like cat) ## Quick Start ```python pip install -r requirements.txt # openai, gradio from lsp import LSP editor = LSP(api_key="your-key") editor.edit("doc.md", "add version warning") ``` ## How It Works 1. **Map Sections Fast** ```python sections = find_sections("doc.md") # Uses grep-like scan ``` 2. **AI Picks Target** ```json { "sections": {"## Setup": 10, "## Config": 50}, "task": "add version warning", "target": "## Setup at line 10" } ``` 3. **Extract & Edit** ```python content = extract_section(file, 10, 49) # Just that piece new_content = ai.modify(content) # AI edits small part ``` 4. **Put It Back** ```python replace_section(file, 10, 49, new_content) ``` ## Try It ```bash python main.py # Launches Gradio UI ``` ## Status - POC stage - Works with markdown files - Uses gpt-4o-mini - Basic UI ## Limits - One section at a time - Just markdown for now - No fancy error handling - Will fuck up if sections aren't clear ## Next Steps? - Handle multiple sections - Better section detection - More formats - Whatever you need it to do