ModelManager received unentitled request. Expected entitlement com.apple.modelmanager.inference

Just tried to write a very simple test of using foundation models, but it gave me the error like this "ModelManager received unentitled request. Expected entitlement com.apple.modelmanager.inference establishment of session failed with Missing entitlement: com.apple.modelmanager.inference"

The simple code is listed below: let session: LanguageModelSession = LanguageModelSession() let response = try? await session.respond(to: "What is the capital of France?") print("Response: (response)")

So what's the problem of this one?

Hi @younky, can you provide your macOS version and Xcode version, as well as the model and OS version of the target device that you are deploying to?

Best,

-J

Also, could you please run your request again, and print the error?

let session = LanguageModelSession()
do {
    let response = try await session.respond(to: "What is the capital of France?") 
    print("Response: \(response)")
} catch {
    print(error)
}

it gave me the error like this "ModelManager received unentitled request. Expected entitlement com.apple.modelmanager.inference establishment of session failed with Missing entitlement: com.apple.modelmanager.inference"

Did you get that specific error from calling try await session.respond(to:)?

Lastly, could you try a different prompt, to see if that works?

let session = LanguageModelSession()
do {
    let response = try await session.respond(to: "What is 2+2?") 
    print("Response: \(response)")
} catch {
    print(error)
}

ModelManager received unentitled request. Expected entitlement com.apple.modelmanager.inference
 
 
Q