@@ -422,22 +422,22 @@ def match_json_with_reason(
422422 ) -> "MatchResult" :
423423 from ..match_result import ErrorType , MatchResult
424424
425- # Check library availability
426- if not cls .check_lib ():
427- return MatchResult .failure (
428- reason = "MLX library (mlx_lm) is not installed" ,
429- error_type = ErrorType .DEPENDENCY_MISSING ,
430- technical_details = "mlx_lm package not found in Python environment" ,
431- )
432-
433- # Check platform compatibility - MLX only works on Apple Silicon
425+ # Check platform compatibility first - MLX only works on Apple Silicon
434426 if sys .platform != "darwin" or platform .processor () != "arm" :
435427 return MatchResult .failure (
436428 reason = "MLX engine only works on Apple Silicon Macs (macOS with ARM processor)" ,
437429 error_type = ErrorType .OS_REQUIREMENT ,
438430 technical_details = f"Current platform: { sys .platform } , processor: { platform .processor ()} , required: darwin + arm" ,
439431 )
440432
433+ # Check library availability (only if platform is compatible)
434+ if not cls .check_lib ():
435+ return MatchResult .failure (
436+ reason = "MLX library (mlx_lm) is not installed" ,
437+ error_type = ErrorType .DEPENDENCY_MISSING ,
438+ technical_details = "mlx_lm package not found in Python environment" ,
439+ )
440+
441441 # Check model format compatibility
442442 if llm_spec .model_format not in ["mlx" ]:
443443 return MatchResult .failure (
@@ -867,22 +867,22 @@ def match_json_with_reason(
867867 ) -> "MatchResult" :
868868 from ..match_result import ErrorType , MatchResult
869869
870- # Check library availability first - MLX Vision uses mlx_vlm
871- if not cls .check_lib ():
872- return MatchResult .failure (
873- reason = "MLX Vision library (mlx_vlm) is not installed" ,
874- error_type = ErrorType .DEPENDENCY_MISSING ,
875- technical_details = "mlx_vlm package not found in Python environment" ,
876- )
877-
878- # Check platform compatibility
870+ # Check platform compatibility first - MLX only works on Apple Silicon
879871 if sys .platform != "darwin" or platform .processor () != "arm" :
880872 return MatchResult .failure (
881873 reason = "MLX Vision engine only works on Apple Silicon Macs (macOS with ARM processor)" ,
882874 error_type = ErrorType .OS_REQUIREMENT ,
883875 technical_details = f"Current platform: { sys .platform } , processor: { platform .processor ()} , required: darwin + arm" ,
884876 )
885877
878+ # Check library availability (only if platform is compatible) - MLX Vision uses mlx_vlm
879+ if not cls .check_lib ():
880+ return MatchResult .failure (
881+ reason = "MLX Vision library (mlx_vlm) is not installed" ,
882+ error_type = ErrorType .DEPENDENCY_MISSING ,
883+ technical_details = "mlx_vlm package not found in Python environment" ,
884+ )
885+
886886 # Check model format compatibility
887887 if llm_spec .model_format not in ["mlx" ]:
888888 return MatchResult .failure (
0 commit comments