fix(mlxlm): check if output_type is None instead of truthiness - #1987
Open
Aryan-Pardeshi wants to merge 2 commits into
Open
fix(mlxlm): check if output_type is None instead of truthiness#1987Aryan-Pardeshi wants to merge 2 commits into
Aryan-Pardeshi wants to merge 2 commits into
Conversation
RobinPicard
requested changes
Aug 12, 2026
Contributor
There was a problem hiding this comment.
Thanks, the fix itself looks good as it makes mlxlm consistent with the other adapters, so happy to merge it.
Could you remove the two added tests though? A falsy processor cannot actually occur here: everything that reaches format_output_type is either None or a logits processor instance that defines neither __bool__ nor __len__, so the FalsyProcessor case is synthetic. I'd rather keep the test suite focused on cases that can happen in practice.
Per review: format_output_type only ever receives None or a real logits processor instance (defines neither __bool__ nor __len__), so a falsy non-None processor can't occur in practice.
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.
Fixes #1980
Context
In \src/outlines/models/mlxlm.py, \ormat_output_type\ previously checked \if not output_type:. This causes issue #1980 when an \output_type\ object evaluates to \False\ in boolean context (e.g., custom processors/callables with _bool_\ returning \False).
Changes