Is the model there?
Not every device can run Apple's on-device model. In Swift, SystemLanguageModel.default.availability is either available, or unavailable for a reason:
- the device is not eligible, so the feature never works there;
- Apple Intelligence is not enabled, so the user can turn it on in Settings;
- the model is not ready yet, usually still downloading, so trying later helps.
Each reason needs a different answer in the interface, and every feature built on the model needs a fallback that works without it. Here the states are strings, and the model is any Python function.
def first_sentence(text):
text = text.strip()
end = text.find(". ")
if end == -1:
return text
return text[:end + 1]
print(first_sentence(
"Rain today. Sun tomorrow."))A model call can also fail after the check said yes, so the fallback covers errors too.
Your task
Write plan(status) mapping "available" to "use model", "device not eligible" to "fallback", "apple intelligence not enabled" to "ask to enable", "model not ready" to "retry later", and anything else to "fallback". Write summarize(text, status, model): return model(text) when the plan is "use model" and the call does not raise, otherwise first_sentence(text).
The explanation opens here once every check passes.