langextract-rust 0.5.0

A Rust library for extracting structured and grounded information from text using LLMs
Documentation
# LangExtract CLI Implementation

## Overview

Successfully implemented a comprehensive command-line interface for the LangExtract library with easy installation and distribution capabilities.

## ✅ Completed Features

### 1. CLI Feature System
- **Optional CLI feature**: Added `cli` feature to `Cargo.toml` that includes CLI dependencies only when needed
- **Feature-gated compilation**: CLI binary only builds when the `cli` feature is enabled
- **Graceful fallback**: Shows helpful error message when CLI feature is not enabled

### 2. Comprehensive CLI Commands

#### Extract Command
- **Text/file/URL input**: Process literal text, local files, or remote URLs
- **Configurable providers**: Support for OpenAI, Ollama, and custom HTTP APIs
- **Output formats**: JSON, YAML, and text output with optional character intervals
- **Export formats**: HTML, Markdown, JSON, CSV with rich visualizations
- **Performance options**: Configurable workers, batch sizes, chunk sizes, temperature
- **Multi-pass extraction**: Advanced extraction with multiple passes for better recall

#### Configuration Commands
- **Init command**: Generates configuration templates and examples
- **Test command**: Validates provider connectivity with troubleshooting tips
- **Provider-specific setup**: Tailored initialization for different LLM providers

#### Information Commands
- **Providers command**: Lists available providers, models, and requirements
- **Examples command**: Shows usage examples and configuration samples
- **Help system**: Comprehensive help for all commands and options

#### Utility Commands
- **Convert command**: Transform extraction results between formats
- **Configuration management**: Support for examples.json, .env, and YAML config files

### 3. Installation System

#### Cross-Platform Install Scripts
- **Linux/macOS**: Bash script (`install.sh`) with automatic Rust installation
- **Windows**: PowerShell script (`install.ps1`) with Windows-specific setup
- **Manual installation**: Direct cargo install with feature flags

#### Installation Features
- **Dependency checking**: Verifies Rust, Git, and curl availability
- **Environment setup**: Automatically configures PATH and shell completion
- **Verification**: Tests installation and provides next steps
- **Error handling**: Comprehensive error messages and troubleshooting

### 4. User Experience

#### Rich Output
- **Colored terminal output**: Syntax highlighting and status indicators
- **Progress indicators**: Spinner progress bars for long operations
- **Interactive feedback**: Real-time status updates during processing

#### Configuration Management
- **Template generation**: Automatic creation of configuration files
- **Example patterns**: Pre-built extraction examples for common use cases
- **Environment variables**: Support for API keys and provider settings

#### Documentation
- **Comprehensive README**: Extended documentation with CLI examples
- **Usage examples**: Real-world scenarios and use cases
- **Demo script**: Interactive demonstration of CLI capabilities

## 🛠️ Technical Implementation

### Architecture
- **Feature-gated design**: CLI code only compiles when needed
- **Error handling**: Comprehensive error messages with actionable guidance
- **Type safety**: Full Rust type system integration with CLI arguments
- **Performance**: Parallel processing with configurable concurrency

### Dependencies
- **clap 4.0**: Modern CLI argument parsing with derive macros
- **colored**: Terminal output styling and colors
- **indicatif**: Progress bars and spinners
- **console**: Advanced terminal interaction
- **dirs**: Cross-platform directory management

### Integration
- **Library compatibility**: Seamless integration with existing LangExtract API
- **Provider system**: Full support for all available LLM providers
- **Visualization**: Integration with rich export and visualization features

## 📦 Installation Options

### Quick Install (Recommended)
```bash
# Linux/macOS
curl -fsSL https://raw.githubusercontent.com/modularflow/langextract-rust/main/install.sh | bash

# Windows PowerShell
iwr -useb https://raw.githubusercontent.com/modularflow/langextract-rust/main/install.ps1 | iex
```

### Manual Install
```bash
cargo install langextract-rust --features cli
```

### From Source
```bash
git clone https://github.com/modularflow/langextract-rust
cd langextract-rust
cargo install --path . --features cli
```

## 🚀 Quick Start

```bash
# Initialize configuration
lx-rs init

# Basic extraction
lx-rs extract "John Doe is 30 years old" --prompt "Extract names and ages"

# Test setup
lx-rs test --provider ollama

# Process files with export
lx-rs extract document.txt --examples examples.json --export html

# Check providers
lx-rs providers
```

## 📊 Key Benefits

1. **Easy Installation**: One-command install with automatic setup
2. **Rich Features**: Full feature parity with library API
3. **User-Friendly**: Colored output, progress bars, helpful error messages
4. **Cross-Platform**: Works on Linux, macOS, and Windows
5. **Configurable**: Extensive configuration options for all use cases
6. **Documentation**: Comprehensive help and examples
7. **Performance**: High-performance parallel processing
8. **Provider Agnostic**: Works with OpenAI, Ollama, and custom APIs

## 🎯 Use Cases

- **Document Processing**: Extract structured data from research papers, contracts, catalogs
- **Data Mining**: Process large text corpora with parallel workers
- **API Integration**: Use as CLI tool in scripts and automation workflows
- **Development**: Test extraction patterns and provider configurations
- **Batch Processing**: Process multiple files with consistent configuration

The CLI implementation provides a production-ready tool that makes LangExtract accessible to users who prefer command-line interfaces while maintaining all the power and flexibility of the underlying library.