### Install and Run Documentation Server Source: https://github.com/kitops-ml/kitops/blob/main/CLAUDE.md Navigate to the docs directory, install dependencies using pnpm, and then start the development server, build for production, or preview the built documentation. ```bash cd docs pnpm install pnpm docs:dev # Development server pnpm docs:build # Production build pnpm docs:preview # Preview built docs ``` -------------------------------- ### Install Dependencies and Run Dev Server Source: https://github.com/kitops-ml/kitops/blob/main/frontend/dev-mode/README.md Use these commands to install project dependencies and start the local development server. Navigate to http://localhost:5173 in your browser after running. ```sh pnpm i pnpm dev ``` -------------------------------- ### Install Kubeflow Pipelines SDK Source: https://github.com/kitops-ml/kitops/blob/main/build/dockerfiles/kubeflow-components/examples/README.md Installs the necessary Kubeflow Pipelines SDK versions for running the examples. Ensure these versions are compatible with your Kubeflow deployment. ```bash pip install kfp==2.14.3 kfp-kubernetes==2.14.3 ``` -------------------------------- ### Kit Init Examples Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Examples demonstrating various ways to use the 'kit init' command for generating Kitfiles from local or remote sources. ```bash # Generate a Kitfile for the current directory: kit init . ``` ```bash # Generate a Kitfile for files in ./my-model, with name "mymodel" and a description: kit init ./my-model --name "mymodel" --desc "This is my model's description" ``` ```bash # Generate a Kitfile, overwriting any existing Kitfile: kit init ./my-model --force ``` ```bash # Generate a Kitfile for a remote HuggingFace model: kit init https://huggingface.co/myorg/mymodel --remote ``` ```bash # Generate a Kitfile for a HuggingFace dataset: kit init huggingface.co/datasets/myorg/mydataset --remote ``` ```bash # Generate a Kitfile for a remote repository with a specific ref: kit init myorg/mymodel --remote --ref v1.0 ``` ```bash # Save the generated Kitfile to a specific path: kit init myorg/mymodel --remote --output ./Kitfile ``` -------------------------------- ### Install Go Dependencies Source: https://github.com/kitops-ml/kitops/blob/main/CONTRIBUTING.md Fetch and install the project's dependencies using the Go command. Ensure you are in the project directory before running. ```shell go mod tidy ``` -------------------------------- ### Example Kit CLI Version Output Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/pykitops/before-you-begin.md This is an example of the output you should expect when running the 'kit version' command successfully. ```text Version: 0.4.0 Commit: e2e83d953823ac35648f2f76602a0cc6e8ead819 Built: 2024-11-05T20:29:07Z Go version: go1.22.6 ``` -------------------------------- ### Start development server Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Use this command to start a local development server for interacting with models in the browser. This is an experimental feature. ```bash kit dev start ``` -------------------------------- ### Start Local Development Server Source: https://github.com/kitops-ml/kitops/blob/main/docs/README.md Run this command to start the VitePress development server for local documentation preview. ```sh pnpm docs:dev ``` -------------------------------- ### Full Kitfile Example with Model and Datasets Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/kitfile/kf-overview.md A comprehensive Kitfile example including package metadata, code, a serialized model, datasets, and prompts. All paths are relative. ```yaml manifestVersion: v1.0.0 package: authors: - Jozu description: Updated model to analyze flight trait and passenger satisfaction data license: Apache-2.0 name: FlightSatML code: - description: Jupyter notebook with model training code in Python path: ./notebooks model: description: Flight satisfaction and trait analysis model using Scikit-learn framework: Scikit-learn license: Apache-2.0 name: joblib Model path: ./models/scikit_class_model_v2.joblib version: 1.0.0 datasets: - name: training data description: Flight traits and traveller satisfaction training data (tabular) path: ./data/train.csv - name: validation data description: validation data (tabular) path: ./data/test.csv prompts: - path: system.prompt.md description: System prompt for model inference ``` -------------------------------- ### Example: Import Repository with Existing Kitfile Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Download a HuggingFace repository and package it using a pre-existing Kitfile. ```bash # Download repository and pack it using an existing Kitfile kit import myorg/myrepo --file ./path/to/Kitfile ``` -------------------------------- ### Kit Inspect Examples Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Examples demonstrating how to inspect local and remote modelkits using the 'kit inspect' command. ```bash # Inspect a local modelkit: kit inspect mymodel:mytag ``` ```bash # Inspect a local modelkit by digest: kit inspect mymodel@sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a ``` ```bash # Inspect a remote modelkit: kit inspect --remote registry.example.com/my-model:1.0.0 ``` -------------------------------- ### Kitfile Code Section Example Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/next-steps.md This YAML snippet shows how to include a single codebase in a Kitfile. The entry must start with a dash, similar to dataset entries. ```yaml code: - description: Jupyter notebook with model training code in Python path: ./notebooks ``` -------------------------------- ### Example: Import Default Repository Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Download the default tag (latest) of a HuggingFace repository and package it as a ModelKit. ```bash # Download repository myorg/myrepo and package it, using the default tag (myorg/myrepo:latest) kit import myorg/myrepo ``` -------------------------------- ### Complete Kitfile Example Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/next-steps.md A comprehensive Kitfile example including package metadata, model information, documentation, datasets, and code. Relative paths are interpreted relative to the context directory. ```yaml manifestVersion: 1.0 package: authors: - Jozu description: Small language model based on Mistral-7B fine tuned for answering film photography questions. license: Apache-2.0 name: FilmSLM model: name: FilmSLM description: Film photography Q&A model using Mistral-7B framework: Mistral-7B license: Apache-2.0 path: ./models/film_slm:champion version: 1.2.6 docs: - path: ./README.md description: Readme file for this ModelKit - path: ./USAGE.md description: Information on how to use this model for inference datasets: - description: Forum postings from sites like rangefinderforum, PhotographyTalk, and r/AnalogCommunity name: training data path: ./data/forum-to-2023-train.csv - description: validation data name: validation data path: ./data/test.csv code: - description: Jupyter notebook with model training code in Python path: ./notebooks ``` -------------------------------- ### Start Development Server Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Starts a development server for a modelkit. Can accept a directory path or a ModelKit reference. ModelKit references are automatically extracted. ```bash kit dev start [directory|registry/repository[:tag|@digest]] [flags] ``` -------------------------------- ### List local modelkits Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Example of how to list all modelkits stored in the local repository. ```bash # List local modelkits kit list ``` -------------------------------- ### Kitfile Datasets Section Example Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/next-steps.md This YAML snippet demonstrates how to define multiple datasets within a Kitfile. Each dataset entry must start with a dash, even if there's only one. ```yaml datasets: - description: Forum postings from photo sites name: training data path: ./data/forum-to-2023-train.csv - name: validation data path: ./data/test.csv ``` -------------------------------- ### Example: Show Local ModelKit Configuration Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Display the configuration for a local modelkit identified by its name and tag. ```bash # See configuration for a local modelkit: kit info mymodel:mytag ``` -------------------------------- ### Start Frontend Development Server Source: https://github.com/kitops-ml/kitops/blob/main/CLAUDE.md Starts the development server for the frontend UI, enabling hot-reloading and other development features. ```bash pnpm dev ``` -------------------------------- ### Install KitOps CLI Locally Source: https://github.com/kitops-ml/kitops/blob/main/CLAUDE.md Installs the KitOps CLI to the local Go bin path. ```bash go install . ``` -------------------------------- ### Get Kit Version Information Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/kitops-ts/api-reference.md Retrieves version information for the installed `kit` binary, including version, commit hash, build date, and Go version. ```typescript const { version, commit, built, goVersion } = await version(); console.log(`kit ${version} (${commit})`); ``` -------------------------------- ### Install Skills into Project Directory Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Installs SKILL.md prompt layers as agent skills into a specific project directory using the -d flag. This allows for project-specific skill installations. ```bash kit unpack myrepo/my-model:latest --as-skill -d /path/to/project ``` -------------------------------- ### Install KitOps TS Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/kitops-ts/getting-started.md Install the KitOps TS library using npm or pnpm. ```bash npm install @kitops/kitops-ts # or pnpm add @kitops/kitops-ts ``` -------------------------------- ### ModelKit Kitfile Example Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/next-steps.md This is an example of a Kitfile's content, showing package details, model information, code, and datasets. ```yaml manifestVersion: v1.0.0 package: name: Finetuning_SLM description: This Kitfile contains all the necessary files required for finetuning SLM. license: Apache-2.0 authors: [Rajat] model: name: keras Model path: ./model_adapter framework: Scikit-learn version: 1.0.0 description: Flight satisfaction and trait analysis model using Scikit-learn license: Apache-2.0 code: - path: ./SLM_Finetuning.ipynb description: Jupyter notebook with model training code in Python datasets: - name: training data path: ./slm_tuning_dataset.csv description: UCF Video Dataset ``` -------------------------------- ### Install KitOps on Linux with Homebrew Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/installation.md Use Homebrew to install KitOps on Linux. This is the recommended method. Ensure you have Homebrew installed. ```shell brew tap kitops-ml/kitops brew install kitops kit version ``` -------------------------------- ### Example: Import Repository and Tag ModelKit Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Download a HuggingFace repository and assign a custom tag to the resulting ModelKit. ```bash # Download repository and tag it 'myrepository:mytag' kit import myorg/myrepo --tag myrepository:mytag ``` -------------------------------- ### Install Frontend Dependencies Source: https://github.com/kitops-ml/kitops/blob/main/CLAUDE.md Installs all necessary Node.js dependencies for the frontend development environment using pnpm. ```bash pnpm install ``` -------------------------------- ### Start Local LLM Development Server Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/deploy.md Initiate the local development server for an LLM using the Kit CLI. This command starts the server in the current directory, and the output will provide a URL for interacting with the LLM. ```bash kit dev start . ``` -------------------------------- ### Example: Show Remote ModelKit Configuration Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Display the configuration for a modelkit stored on a remote registry. ```bash # See configuration for a remote modelkit: kit info --remote registry.example.com/my-model:1.0.0 ``` -------------------------------- ### Serve ModelKit Reference Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Starts the development server for a ModelKit specified by its reference, which can be pulled from a local or remote registry. ```bash # Serve a ModelKit reference from local storage or registry kit dev start myrepo/my-model:latest ``` -------------------------------- ### Example Kitfile AI/ML Manifest Source: https://github.com/kitops-ml/kitops/blob/main/pkg/artifact/kitfile.md This is a complete example of a Kitfile manifest for an AI/ML project, demonstrating the structure and usage of various sections. ```yaml manifestVersion: 1.0 package: name: AIProjectName version: 1.2.3 description: >- A brief description of the AI/ML project. authors: [Author Name, Contributor Name] code: - path: src/ description: Source code for the AI models. license: Apache-2.0 datasets: - name: DatasetName path: data/dataset.csv description: Description of the dataset. license: CC-BY-4.0 prompts: - path: system.prompt.md description: System prompt for the LLM. model: name: ModelName path: models/model.h5 framework: TensorFlow version: 1.0 description: Model description. license: Apache-2.0 ``` -------------------------------- ### Serve Model from Current Directory Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Starts the development server for the model located in the current directory. ```bash # Serve the model located in the current directory kit dev start ``` -------------------------------- ### Install Prompt Layers as Skills (Auto-Detect) Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Installs SKILL.md prompt layers as agent skills. The --as-skill flag without a value enables auto-detection of installed agents based on their global configuration directories. ```bash kit unpack myrepo/my-model:latest --as-skill ``` -------------------------------- ### Example: Import Repository with Specific Tag Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Download a specific version (tag) of a HuggingFace repository and package it as a ModelKit. ```bash # Download repository using a different version (tag) than the default and package it kit import myorg/myrepo --ref v1.0.0 ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/kitops-ml/kitops/blob/main/docs/README.md Install all necessary project dependencies using the pnpm package manager. ```sh pnpm i ``` -------------------------------- ### Quick Start: Login, Pack, and Push Model Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/kitops-ts/getting-started.md Authenticate with a registry, pack the current directory into a ModelKit, and push it. Ensure REGISTRY_USER and REGISTRY_PASS environment variables are set. ```typescript import { login, pack, push } from '@kitops/kitops-ts'; // Authenticate — password is passed via stdin to keep it out of the process list await login( 'registry.example.com', process.env.REGISTRY_USER!, process.env.REGISTRY_PASS!, ); // Pack the current directory using the Kitfile found there await pack('.', { tag: 'registry.example.com/org/my-model:v1.0.0' }); // Push the ModelKit to the registry await push('registry.example.com/org/my-model:v1.0.0'); ``` -------------------------------- ### Install PyKitOps Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/integrations/mlflow.md Install the PyKitOps Python library into the MLFlow interpreter. This is a prerequisite for using PyKitOps. ```sh pip install kitops ``` -------------------------------- ### Install Agent Skill to Project Directory Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/next-steps.md Install agent skills into a specific project directory using the --as-skill flag with the -d option. This allows for project-scoped skill management, distinct from global installations. ```sh kit unpack myrepo/my-agent-kit:latest --as-skill -d /path/to/project ``` -------------------------------- ### Deployment Example for Production Workloads Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/integrations/k8s-init-container.md A Kubernetes Deployment manifest for managing multiple replicas of an application that uses a ModelKit. This example shows how to configure the init container and application container within a Deployment spec, including placeholder images and arguments. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: modelkit-app spec: replicas: 2 selector: matchLabels: app: modelkit-app template: metadata: labels: app: modelkit-app spec: volumes: - name: modelkit-storage emptyDir: {} initContainers: - name: kitops-init image: ghcr.io/kitops-ml/kitops-init:latest env: - name: MODELKIT_REF value: "your-jozu-hub/your-model:latest - name: UNPACK_PATH value: "/modelkit" volumeMounts: - name: modelkit-storage mountPath: "/modelkit" containers: - name: app image: your-company/your-container:latest args: ["--model-dir=/modelkit"] volumeMounts: - name: modelkit-storage mountPath: /modelkit ``` -------------------------------- ### Example: Show Local ModelKit Configuration by Digest Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Display the configuration for a local modelkit identified by its SHA256 digest. ```bash # See configuration for a local modelkit by digest: kit info mymodel@sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a ``` -------------------------------- ### List modelkits from a remote repository Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Example of listing modelkits from a specified remote registry. ```bash # List modelkits from a remote repository kit list registry.example.com/my-namespace/my-model ``` -------------------------------- ### Example Docker Config JSON Source: https://github.com/kitops-ml/kitops/blob/main/build/dockerfiles/kubeflow-components/README.md An example of the structure for a `config.json` file used for Docker registry authentication. This JSON object should be placed within the Kubernetes secret. ```json { "auths": { "jozu.ml": { "auth": "base64(username:password)" } } } ``` -------------------------------- ### Initialize LLM Directory for Local Development Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/deploy.md Prepare a directory for running LLMs locally. This involves creating a new folder and navigating into it. Ensure you have the Kit CLI installed. ```bash mkdir kitdev cd kitdev ``` -------------------------------- ### Configure .env for Jozu Hub Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/pykitops/before-you-begin.md Example of a .env file configuration for using the Jozu Hub, including username, password, and namespace. ```bash JOZU_USERNAME=brett@jozu.org JOZU_PASSWORD=my_password JOZU_NAMESPACE=brett ``` -------------------------------- ### Serve Model with Custom Host and Port Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Starts the development server for a specific model, allowing customization of the host and port for the development server. ```bash # Serve a specific model with custom host and port kit dev start registry.example.com/models/llama2:7b --host 0.0.0.0 --port 8080 ``` -------------------------------- ### List modelkits with prompts or datasets Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Example demonstrating the use of multiple filter flags to list modelkits matching either condition. ```bash # List modelkits that have either prompts or datasets kit list -f prompts -f datasets ``` -------------------------------- ### Build KitOps from Source Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/installation.md Clone the KitOps repository and build the executable using Go. This method requires Git and Go to be installed. ```shell git clone https://github.com/kitops-ml/kitops.git cd kitops go build -o kit ``` -------------------------------- ### Install Prompt Layers as Skills (Specific Agents) Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Installs SKILL.md prompt layers as agent skills for a specified list of agents: 'claude-code', 'cursor', and 'windsurf'. The --as-skill flag requires a value when specifying agents. ```bash kit unpack myrepo/my-model:latest --as-skill=claude-code,cursor,windsurf ``` -------------------------------- ### Install KitOps on Linux Source: https://github.com/kitops-ml/kitops/blob/main/INSTALL.md Use these commands to extract the KitOps binary and move it to your system's PATH for command-line access. ```shell tar -xzvf kitops-linux-x86_64.tar.gz sudo mv kit /usr/local/bin/ ``` -------------------------------- ### version Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/kitops-ts/api-reference.md Retrieves the version information for the installed `kit` binary, including version number, commit hash, build date, and Go version. ```APIDOC ## `version()` ### Description Returns version information for the installed `kit` binary. ### Returns `CancellablePromise` ### Type Definition ```typescript type VersionResult = { version: string; commit: string; built: string; goVersion: string; } ``` ### Example ```typescript const { version, commit, built, goVersion } = await version(); console.log(`kit ${version} (${commit})`); ``` ``` -------------------------------- ### Serve Model from Specific Directory with Custom Port Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Starts the development server for a modelkit located in a specified directory, listening on a custom port. ```bash # Serve the modelkit in ./my-model on port 8080 kit dev start ./my-model --port 8080 ``` -------------------------------- ### Generate Dev Harness and UI Source: https://github.com/kitops-ml/kitops/blob/main/CONTRIBUTING.md Generate the development mode harness and UI components. This command should be run after setting up the project and installing dependencies. ```shell go generate ./... ``` -------------------------------- ### Unpack a Sample ModelKit Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/get-started.md Pulls and unpacks a specified ModelKit from a registry to the current directory. The example uses a fine-tuned Llama 3 model from Jozu Hub. ```sh kit unpack jozu.ml/jozu-quickstarts/fine-tuning:latest ``` -------------------------------- ### Install ClusterStorageContainer for KitOps Source: https://github.com/kitops-ml/kitops/blob/main/build/dockerfiles/KServe/README.md Define a ClusterStorageContainer custom resource to enable KServe InferenceServices to use storage URIs starting with 'kit://'. Ensure the correct image tag is specified. ```yaml apiVersion: "serving.kserve.io/v1alpha1" kind: ClusterStorageContainer metadata: name: kitops spec: container: name: storage-initializer image: ghcr.io/kitops-ml/kitops-kserve:next imagePullPolicy: Always env: - name: KIT_UNPACK_FLAGS value: "" # Add extra flags for the `kit unpack` command resources: requests: memory: 100Mi cpu: 100m limits: memory: 1Gi supportedUriFormats: - prefix: kit:// ``` -------------------------------- ### Configure Main Application Container to Use ModelKit Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/integrations/k8s-init-container.md Configure the main application container to mount the shared volume where the ModelKit was unpacked. The example command demonstrates listing the contents of the unpacked directory. ```yaml containers: - name: app image: alpine:latest command: ["sh", "-c", "echo 'Contents of /modelkit:' && ls /modelkit && sleep 3600"] volumeMounts: - name: modelkit-storage mountPath: /modelkit ``` -------------------------------- ### Full Pod Example for ModelKit Deployment Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/integrations/k8s-init-container.md A complete Kubernetes Pod definition combining the shared volume, init container for ModelKit management, and the application container. Apply this YAML file using `kubectl apply -f modelkit-demo.yaml`. ```yaml apiVersion: v1 kind: Pod metadata: name: modelkit-demo spec: volumes: - name: modelkit-storage emptyDir: {} initContainers: - name: kitops-init image: ghcr.io/kitops-ml/kitops-init:latest env: - name: MODELKIT_REF value: "jozu.ml/jozu/bert-base-uncased:safetensors" - name: UNPACK_PATH value: "/modelkit" volumeMounts: - name: modelkit-storage mountPath: "/modelkit" containers: - name: app image: alpine:latest command: ["sh", "-c", "echo 'Contents of /modelkit:' && ls /modelkit && sleep 3600"] volumeMounts: - name: modelkit-storage mountPath: /modelkit ``` -------------------------------- ### Install KitOps ClusterStorageContainer for KServe Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/integrations/kserve.md Create a ClusterStorageContainer resource to enable KitOps to unpack ModelKits when storage URIs start with 'kit://'. Ensure the KitOps KServe image is correctly specified. ```yaml apiVersion: serving.kserve.io/v1alpha1 kind: ClusterStorageContainer metadata: name: kitops spec: container: name: storage-initializer image: ghcr.io/kitops-ml/kitops-kserve:latest imagePullPolicy: Always env: - name: KIT_UNPACK_FLAGS value: "" # Additional flags for `kit unpack` resources: requests: memory: 100Mi cpu: 100m limits: memory: 1Gi supportedUriFormats: - prefix: kit:// ``` -------------------------------- ### Install KitOps on macOS with Homebrew Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/installation.md Use Homebrew to install KitOps on macOS. This is the recommended method. Ensure you have Homebrew installed. ```shell brew tap kitops-ml/kitops brew install kitops ``` -------------------------------- ### Preview Built Documentation Source: https://github.com/kitops-ml/kitops/blob/main/docs/README.md Serve the built documentation files locally to preview the production build. ```sh pnpm docs:preview ``` -------------------------------- ### Verify KitOps Installation Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/installation.md After installation, verify that KitOps is installed correctly by running the 'kit version' command in a new terminal session. ```shell kit version ``` -------------------------------- ### Create and Push Kitfile to Jozu Hub Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/pykitops/how-to-guides.md This script creates a Kitfile object, populates its fields with package, model, code, datasets, and docs information, and then pushes it to Jozu Hub using ModelKitManager. Ensure you have the PyKitOps SDK installed and are authenticated with Jozu Hub. ```python import os from kitops.modelkit.kitfile import Kitfile from kitops.modelkit.manager import ModelKitManager if __name__ == "__main__": # Create the Kitfile kitfile = Kitfile() kitfile.manifestVersion = "1.0" kitfile.package = { "name": "sample-kitfile", "version": "1.0", "description": "Sample kitfile for PyKitOps demonstration" } kitfile.model = { "name": "sample-model", "path": "model/model.pkl", "license": "Apache 2.0", "version": "1.0", "description": "Sample Model" } kitfile.code = [ { "path": "demo.py", "description": "Sample model to demonstrate PyKitOps SDK", "license": "Apache 2.0" }, { "path": "requirements.txt", "description": "Python dependencies" } ] kitfile.datasets = [ { "name": "dataset", "path": "data/sample.csv", "description": "full dataset", "license": "Apache 2.0" } ] kitfile.docs = [ {"path": "docs/README.md"}, {"path": "docs/LICENSE"} ] # Push to Jozu Hub modelkit_tag = "jozu.ml/yourname/reponame:latest" manager = ModelKitManager( working_directory=".", modelkit_tag=modelkit_tag ) manager.kitfile = kitfile manager.pack_and_push_modelkit(save_kitfile=True) ``` -------------------------------- ### Install Agent Skill (Auto-discover) Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/next-steps.md Install agent skills from a ModelKit directly into supported coding agents. The --as-skill flag enables auto-discovery of installed agents on your machine. ```sh kit unpack myrepo/my-agent-kit:latest --as-skill ``` -------------------------------- ### Build Documentation Source: https://github.com/kitops-ml/kitops/blob/main/docs/README.md Generate static HTML files for the documentation by running the build command. ```sh pnpm docs:build ``` -------------------------------- ### Initialize Kitfile from Directory Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/next-steps.md Use this command to generate a Kitfile from the root of a directory containing AI project artifacts. Further details are available in the CLI documentation. ```sh kit init . ``` -------------------------------- ### ModelKit Manifest Example Source: https://github.com/kitops-ml/kitops/blob/main/pkg/artifact/spec.md Example of a ModelKit manifest containing a serialized model and Kitfile. The 'size' field is in bytes. ```JSON { "schemaVersion": 2, "config": { "mediaType": "application/vnd.jozu.model.config.v1+json", "digest": "sha256:d5815835051dd97d800a03f641ed8162877920e734d3d705b698912602b8c763", "size": 301 }, "layers": [ { "mediaType": "application/vnd.jozu.model.content.v1.tar+gzip", "digest": "sha256:3f907c1a03bf20f20355fe449e18ff3f9de2e49570ffb536f1a32f20c7179808", "size": 30327160 } ] } ``` -------------------------------- ### Kit Init Command Synopsis Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Synopsis for the 'kit init' command, used to generate a Kitfile. ```bash kit init [flags] PATH ``` -------------------------------- ### init(path?, flags?) Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/kitops-ts/api-reference.md Scans a directory for ML artifacts and generates a `Kitfile`. Automatically detects models, datasets, code, and docs by file extension. ```APIDOC ## init(path?, flags?) ### Description Scans a directory for ML artifacts and generates a `Kitfile`. Automatically detects models, datasets, code, and docs by file extension. ### Parameters #### Path Parameters - **path** (string) - Optional - Directory to scan. Defaults to `'.'`. #### Query Parameters - **flags.name** (string) - Optional - Package name to use in the generated Kitfile. - **flags.desc** (string) - Optional - Package description. - **flags.author** (string) - Optional - Package author. - **flags.force** (boolean) - Optional - Overwrite an existing Kitfile. ### Returns `CancellablePromise` ### Example ```typescript const result = await init('./my-model', { name: 'my-model', desc: 'Sentiment analysis model', author: 'ML Team', force: true, }); console.log(result.kitfilePath); ``` ``` -------------------------------- ### Kit Init Command Options Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Specific options available for the 'kit init' command, controlling Kitfile generation details. ```bash --name string Name for the ModelKit --desc string Description for the ModelKit --author string Author for the ModelKit -f, --force Overwrite existing Kitfile if present --remote Generate Kitfile from a remote HuggingFace repository --ref string Branch or tag for remote repository (requires --remote) (default "main") --token string Auth token for remote repository (requires --remote) -o, --output string Output path for generated Kitfile ('-' writes to stdout; default: Kitfile in directory for local, stdout for remote) --depth int Maximum directory depth to process when generating a Kitfile. Setting to a negative number processes all files individually -h, --help help for init ``` -------------------------------- ### Install Agent Skill for Specific Agents Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/next-steps.md Use the --as-skill flag with a comma-separated list of agent names to install skills only for specified coding agents. This provides targeted skill deployment. ```sh kit unpack myrepo/my-agent-kit:latest --as-skill=claude-code,cursor,windsurf ``` -------------------------------- ### Build Frontend for Production Source: https://github.com/kitops-ml/kitops/blob/main/CLAUDE.md Creates an optimized production build of the frontend application. ```bash pnpm build ``` -------------------------------- ### Login, Pack, and Push a ModelKit Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/kitops-ts/index.md Demonstrates the basic workflow of logging into a registry, packing a local directory into a ModelKit, and pushing it to the registry using the kitops-ts SDK. Ensure you have the necessary environment variables for registry credentials. ```typescript import { login, pack, push } from '@kitops/kitops-ts'; await login('ghcr.io', process.env.REGISTRY_USER!, process.env.REGISTRY_PASS!); await pack('.', { tag: 'ghcr.io/my-org/my-model:v1.0.0' }); await push('ghcr.io/my-org/my-model:v1.0.0'); ``` -------------------------------- ### Show Configuration for a ModelKit Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Display the configuration details for a specified modelkit, either locally or remotely. ```bash kit info [flags] MODELKIT ``` -------------------------------- ### Build Kit Init Container Image Source: https://github.com/kitops-ml/kitops/blob/main/build/dockerfiles/init/README.md Command to build the kit-init-container Docker image. Ensure you are in the directory containing the Dockerfile. ```shell docker build -t kit-init-container:latest . ``` -------------------------------- ### Kubernetes Secret Configuration Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/integrations/kubeflow.md Examples of how to create Kubernetes secrets for registry authentication and Cosign signing. ```APIDOC ## Registry Authentication ### Description Set up registry authentication by creating a Kubernetes secret with your Docker registry credentials. ### Command Examples #### Using `config.json` ```bash kubectl create secret generic docker-config \ --from-file=config.json="$HOME/.docker/config.json" \ --namespace=kubeflow ``` #### Using Docker Registry Credentials ```bash kubectl create secret docker-registry docker-config \ --docker-server=jozu.ml \ --docker-username=myuser \ --docker-password=mypassword \ --docker-email=user@example.com \ --namespace=kubeflow ``` ### Mounting Secret in Pipeline ```python kubernetes.use_secret_as_volume( component_task, secret_name='docker-config', mount_path='/home/user/.docker', ) ``` ## Cosign Signing (Optional) ### Description To sign ModelKit attestations with Cosign, first generate signing keys and create a Kubernetes secret. ### Command Examples #### Generate Keys ```bash cosign generate-key-pair ``` #### Create Secret ```bash kubectl create secret generic cosign-keys \ --from-file=cosign.key=cosign.key \ --from-file=cosign.pub=cosign.pub \ --namespace=kubeflow ``` ### Mounting Secret in Pipeline ```python kubernetes.use_secret_as_volume( component_task, secret_name='cosign-keys', mount_path='/etc/cosign', ) ``` **Note:** If cosign keys are not available, the signing step logs a warning and continues without failing the pipeline. ``` -------------------------------- ### Run Specific Package Tests Source: https://github.com/kitops-ml/kitops/blob/main/CLAUDE.md Runs tests for a specific package, for example, './pkg/cmd/pack', with verbose output. ```bash go test ./pkg/cmd/pack -v ``` -------------------------------- ### login(registry, username, password, flags?) Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/kitops-ts/api-reference.md Authenticates with a registry. The password is passed via stdin for security. ```APIDOC ## login(registry, username, password, flags?) ### Description Authenticates with a registry. The password is passed via **stdin**, keeping it out of the process list. Preferred for CI and automated workflows. ### Parameters #### Path Parameters - **registry** (string) - Required - Registry hostname (e.g. 'ghcr.io'). - **username** (string) - Required - Registry username. - **password** (string) - Required - Registry password or token. #### Query Parameters - **flags.tlsVerify** (boolean) - Optional - Verify the server's TLS certificate. ### Returns `CancellablePromise` ### Example ```typescript await login( 'registry.example.com', process.env.REGISTRY_USER!, process.env.REGISTRY_PASS!, ); ``` ``` -------------------------------- ### Navigate to Docs Directory Source: https://github.com/kitops-ml/kitops/blob/main/docs/README.md Change your current directory to the 'docs' folder within the cloned repository. ```sh cd docs ``` -------------------------------- ### List modelkits with a specific named prompt Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Example of filtering modelkits to find those containing a prompt with a specific name. ```bash # List modelkits with a specific named prompt kit list -f prompts:pdf-processing ``` -------------------------------- ### Initialize a New ModelKit Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/kitops-ts/api-reference.md Scans a directory to generate a `Kitfile` for a new ML project. You can specify package details and force overwriting an existing file. ```typescript const result = await init('./my-model', { name: 'my-model', desc: 'Sentiment analysis model', author: 'ML Team', force: true, }); console.log(result.kitfilePath); ``` -------------------------------- ### List modelkits containing a model Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Example using the filter flag to list only modelkits that contain model artifacts. ```bash # List only modelkits containing a model kit list -f model ``` -------------------------------- ### Create New Empty Kitfile Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/pykitops/how-to-guides.md Create an empty Kitfile object from scratch. The output will be an empty dictionary. ```python from kitops.modelkit.kitfile import Kitfile my_kitfile = Kitfile() print(my_kitfile.to_yaml()) ``` -------------------------------- ### Configure Kit Init Container for Fetching and Unpacking Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/integrations/k8s-init-container.md Configure the init container to use the `kitops-ml/kitops-init` image. Set the required `MODELKIT_REF` environment variable to specify the ModelKit to fetch. Optional variables like `UNPACK_PATH`, `UNPACK_FILTER`, `COSIGN_KEY`, `COSIGN_CERT_IDENTITY`, and `COSIGN_CERT_OIDC_ISSUER` can be used for customization and verification. ```yaml initContainers: - name: kitops-init image: ghcr.io/kitops-ml/kitops-init:latest env: # 1) Which ModelKit to fetch - name: MODELKIT_REF value: "jozu.ml/jozu/bert-base-uncased:safetensors" # 2) Optional: where to unpack inside the volume - name: UNPACK_PATH value: "/modelkit" # 3) Optional: only unpack specific files (Kit CLI --filter syntax) - name: UNPACK_FILTER value: "model" # 4a) Optional: verify via local Cosign key - name: COSIGN_KEY value: "/keys/cosign.pub" # 4b) Alternately Optional: keyless OIDC verification - name: COSIGN_CERT_IDENTITY value: "kitops@jozu.com" - name: COSIGN_CERT_OIDC_ISSUER value: "https://github.com/login/oauth" volumeMounts: - name: modelkit-storage mountPath: "/modelkit" # If using a mounted key secret: # volumeMounts: # - name: cosign-key # mountPath: /keys ``` -------------------------------- ### Import Core KitOps Types Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/kitops-ts/types.md Imports essential types from the '@kitops/kitops-ts' package. Ensure this package is installed and available in your project. ```typescript import type { Kitfile, ModelKit, FilterFlag, /* ... */ } from '@kitops/kitops-ts'; ``` -------------------------------- ### Load Existing Kitfile Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/pykitops/how-to-guides.md Create a Kitfile object from an existing ModelKit's Kitfile by providing the path. Use to_yaml() to print its contents. ```python from kitops.modelkit.kitfile import Kitfile my_kitfile = Kitfile(path='/path/to/Kitfile') print(my_kitfile.to_yaml()) ``` -------------------------------- ### List modelkits containing prompt layers Source: https://github.com/kitops-ml/kitops/blob/main/docs/src/docs/cli/cli-reference.md Example using the filter flag to list only modelkits that include prompt layers. ```bash # List only modelkits that contain prompt layers kit list -f prompts ```