{"id":30805539,"url":"https://github.com/aaronsb/lcp-py","last_synced_at":"2025-09-06T00:58:52.062Z","repository":{"id":309256554,"uuid":"1035590224","full_name":"aaronsb/lcp-py","owner":"aaronsb","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-10T20:13:55.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-10T22:16:41.950Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aaronsb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-10T18:06:55.000Z","updated_at":"2025-08-10T20:13:58.000Z","dependencies_parsed_at":"2025-08-10T22:17:00.163Z","dependency_job_id":"e46a74d3-fedc-492d-99d5-806b43f84a0f","html_url":"https://github.com/aaronsb/lcp-py","commit_stats":null,"previous_names":["aaronsb/lcp-py"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/aaronsb/lcp-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronsb%2Flcp-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronsb%2Flcp-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronsb%2Flcp-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronsb%2Flcp-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aaronsb","download_url":"https://codeload.github.com/aaronsb/lcp-py/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronsb%2Flcp-py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273842825,"owners_count":25177921,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-06T00:58:48.621Z","updated_at":"2025-09-06T00:58:52.042Z","avatar_url":"https://github.com/aaronsb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LCP - LlamaCP Model Management \u0026 Chat Interface\n\n🦙 **Advanced model management for llama.cpp** with automatic downloads, smart model discovery, and streaming chat interface.\n\n## ✨ Features\n\n- 🔍 **Smart Model Discovery** - Find models with fuzzy search and aliases\n- 📥 **Automatic Downloads** - Download models from HuggingFace with progress bars\n- 💬 **Streaming Chat** - Real-time token streaming with rich terminal UI  \n- ⚙️ **XDG Configuration** - Follows Linux standards for config and data\n- 🎯 **Model Management** - Easy switching, removal, and organization\n- 🔌 **Multiple Backends** - HuggingFace (more coming)\n- 🚀 **Standalone Binary** - No Python required after installation\n\n## 🚀 Quick Start\n\n### Option 1: Standalone Binary (Recommended)\n```bash\n# Clone and install\ngit clone \u003crepo-url\u003e\ncd lcp-py\n./install.sh\n\n# Use immediately\nlcp chat phi-3.5-mini\n```\n\n### Option 2: Development Setup\n```bash\n# For development/testing\n./dev-install.sh\nsource venv/bin/activate\nlcp chat phi-3.5-mini\n```\n\n## 💡 Usage Examples\n\n```bash\n# System status\nlcp status\n\n# Search for models\nlcp search \"phi 3.5\"\nlcp search \"qwen 7b\"\n\n# Download and chat (one command!)\nlcp chat phi-3.5-mini          # Downloads if needed\nlcp chat qwen2.5               # Smart alias matching\nlcp chat microsoft/Phi-3-mini  # Specific repo\n\n# Model management\nlcp list                       # List local models\nlcp active                     # Set active model\nlcp remove                     # Remove models\n\n# Configuration\nlcp config show               # Show settings\nlcp config edit              # Edit config file\n```\n\n## 🎯 Smart Features\n\n### Automatic Model Resolution\n```bash\nlcp chat phi3        # → bartowski/Phi-3.5-mini-instruct-GGUF\nlcp chat qwen        # → bartowski/Qwen2.5-7B-Instruct-GGUF  \nlcp chat llama3.1    # → bartowski/Llama-3.1-8B-Instruct-GGUF\n```\n\n### Preferred Quantizations\n- Automatically selects **Q4_K_M** (best balance of quality/size)\n- Falls back to **Q5_K_M**, **Q6_K**, **Q8_0** if needed\n- Prefers **instruct/chat** models over base models\n\n### Streaming Chat Interface\n- **Real-time token streaming** - see responses as they're generated\n- **Rich formatting** - markdown, syntax highlighting, panels\n- **Performance metrics** - tokens/second, timing info\n- **Chat commands** - `/clear`, `/stats`, `/help`\n- **Conversation memory** - maintains context across turns\n\n## 📁 File Organization (XDG Compliant)\n\n```\n~/.config/lcp/\n├── config.toml              # Main configuration\n\n~/.local/share/lcp/\n├── models/                  # Downloaded models\n│   ├── model.gguf          # Symlink to active model\n│   ├── phi-3.5-mini.gguf   # Downloaded models\n│   └── qwen2.5-7b.gguf\n\n~/.cache/lcp/                # Cache directory\n```\n\n## ⚙️ Configuration\n\n### Example `~/.config/lcp/config.toml`:\n```toml\nmodels_dir = \"~/.local/share/lcp/models\"\n\n[model_preferences]\npreferred_quantization = \"Q4_K_M\"\nmax_model_size_gb = 16.0\nprefer_instruct_models = true\n\n[api]\nbase_url = \"http://localhost:11434\"\nstreaming = true\nmax_tokens = 2048\ntemperature = 0.7\n\n[ui]\nuse_colors = true\nshow_progress = true\nshow_timing = true\n\n[[backends]]\nname = \"huggingface\"\nenabled = true\npriority = 1\n```\n\n## 🔌 Backend System\n\n### HuggingFace Backend\n- Searches popular **GGUF repositories** (bartowski, microsoft, mradermacher)\n- **Smart aliases** for common models\n- **Fuzzy matching** - finds models even with partial names\n- **Concurrent searches** across multiple repos\n\n### Planned Backends\n- **Ollama Registry** - Access Ollama's model library\n- **Direct URLs** - Download from any URL\n- **Local Conversion** - Convert PyTorch models to GGUF\n\n## 🏗️ Integration with LlamaCP Docker\n\nLCP works seamlessly with your existing llama.cpp Docker setup:\n\n1. **Download models** with LCP\n2. **Set active model** (creates symlink)  \n3. **Restart container** to load new model\n4. **Chat with streaming** through LCP\n\n```bash\n# Typical workflow\nlcp chat qwen2.5               # Downloads and sets active\n# LCP prompts: \"Restart container? Press Enter when ready...\"\ndocker compose restart llamacpp\n# Chat interface starts automatically\n```\n\n## 🔧 Development\n\n### Project Structure\n```\nlcp-py/\n├── lcp/\n│   ├── backends/           # Model backends\n│   ├── ui/                # Terminal interface\n│   ├── cli.py             # Command-line interface\n│   ├── core.py            # Core functionality\n│   ├── config.py          # Configuration management\n│   └── models.py          # Data models\n├── install.sh             # Production installer\n├── dev-install.sh         # Development setup\n└── pyproject.toml         # Project metadata\n```\n\n### Build System\n- **PyInstaller** - Creates standalone binary\n- **Development mode** - `pip install -e .` for testing  \n- **XDG compliance** - Uses platformdirs for cross-platform paths\n\n## 🆚 Comparison with Bash Version\n\n| Feature | Bash Script | Python LCP |\n|---------|-------------|------------|\n| **Model Discovery** | Manual URLs | Smart search + aliases |\n| **Download Progress** | Basic | Rich progress bars |  \n| **Chat Interface** | Simple | Streaming + formatting |\n| **Configuration** | Hardcoded | XDG-compliant TOML |\n| **Error Handling** | Basic | Comprehensive |\n| **Extensibility** | Limited | Plugin architecture |\n| **Distribution** | Script file | Standalone binary |\n\n## 🚀 Performance  \n\n- **Concurrent downloads** - Multiple backends searched in parallel\n- **Streaming responses** - No waiting for complete responses\n- **Lazy loading** - Backends initialized only when needed\n- **Async throughout** - Non-blocking I/O operations\n\n## 📋 Requirements\n\n- **Python 3.9+** (for development)\n- **llamacpp Docker container** running\n- **Internet connection** for model downloads\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Run `./dev-install.sh` for development setup\n3. Make changes and test with `lcp --help`\n4. Build binary with `./install.sh` for testing\n5. Submit pull request\n\n## 📄 License\n\nMIT License - see LICENSE file for details.\n\n---\n\n**🎯 LCP bridges the gap between Ollama's convenience and llama.cpp's performance!**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaronsb%2Flcp-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaronsb%2Flcp-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaronsb%2Flcp-py/lists"}