Conversation
added 6 commits
March 22, 2026 23:10
- Add stop sequences (stop parameter, text trimming) - Add /v1/completions text completion endpoint (streaming + non-streaming) - Accurate token counting via lmInput.text.tokens.size (replaces chars÷4) - Add seed parameter for deterministic generation (MLXRandom.seed) - Add stream_options.include_usage for streaming token stats - Add CORS support via --cors CLI flag with CORSMiddleware - Extract handler closures into standalone functions (Swift type-checker fix) - Add ServerConfig struct for CLI defaults bundling - Expand test suite: 6 → 13 test sections (32 assertions total) All 32 tests pass.
…ra sampling params
- Add response_format: { type: 'json_object' } with prompt injection + fence stripping
- Add --vision CLI flag for VLM model loading via VLMModelFactory
- Parse OpenAI multipart content (string or [{type:'text',...},{type:'image_url',...}])
- Decode base64 data URIs and HTTP URLs into UserInput.Image for VLM inference
- Accept top_k, frequency_penalty, presence_penalty (API compat)
- Add MLXVLM package dependency
- Add 4 new regression tests (Tests 14-17), total: 38 assertions
All 38 tests pass.
…utdown, stats - Add --mem-limit CLI flag (sets Memory.memoryLimit + Memory.cacheLimit) - Add ServerStats actor tracking requests, tokens, generation timing - Enhanced /health endpoint with GPU memory (active/peak/cache/total), architecture, request/token stats - Add /metrics Prometheus-compatible endpoint (8 metrics with TYPE/HELP) - Add SIGTERM/SIGINT graceful shutdown handlers - Wire stats tracking into all 6 handler functions - Add 3 new regression tests (Tests 18-20), total: 49 assertions All 49 tests pass.
- Add --api-key CLI option for bearer token authentication - ApiKeyMiddleware validates Authorization: Bearer <key> header - Health and metrics endpoints exempt from auth (monitoring tools) - Returns 401 with OpenAI-style error JSON for invalid/missing keys - Config line shows auth=enabled/disabled - Add Test 21: 5 auth assertions (unauthenticated, wrong key, valid key, health exempt, metrics exempt) All 54 tests pass.
- Add PromptCache actor (saves/restores KV cache state per-layer) - Cache keyed by system prompt text hash - On cache hit: restore KV state, skip cached prefix tokens, process only new tokens - On cache miss: generate normally, save system prompt KV state asynchronously - Health/metrics endpoints exempt from cache - Uses container.perform() for direct model access with cache-aware generation All 54 tests pass.
The Metal shader library is required at runtime by MLX Swift. Install via: python3 -m venv + pip install mlx + copy metallib. Also trigger CI on feature/* branches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.