Android API apparently does not provide any particular APIs to reliably distinguish phones from tablets. See https://stackoverflow.com/questions/9279111/determine-if-the-device-is-a-smartphone-or-tablet
If you still would like to use the screen diagonal size to determine the device type, like it is mentioned in one of the responses above, then the output of https://github.com/appium/appium-uiautomator2-driver#mobile-deviceinfo might be useful.