$ show Kiln-AI/Kiln
Kiln is a full-stack AI development platform for building, evaluating, and optimizing LLM-based tasks and agents. It provides a desktop application (Tkinter tray + FastAPI server) with a Svelte web UI, plus a core Python library and a cloud server component. The system supports the complete AI workflow: project/task management, multi-provider LLM orchestration via LiteLLM, evaluation with multiple judge types (LLM-as-judge, code eval, exact match, pattern match, etc.), synthetic data generation, RAG pipelines (chunking, embedding, vector stores), fine-tuning, prompt optimization, and Git-based project versioning. It also includes a 'Kiln Pro' cloud service for advanced features like copilot-assisted spec refinement and batch generation. The architecture is a monorepo with uv workspace, featuring extensive test coverage (unit, integration, e2e) and CI/CD pipelines. While the primary character is an application, it incorporates significant data engineering patterns for evaluation pipelines, synthetic data generation, and statistical analysis.
The LLM identified 5 files worth highlighting for reuse:
Stateless utility class that transforms LLM conversation traces (ChatCompletionMessageParam) into a formatted string suitable for judge consumption. Handles edge cases like reasoning content, tool calls, structured output, and tool results in a single message, emitting separate blocks to avoid silent data loss. Demonstrates careful design for trace fidelity and can be reused in any LLM evaluation pipeline.
Implements the largest-remainder method to convert weighted entries (e.g., percentages for train/test/val splits) into integer-percent allocations that sum to 100. Clean, well-tested algorithm that can be extracted for any project requiring proportional allocation with integer constraints.
Generic async job runner with configurable concurrency, full-jitter retries, progress reporting via an observer pattern, and clean cancellation. Provides a reusable foundation for any batch processing or background job system, decoupled from the specific domain.
Token-level translation of citation spans through auto-reformatting, with mark_html_range for highlight.js integration. Solves the non-trivial problem of maintaining span accuracy when JSON is reformatted (e.g., pretty-printed), ensuring that highlighted citations remain correct. A reusable utility for any application dealing with annotated JSON spans.
Statistical utilities for paired comparison of evaluation results, including McNemar exact/chi2 tests, Wilcoxon signed-rank test, bootstrap confidence intervals, and Wilson CIs for proportions. Provides a reusable toolkit for A/B testing or model comparison scenarios, independent of the evaluation framework.