### Run Audio Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet demonstrates executing a prompt against an audio model. The system will download and install required models and libraries on the first run. ```shell make example-audio ``` -------------------------------- ### Run Chat Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet demonstrates how to interact with the chat-completion API. The system will download and install necessary models and libraries upon the first execution. ```shell make example-chat ``` -------------------------------- ### Run Vision Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet demonstrates executing a prompt against a vision model. The system will download and install required models and libraries on the first run. ```shell make example-vision ``` -------------------------------- ### Shell Command to Run Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This command executes the Go example program for question answering. It first builds the example and then runs it, showing the output from the Kronk SDK's interaction with the model. ```shell $ make example-question go run examples/question/main.go download-libraries: check libraries version information: arch[arm64] os[darwin] processor[cpu] download-libraries: check llama.cpp installation: arch[arm64] os[darwin] processor[cpu] latest[b8189] current[b8189] download-libraries: already installed: latest[b8189] current[b8189] ``` -------------------------------- ### Install Kronk with Go Source: https://github.com/ardanlabs/kronk/blob/main/README.md Instructions for installing Kronk using the Go toolchain. This method works on any supported platform where Go is installed. ```shell $ go install github.com/ardanlabs/kronk/cmd/kronk@latest $ kronk --help ``` -------------------------------- ### Run Pool Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet shows how to use the pool package to manage multiple models in memory simultaneously. The system will download and install required models and libraries on the first run. ```shell make example-pool ``` -------------------------------- ### Run Concurrency Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet illustrates leveraging concurrency with vision models. Ensure models and libraries are downloaded before running. ```shell make example-concurrency ``` -------------------------------- ### Run Question Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet demonstrates asking a simple question using the chat-completion API. Ensure you have the necessary models and libraries downloaded. ```shell make example-question ``` -------------------------------- ### Run RAG Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet shows a complete Retrieval-Augmented Generation (RAG) application. The system will download and install required models and libraries on the first run. ```shell make example-rag ``` -------------------------------- ### Install Kronk with Homebrew Source: https://github.com/ardanlabs/kronk/blob/main/README.md Instructions for installing Kronk on macOS or Linux using Homebrew. Includes tapping the repository, installing the package, and checking the help command. ```shell $ brew tap ardanlabs/kronk $ brew install kronk $ kronk --help ``` -------------------------------- ### Run YZMA Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet shows how to use the YZMA API at its basic level. Ensure you have the necessary models and libraries downloaded. ```shell make example-yzma ``` -------------------------------- ### Run Embedding Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet shows a basic program using Kronk to perform an embedding operation. The system will download and install required models and libraries on the first run. ```shell make example-embedding ``` -------------------------------- ### Run Rerank Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet demonstrates how to use a rerank model. Ensure you have the necessary models and libraries downloaded before running. ```shell make example-rerank ``` -------------------------------- ### Run Agent Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet shows how to build and run a small coding agent using the Kronk API. Ensure you have the necessary models and libraries downloaded. ```shell make example-agent ``` -------------------------------- ### Start Kronk Model Server Source: https://github.com/ardanlabs/kronk/blob/main/README.md Command to start the Kronk model server. This server provides an API for local AI inference. ```shell $ kronk server start ``` -------------------------------- ### Go Program for Question Answering with Kronk Source: https://github.com/ardanlabs/kronk/blob/main/README.md This Go program demonstrates the full lifecycle of using the Kronk SDK for question answering. It includes installing dependencies, loading a model, and initiating a streaming chat session. Ensure the model source is correctly specified. ```go package main import ( "context" "fmt" "os" "time" "github.com/ardanlabs/kronk/sdk/kronk" "github.com/ardanlabs/kronk/sdk/kronk/model" "github.com/ardanlabs/kronk/sdk/tools/defaults" "github.com/ardanlabs/kronk/sdk/tools/libs" "github.com/ardanlabs/kronk/sdk/tools/models" ) const modelSource = "unsloth/Qwen3-0.6B-Q8_0" func main() { if err := run(); err != nil { fmt.Printf("\nERROR: %s\n", err) os.Exit(1) } } func run() error { mp, err := installSystem() if err != nil { return fmt.Errorf("unable to installation system: %w", err) } krn, err := newKronk(mp) if err != nil { return fmt.Errorf("unable to init kronk: %w", err) } defer func() { fmt.Println("\nUnloading Kronk") if err := krn.Unload(context.Background()); err != nil { fmt.Printf("failed to unload model: %v", err) } }() if err := question(krn); err != nil { fmt.Println(err) } return nil } func installSystem() (models.Path, error) { ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute) defer cancel() libs, err := libs.New( libs.WithVersion(defaults.LibVersion("")), ) if err != nil { return models.Path{}, err } if _, err := libs.Download(ctx, kronk.FmtLogger); err != nil { return models.Path{}, fmt.Errorf("unable to install llama.cpp: %w", err) } // ------------------------------------------------------------------------- mdls, err := models.New() if err != nil { return models.Path{}, fmt.Errorf("unable to init models: %w", err) } mp, err := mdls.Download(ctx, kronk.FmtLogger, modelSource) if err != nil { return models.Path{}, fmt.Errorf("unable to install model: %w", err) } return mp, nil } func newKronk(mp models.Path) (*kronk.Kronk, error) { fmt.Println("loading model...") if err := kronk.Init(); err != nil { return nil, fmt.Errorf("unable to init kronk: %w", err) } krn, err := kronk.New( model.WithModelFiles(mp.ModelFiles), ) if err != nil { return nil, fmt.Errorf("unable to create inference model: %w", err) } fmt.Print("- system info:\t") for k, v := range krn.SystemInfo() { fmt.Printf("%s:%v, ", k, v) } fmt.Println() fmt.Println("- contextWindow :", krn.ModelConfig().ContextWindow()) fmt.Printf("- k/v : %s/%s\n", krn.ModelConfig().CacheTypeK, krn.ModelConfig().CacheTypeV) fmt.Println("- flashAttention :", krn.ModelConfig().FlashAttention) fmt.Println("- nBatch :", krn.ModelConfig().NBatch()) fmt.Println("- nuBatch :", krn.ModelConfig().NUBatch()) fmt.Println("- modelType :", krn.ModelInfo().Type) fmt.Println("- isGPT :", krn.ModelInfo().IsGPTModel) fmt.Println("- template :", krn.ModelInfo().Template.FileName) fmt.Println("- grammar :", krn.ModelConfig().DefaultParams.Grammar != "") fmt.Println("- nSeqMax :", krn.ModelConfig().NSeqMax()) fmt.Println("- vramTotal :", krn.ModelInfo().VRAMTotal/(1024*1024), "MiB") fmt.Println("- slotMemory :", krn.ModelInfo().SlotMemory/(1024*1024), "MiB") fmt.Println("- modelSize :", krn.ModelInfo().Size/(1000*1000), "MB") fmt.Println("- imc :", krn.ModelConfig().IncrementalCache()) if n := krn.ModelConfig().PtrNGpuLayers; n != nil { fmt.Println("- nGPULayers :", *n) } else { fmt.Println("- nGPULayers : all") } return krn, nil } func question(krn *kronk.Kronk) error { ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) defer cancel() question := "Hello model" fmt.Println() fmt.Println("QUESTION:", question) fmt.Println() d := model.D{ "messages": model.DocumentArray( model.TextMessage(model.RoleUser, question), ), "temperature": 0.7, "top_p": 0.9, "top_k": 40, "max_tokens": 2048, } ch, err := krn.ChatStreaming(ctx, d) if err != nil { return fmt.Errorf("chat streaming: %w", err) } // ------------------------------------------------------------------------- var reasoning bool for resp := range ch { switch resp.Choices[0].FinishReason() { case model.FinishReasonError: return fmt.Errorf("error from model: %s", resp.Choices[0].Delta.Content) case model.FinishReasonStop: return nil default: if resp.Choices[0].Delta.Reasoning != "" { reasoning = true fmt.Printf("\u001b[91m%s\u001b[0m", resp.Choices[0].Delta.Reasoning) continue } if reasoning { reasoning = false fmt.Println() continue } fmt.Printf("%s", resp.Choices[0].Delta.Content) } } return nil } ``` -------------------------------- ### Run Grammar Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet demonstrates how to use GBNF grammars to constrain model output. Ensure you have the necessary models and libraries downloaded. ```shell make example-grammar ``` -------------------------------- ### Run Bucky Audio Transcription Example Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet shows how to transcribe an audio file using the Bucky SDK, which utilizes whisper.cpp. Refer to the Bucky manual chapter for a full subsystem reference. ```shell make example-bucky ``` -------------------------------- ### Upgrade Kronk with Homebrew Source: https://github.com/ardanlabs/kronk/blob/main/README.md Command to upgrade an existing Kronk installation managed by Homebrew to the latest version. ```shell $ brew upgrade kronk ``` -------------------------------- ### Download and Load Model Source: https://github.com/ardanlabs/kronk/blob/main/README.md This snippet shows the commands to download a model from a URL and then load it. It includes checks for existing models and displays system information after loading. ```bash download-model: model-url[https://huggingface.co/unsloth/Qwen3-0.6B-GGUF/resolve/main/Qwen3-0.6B-Q8_0.gguf] proj-url[] model-id[Qwen3-0.6B-Q8_0]: download-model: waiting to check model status... download-model: model already exists: loading model... - system info: ACCELERATE:on, REPACK:on, MTL:EMBED_LIBRARY, CPU:NEON, ARM_FMA:on, FP16_VA:on, DOTPROD:on, LLAMAFILE:on, - contextWindow: 8196 - k/v : q8_0/q8_0 - nBatch : 2048 - nuBatch : 512 - modelType : dense - isGPT : false - template : tokenizer.chat_template ``` -------------------------------- ### Build and Run Kronk Server and Website Source: https://github.com/ardanlabs/kronk/blob/main/README.md Commands to build the Kronk server and generate the project website. These are typically run from the project's root directory. ```shell $ make kronk-server $ make website ``` -------------------------------- ### Run Kronk Server with CPU Inference Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md Use this command to run the Kronk server with CPU inference. Models download automatically on first use. ```bash docker run --rm -p 11435:11435 -v kronk-data:/kronk ghcr.io/ardanlabs/kronk:latest ``` -------------------------------- ### Run Kronk Server with NVIDIA GPU Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md Run the Kronk server with NVIDIA GPU acceleration. Requires NVIDIA Container Toolkit. ```bash docker run --rm --gpus all -p 11435:11435 -v kronk-data:/kronk ghcr.io/ardanlabs/kronk:latest ``` -------------------------------- ### Run Kronk Server with Specific NVIDIA GPUs by Index Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md Run the Kronk server, specifying which NVIDIA GPUs to use by their index. ```bash docker run --rm --gpus "device=0,1" -p 11435:11435 -v kronk-data:/kronk ghcr.io/ardanlabs/kronk:latest ``` -------------------------------- ### Run Kronk Server with Specific NVIDIA GPUs by UUID Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md Run the Kronk server, specifying which NVIDIA GPUs to use by their UUIDs. ```bash docker run --rm --gpus "device=GPU-3a1f...,GPU-9b2e..." -p 11435:11435 -v kronk-data:/kronk ghcr.io/ardanlabs/kronk:latest ``` -------------------------------- ### Run Kronk with Vulkan (AMD, Intel, NVIDIA) Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md This command runs the Kronk container with Vulkan support, requiring Mesa Vulkan drivers. It maps the necessary devices and ports, and mounts a volume for persistence. ```bash docker run --rm --device=/dev/dri --group-add video --group-add render \ -p 11435:11435 -v kronk-data:/kronk \ ghcr.io/ardanlabs/kronk:vulkan ``` -------------------------------- ### Run Kronk Server with AMD GPU (ROCm) Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md Run the Kronk server with AMD GPU acceleration using ROCm. Requires specific device access and group memberships. ```bash docker run --rm \ --device=/dev/kfd --device=/dev/dri \ --group-add video --group-add render \ --security-opt seccomp=unconfined \ -p 11435:11435 -v kronk-data:/kronk \ ghcr.io/ardanlabs/kronk:rocm ``` -------------------------------- ### Check Kronk Server Liveness Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md Verify that the Kronk server is running by sending a liveness check request. ```bash curl http://localhost:11435/v1/liveness ``` -------------------------------- ### Run BenchmarkHybrid_IMC Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-05-20.txt Executes the BenchmarkHybrid_IMC benchmark. This command tests the performance of the Hybrid model with in-memory caching. ```bash go test -run=none -bench=BenchmarkHybrid_IMC -benchtime=3x -timeout=30m ./sdk/kronk/tests/benchmarks/ ``` -------------------------------- ### Run BenchmarkDense_IMC Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-05-20.txt Executes the BenchmarkDense_IMC benchmark. This command is used to test the performance of the Dense model with in-memory caching. ```bash go test -run=none -bench=BenchmarkDense_IMC -benchtime=3x -timeout=30m ./sdk/kronk/tests/benchmarks/ ``` -------------------------------- ### Run BenchmarkDense_IMC Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Command to run the BenchmarkDense_IMC test. This benchmark tests the in-memory caching dense model. ```bash go test -run=none -bench=BenchmarkDense_IMC$ -benchtime=3x -timeout=30m ./sdk/kronk/tests/benchmarks/ ``` -------------------------------- ### Run Kronk with Vulkan on NVIDIA GPUs Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md This command enables Vulkan support on NVIDIA GPUs by utilizing the NVIDIA Container Toolkit. It exposes all GPUs and specifies driver capabilities. ```bash docker run --rm --gpus all \ -e NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics \ -p 11435:11435 -v kronk-data:/kronk \ ghcr.io/ardanlabs/kronk:vulkan ``` -------------------------------- ### Verify Vulkan Devices Inside Container Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md This command executes `vulkaninfo --summary` inside a running Kronk container to verify Vulkan device detection. ```bash docker exec -it vulkaninfo --summary ``` -------------------------------- ### Run BenchmarkMoE_IMC Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-05-20.txt Executes the BenchmarkMoE_IMC benchmark. This command tests the performance of the Mixture of Experts (MoE) model with in-memory caching. ```bash go test -run=none -bench=BenchmarkMoE_IMC -benchtime=3x -timeout=30m ./sdk/kronk/tests/benchmarks/ ``` -------------------------------- ### Run BenchmarkDense_NonCaching Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Command to run the BenchmarkDense_NonCaching test. This benchmark tests the non-caching dense model. ```bash go test -run=none -bench=BenchmarkDense_NonCaching -benchtime=3x -timeout=30m ./sdk/kronk/tests/benchmarks/ ``` -------------------------------- ### Run Kronk with Vulkan and Multi-GPU Selection Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md This command allows selecting a specific GPU for Vulkan by setting the MESA_VK_DEVICE_SELECT environment variable with the PCI ID. ```bash # Select by PCI ID (format: :) # 1002 = AMD, 8086 = Intel, 10de = NVIDIA docker run --rm --device=/dev/dri --group-add video --group-add render \ -e MESA_VK_DEVICE_SELECT='1002:744c' \ -p 11435:11435 -v kronk-data:/kronk \ ghcr.io/ardanlabs/kronk:vulkan ``` -------------------------------- ### Run BenchmarkMoE_IMC Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Command to run the BenchmarkMoE_IMC test. This benchmark tests the in-memory caching Mixture of Experts model. ```bash go test -run=none -bench=BenchmarkMoE_IMC$ -benchtime=3x -timeout=30m ./sdk/kronk/tests/benchmarks/ ``` -------------------------------- ### Run BenchmarkHybrid_NonCaching Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Command to run the BenchmarkHybrid_NonCaching test. This benchmark tests the non-caching hybrid model. ```bash go test -run=none -bench=BenchmarkHybrid_NonCaching -benchtime=3x -timeout=30m ./sdk/kronk/tests/benchmarks/ ``` -------------------------------- ### Run BenchmarkHybrid_IMC Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Command to run the BenchmarkHybrid_IMC test. This benchmark tests the in-memory caching hybrid model. ```bash go test -run=none -bench=BenchmarkHybrid_IMC$ -benchtime=3x -timeout=30m ./sdk/kronk/tests/benchmarks/ ``` -------------------------------- ### ParamTooltip for One-Off Explanations Source: https://github.com/ardanlabs/kronk/blob/main/cmd/server/api/frontends/bui/src/components/AGENTS.md Use ParamTooltip with the text prop for custom, one-off tooltip explanations that do not belong in the shared registry. ```tsx ``` -------------------------------- ### Run Kronk on NVIDIA Jetson (Orin/Xavier) Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md This command runs the Kronk container on NVIDIA Jetson devices, requiring JetPack 6+ and the nvidia-container-runtime. It exposes necessary driver capabilities. ```bash docker run --rm --runtime nvidia \ -e NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics \ -p 11435:11435 -v kronk-data:/kronk \ ghcr.io/ardanlabs/kronk:jetson ``` -------------------------------- ### BenchmarkMoE_NonCaching Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-05-20.txt Presents the performance metrics for BenchmarkMoE_NonCaching, showing the efficiency of the MoE architecture. ```text BenchmarkMoE_NonCaching-18 3 105772311917 ns/op 13935 avg-prompt-tok 9283 lastT-ttft-ms 88.89 tok/s 104448 total-ms 6243 ttft-ms 8609504 B/op 69016 allocs/op ``` -------------------------------- ### Run BenchmarkMoE_NonCaching Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Command to run the BenchmarkMoE_NonCaching test. This benchmark tests the non-caching Mixture of Experts model. ```bash go test -run=none -bench=BenchmarkMoE_NonCaching -benchtime=3x -timeout=30m ./sdk/kronk/tests/benchmarks/ ``` -------------------------------- ### Sample User-AI Conversation Source: https://github.com/ardanlabs/kronk/blob/main/README.md Illustrates a simple conversational exchange where a user asks a question and the AI provides a friendly and helpful response. ```text QUESTION: Hello model Okay, the user just said "Hello model." I need to respond appropriately. Since I'm an AI assistant, my initial response is friendly and helpful. Let me start by acknowledging their greeting. I should make sure to use a friendly tone and offer assistance. Maybe add something about being here to help with anything they need. Keep it simple and conversational. Let me check if there's any additional context needed, but since they just said hello, a basic reply should suffice. ! How can I assist you today? 😊 Unloading Kronk ``` -------------------------------- ### BenchmarkHybrid_IMC Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-05-20.txt Displays the performance metrics for BenchmarkHybrid_IMC, illustrating the benefits of in-memory caching for the Hybrid model. ```text BenchmarkHybrid_IMC-18 3 23209232764 ns/op 13597 avg-prompt-tok 579.0 lastT-ttft-ms 70.33 tok/s 23579 total-ms 661.9 ttft-ms 471620765 B/op 51219 allocs/op ``` -------------------------------- ### BenchmarkDense_IMC Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-05-20.txt Displays the performance metrics for BenchmarkDense_IMC, highlighting improvements due to in-memory caching. ```text BenchmarkDense_IMC-18 3 11834920611 ns/op 13189 avg-prompt-tok 563.0 lastT-ttft-ms 181.6 tok/s 12023 total-ms 449.1 ttft-ms 2608010026 B/op 49414 allocs/op ``` -------------------------------- ### BenchmarkHybrid_NonCaching Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-05-20.txt Presents the performance metrics for BenchmarkHybrid_NonCaching, showcasing the efficiency of the Hybrid model. ```text BenchmarkHybrid_NonCaching-18 3 90281838681 ns/op 13592 avg-prompt-tok 7841 lastT-ttft-ms 72.04 tok/s 92457 total-ms 5275 ttft-ms 8942952 B/op 47393 allocs/op ``` -------------------------------- ### BenchmarkMoE_IMC Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Performance metrics for BenchmarkMoE_IMC. Shows operations per second, token throughput, and latency. ```text BenchmarkMoE_IMC-18 3 27567692833 ns/op 13941 avg-prompt-tok 1041 lastT-ttft-ms 80.76 tok/s 27236 total-ms 1023 ttft-ms 46779733146 B/op 72177 allocs/op ``` -------------------------------- ### Verify CUDA Detection on Jetson Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md This command runs `nvidia-smi` within the Kronk Jetson container to verify CUDA detection and driver status. ```bash docker run --rm --runtime nvidia \ --entrypoint nvidia-smi \ ghcr.io/ardanlabs/kronk:jetson ``` -------------------------------- ### Set Kronk Library Version Source: https://github.com/ardanlabs/kronk/blob/main/README.md Environment variable to specify a compatible version of the llama.cpp library for Kronk. This is useful when dealing with breaking changes in llama.cpp. ```shell export KRONK_LIB_VERSION=b9163 ``` -------------------------------- ### BenchmarkDense_NonCaching Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-05-20.txt Displays the performance metrics for BenchmarkDense_NonCaching, including operations per second, average prompt tokens, and memory allocations. ```text BenchmarkDense_NonCaching-18 3 46945175292 ns/op 13185 avg-prompt-tok 4628 lastT-ttft-ms 188.8 tok/s 47655 total-ms 2838 ttft-ms 14678621 B/op 45920 allocs/op ``` -------------------------------- ### Verify Docker Hub Image Signature Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md Use this command to verify signatures for images published on Docker Hub. It requires setting the COSIGN_REPOSITORY environment variable to point to the sibling signatures repository. ```bash COSIGN_REPOSITORY=ardanlabs/kronk-signatures \ cosign verify ardanlabs/kronk:latest \ --certificate-identity-regexp \ 'https://github.com/ardanlabs/kronk/.github/workflows/docker.yml@.*' \ --certificate-oidc-issuer https://token.actions.githubusercontent.com ``` -------------------------------- ### BenchmarkDense_IMC Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Performance metrics for BenchmarkDense_IMC. Shows operations per second, token throughput, and latency. ```text BenchmarkDense_IMC-18 3 12729809986 ns/op 13179 avg-prompt-tok 606.0 lastT-ttft-ms 180.0 tok/s 12576 total-ms 488.4 ttft-ms 22532774578 B/op 50833 allocs/op ``` -------------------------------- ### BenchmarkHybrid_IMC Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Performance metrics for BenchmarkHybrid_IMC. Shows operations per second, token throughput, and latency. ```text BenchmarkHybrid_IMC-18 3 26467337750 ns/op 13597 avg-prompt-tok 641.0 lastT-ttft-ms 61.59 tok/s 26474 total-ms 725.8 ttft-ms 5150030317 B/op 51617 allocs/op ``` -------------------------------- ### BenchmarkMoE_IMC Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-05-20.txt Displays the performance metrics for BenchmarkMoE_IMC, indicating the impact of in-memory caching on the MoE model. ```text BenchmarkMoE_IMC-18 3 23896815000 ns/op 13941 avg-prompt-tok 863.0 lastT-ttft-ms 90.54 tok/s 23476 total-ms 858.2 ttft-ms 5429249586 B/op 71679 allocs/op ``` -------------------------------- ### ParamTooltip for Dynamic Labels Source: https://github.com/ardanlabs/kronk/blob/main/cmd/server/api/frontends/bui/src/components/AGENTS.md Use ParamTooltip with the tooltipKey prop for dynamic labels within loops where the key is a variable. Ensure the key is cast to TooltipKey. ```tsx ``` -------------------------------- ### BenchmarkMoE_NonCaching Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Performance metrics for BenchmarkMoE_NonCaching. Shows operations per second, token throughput, and latency. ```text BenchmarkMoE_NonCaching-18 3 118138395194 ns/op 13935 avg-prompt-tok 11218 lastT-ttft-ms 82.74 tok/s 121863 total-ms 7351 ttft-ms 8681885 B/op 69421 allocs/op ``` -------------------------------- ### BenchmarkDense_NonCaching Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Performance metrics for BenchmarkDense_NonCaching. Shows operations per second, token throughput, and latency. ```text BenchmarkDense_NonCaching-18 3 46505497625 ns/op 13175 avg-prompt-tok 5280 lastT-ttft-ms 181.4 tok/s 49455 total-ms 2944 ttft-ms 15410741 B/op 47344 allocs/op ``` -------------------------------- ### Pull Whisper Model for Audio Transcription Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md This command is executed inside a running Kronk container to download a specific Whisper model (e.g., 'tiny.en') for audio transcription. ```bash docker exec -it kronk bucky model pull tiny.en ``` -------------------------------- ### BenchmarkHybrid_NonCaching Results Source: https://github.com/ardanlabs/kronk/blob/main/sdk/kronk/tests/benchmarks/runs/2026-04-26.txt Performance metrics for BenchmarkHybrid_NonCaching. Shows operations per second, token throughput, and latency. ```text BenchmarkHybrid_NonCaching-18 3 103946375639 ns/op 13592 avg-prompt-tok 8876 lastT-ttft-ms 62.26 tok/s 106804 total-ms 6092 ttft-ms 8984472 B/op 47756 allocs/op ``` -------------------------------- ### Transcribe Audio File via Kronk API Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md This command uses `curl` to send a POST request to the Kronk API for audio transcription. It uploads a local WAV file and specifies the Whisper model and desired response format. ```bash curl -X POST http://localhost:11435/v1/audio/transcriptions \ -F file=@samples/jfk.wav \ -F model=tiny.en \ -F response_format=json ``` -------------------------------- ### labelWithTip for Table Rows Source: https://github.com/ardanlabs/kronk/blob/main/cmd/server/api/frontends/bui/src/components/AGENTS.md Use the labelWithTip function for creating labels in table rows (e.g., KeyValueTable, KVRow) that require a tooltip. ```tsx labelWithTip('Label Text', 'tooltipKey') ``` -------------------------------- ### MCP Service Configuration Source: https://github.com/ardanlabs/kronk/blob/main/AGENTS.md Configuration settings for the MCP service, specifying its type, URL, and available APIs. Use this to define how Kronk interacts with external services. ```json "mcp": { "Kronk": { "type": "remote", "url": "http://localhost:9000/mcp", "type": "streamableHttp", "apis": [ { "api": "web_search", "desc": "Performs a web search for the given query. Returns a list of relevant web pages with titles, URLs, and descriptions. Use this for general information gathering, research, and finding specific web resources." } ] } } ``` -------------------------------- ### Verify GHCR Image Signature Source: https://github.com/ardanlabs/kronk/blob/main/DockerHub.md This command verifies signatures for images hosted on GHCR. Since signatures are co-located with the images, the COSIGN_REPOSITORY variable is not needed. ```bash cosign verify ghcr.io/ardanlabs/kronk:latest \ --certificate-identity-regexp \ 'https://github.com/ardanlabs/kronk/.github/workflows/docker.yml@.*' \ --certificate-oidc-issuer https://token.actions.githubusercontent.com ``` -------------------------------- ### Tic-Tac-Toe Game in Go Source: https://github.com/ardanlabs/kronk/blob/main/examples/talks/tictactoe/talk.md A two-player terminal-based tic-tac-toe game implemented in a single Go file using only the standard library. It handles game logic, scoring, input validation, and screen clearing with ANSI color codes. ```go package main import ( "bufio" "fmt" "os" "os/exec" "strconv" "strings" "unicode" ) const ( reset = "\033[0m" red = "\033[31m" green = "\033[32m" yellow = "\033[33m" blue = "\033[34m" bold = "\033[1m" ) var scores = map[string]int{ "X": 0, "O": 0, "D": 0, } type Board [9]rune func main() { for { board := Board{{'1', '2', '3'}, {'4', '5', '6'}, {'7', '8', '9'}} currentPlayer := 'X' for { clearScreen() printBoard(&board) printScore() var move int var err error if currentPlayer == 'X' { move = playerX(&board) } else { move = playerO(&board) } if board[move-1] != 'X' && board[move-1] != 'O' { board[move-1] = rune(currentPlayer) if checkWin(&board, rune(currentPlayer)) { clearScreen() printBoard(&board) printScore() fmt.Printf("%sPlayer %c wins!%s\n", green, currentPlayer, reset) if currentPlayer == 'X' { scores["X"]++ } else { scores["O"]++ } break } if isBoardFull(&board) { clearScreen() printBoard(&board) printScore() fmt.Printf("%sIt's a draw!%s\n", yellow, reset) scores["D"]++ break } if currentPlayer == 'X' { currentPlayer = 'O' } else { currentPlayer = 'X' } } else { fmt.Printf("%sInvalid move. Cell %d is already taken. Press Enter to continue...%s", red, move, reset) readInput() } } fmt.Print("Play again? (y/n): ") input := readInput() if strings.ToLower(input) != "y" { break } } } func playerX(b *Board) int { for { fmt.Printf("%sPlayer X's turn. Enter a number (1-9): %s", green, reset) input := readInput() move, err := strconv.Atoi(input) if err != nil || move < 1 || move > 9 { fmt.Printf("%sInvalid input. Please enter a number between 1 and 9.%s\n", red, reset) continue } if b[move-1] == 'X' || b[move-1] == 'O' { fmt.Printf("%sInvalid move. Cell %d is already taken.%s\n", red, move, reset) continue } return move } } func playerO(b *Board) int { for { fmt.Printf("%sPlayer O's turn. Enter a number (1-9): %s", blue, reset) input := readInput() move, err := strconv.Atoi(input) if err != nil || move < 1 || move > 9 { fmt.Printf("%sInvalid input. Please enter a number between 1 and 9.%s\n", red, reset) continue } if b[move-1] == 'X' || b[move-1] == 'O' { fmt.Printf("%sInvalid move. Cell %d is already taken.%s\n", red, move, reset) continue } return move } } func printBoard(b *Board) { fmt.Printf("\n%s %c | %c | %c%s\n", green, b[0], b[1], b[2], reset) fmt.Printf("%s----------%s\n", green, reset) fmt.Printf("%s %c | %c | %c%s\n", green, b[3], b[4], b[5], reset) fmt.Printf("%s----------%s\n", green, reset) fmt.Printf("%s %c | %c | %c%s\n\n", green, b[6], b[7], b[8], reset) } func printScore() { fmt.Printf("Score: X: %d | O: %d | Draws: %d\n", scores["X"], scores["O"], scores["D"]) } func checkWin(b *Board, player rune) bool { // Check rows if (b[0] == player && b[1] == player && b[2] == player) || (b[3] == player && b[4] == player && b[5] == player) || (b[6] == player && b[7] == player && b[8] == player) { return true } // Check columns if (b[0] == player && b[3] == player && b[6] == player) || (b[1] == player && b[4] == player && b[7] == player) || (b[2] == player && b[5] == player && b[8] == player) { return true } // Check diagonals if (b[0] == player && b[4] == player && b[8] == player) || (b[2] == player && b[4] == player && b[6] == player) { return true } return false } func isBoardFull(b *Board) bool { for _, cell := range b { if cell != 'X' && cell != 'O' { return false } } return true } func clearScreen() { if runtime.GOOS == "windows" { cmd := exec.Command("cmd", "/c", "cls") cmd.Stdout = os.Stdout cmd.Run() } else { cmd := exec.Command("clear") cmd.Stdout = os.Stdout cmd.Run() } fmt.Print("\033[H") // Move cursor to top-left corner } func readInput() string { reader := bufio.NewReader(os.Stdin) input, _ := reader.ReadString('\n') return strings.TrimSpace(input) } func isNumeric(s string) bool { for _, r := range s { if !unicode.IsDigit(r) { return false } } return true } ``` -------------------------------- ### Banned Verbose Tooltip Pattern Source: https://github.com/ardanlabs/kronk/blob/main/cmd/server/api/frontends/bui/src/components/AGENTS.md This pattern is banned and should not be used. Always prefer the dedicated FieldLabel or labelWithTip APIs. ```tsx // ❌ DO NOT DO THIS {PARAM_TOOLTIPS.xxx && } ``` -------------------------------- ### FieldLabel with Trailing Badge Source: https://github.com/ardanlabs/kronk/blob/main/cmd/server/api/frontends/bui/src/components/AGENTS.md Use FieldLabel with the 'after' prop to display a label alongside a trailing badge or indicator, such as a status dot. ```tsx ●}>Label ``` -------------------------------- ### FieldLabel for Form Labels Source: https://github.com/ardanlabs/kronk/blob/main/cmd/server/api/frontends/bui/src/components/AGENTS.md Use FieldLabel for standard form elements like inputs, selects, and checkboxes to associate a label with a tooltip. ```tsx Label Text ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.