Repository navigation
fix: resolve wire-format regressions in typed API response structs - #1
Merged
hankbobtheresearchoor merged 1 commit intoMay 18, 2026
Conversation
ethenotethan
approved these changes
May 18, 2026
hankbobtheresearchoor
merged commit May 18, 2026
3130fc5
into
hankbobtheresearchoor:fix/typed-api-responses
hankbobtheresearchoor
pushed a commit
that referenced
this pull request
May 24, 2026
…ayr-Labs#206) mlx-swift: 49d73abc -> 5202134c (+4 commits) - Expose Cmlx product + enable jaccl distributed backend (PR #2) - ParallelFileReader batch_size 32 MiB -> 128 MiB (PR #1) mlx-swift-lm: 8d1cbcd8 -> d164323f (+38 commits) - PR Layr-Labs#7: omlx-continuous-batching (BatchedEngine, vLLM-inspired scheduler) - PR Layr-Labs#10: MTP speculative decoding (Qwen3.5, Gemma 4, DeepSeek-V4) - PR Layr-Labs#19: parallel stacked shard loading - PR Layr-Labs#20: Gemma 4 chat templates + tool calls fix API surface used by provider-swift (ModelContainer, LLMModelFactory, BatchGenerator, GenerationBatchResponse, RowSampler, makeRowSampler, LanguageModel, Tokenizer, BatchKVCache, Generation, GenerateStopReason, UserInput, GenerateParameters) is unchanged. All new work in mlx-swift-lm is additive (MTP, DeepSeek-V4, BatchedEngine, parallel shard loading). Notes on the dependency graph: - mlx-swift-lm main switched its mlx-swift dep from path to URL (Layr-Labs/mlx-swift#main). SPM identity resolution gives root-package path deps priority, so libs/mlx-swift remains the source of truth (verified via swift package show-dependencies). - mlx-swift-lm main added hummingbird >= 2.0.0 and swift-transformers >= 1.3.2 for its new mlx-server target. Both compatible with provider-swift's existing pins (hummingbird exact 2.22.0, swift-transformers from 1.3.0). Verification: - swift build: clean (only pre-existing MLX.GPU.* -> Memory.* deprecation warnings; deprecations existed at 49d73abc as well). - swift test: 207 tests / 18 suites pass in 3.1s. Live MLX tests (DARKBLOOM_LIVE_MLX_TESTS=1) still need to be exercised against prod models before merge -- recommended: ContinuousBatchingLiveTests on Qwen3 and a Gemma 4 end-to-end run (chat template + tool-call behavior changed in PR Layr-Labs#20). Behavioral note: GenerationBatch.step() now auto-activates an MTP fast path for MTPCapable models at batchSize == 1. No production catalog model implements MTPCapable today, so prod impact is none.
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.
Review fixes for Layr-Labs#166. Merge this into your branch before the main PR is merged.
Changes
Wire-format fixes (breaking regressions)
omitemptyfromResponsesUsageDetailfields —cached_tokensandreasoning_tokenswere silently dropped when zero-valued. The OpenAI API always includes these.incomplete_detailsserialization — was omitted entirely instead of emittingnull. Changed type fromanywithomitemptyto*ResponsesIncompleteDetailwithoutomitempty.Usagefield asResponsesUsage— wasany, defeating the purpose of the typed struct refactor.Error handling
json.Marshal/json.Unmarshalerrors in the Responses API conversion path — previously both errors were silently discarded. Now logs a warning and returns 502 on failure.Quality
handleNonStreamingResponseWithFirstChunkdoc comment.TestChatCompletionToResponsesnow marshals the result to JSON and verifiesincomplete_details,cached_tokens, andreasoning_tokensare present.Test results
go vet ./api/...— cleango test ./api/— all pass