How kiln-ai/kiln works
Detailing Each Component
A. Desktop App:
• Represented as its own client layer.
• Internal scripts (e.g., desktop_server.py, dev_server.py) and build scripts for packaging (WinInnoSetup.iss, build scripts).
• That the desktop apps target Windows, MacOS, and Linux.
B. Web UI:
• Folder “app/web_ui” with its Svelte-based structure.
• That it communicates with backend REST APIs.
C. Backend/API Server:
• REST API server (from libs/server/kiln_server) that handles requests related to projects, tasks, prompts, runs, and custom errors.
• That the server may also interface with the core logic library.
D. Core Business Logic (Library):
• Adapters (for fine-tune, eval, data generation, repair, parsers, and model adapters)
• Data Model (datamodel directory – handling projects, tasks, prompts, evaluations, dataset splits, etc.)
• Utilities (configuration, error handling, dataset import, formatting, etc.)
• This component is used by both the backend API (serving requests) and the desktop/web apps to process and validate data.
E. External Providers & Integrations:
Relationships and Data Flows
• That the Core Library “Adapter” layer bridges to External Services and providers.
• Bi-directional communication where needed (e.g., updating datasets, receiving model predictions).
Architectural Patterns and Design Principles
• Separation of concerns:
• UI clients (Desktop/Web) handle presentation and then call APIs.
• The API Server mediates client requests and orchestrates business logic.
• The Core Library encapsulates domain-specific operations (adapters, fine-tuning, evaluation, etc.).
• Multi-platform deployment for desktop apps and the modular design (adapter registry, parser registry, etc.) indicating a plug-in architecture.
• Testing structure by noting the “test_…” files within the desktop and core directories (showing a commitment to quality).
Technology Stack and Frameworks
• Next to each component, annotate the primary technologies:
• Desktop App: Python with custom scripts, packaging with WinInnoSetup, and shell scripts.
• Web UI: Svelte, TypeScript, Vite, Tailwind CSS, ESLint/Prettier for formatting.
• API Server: Python, FastAPI style server (if inferred from the structure), Uvicorn (indicated by uv.lock), and REST API endpoints.
• Core Library: Pure Python, modular structure for AI prototyping (adapters, data models).
Final Touches
• Every element is well annotated with brief text describing its role (e.g., “Core Business Logic: handles evaluations, fine-tuning, and data formatting”).