Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,10 @@ let response = try await session.respond {

On OS 27, Foundation Models accepts any type that conforms to its `LanguageModel` protocol.
`FoundationLanguageModel` wraps such a model so it works with everything in this package.
Construct the model yourself, or hand the wrapper an async factory so an expensive load
happens on the first request and you control when it is released.
Construct the model yourself,
or hand the wrapper an async factory
so an expensive load happens on the first request
and you control when it is released.

```swift
let model = FoundationLanguageModel {
Expand All @@ -549,9 +551,10 @@ await model.unload()

#### Core AI Models

Apple's [coreai-models](https://github.com/apple/coreai-models) package exports language
models for the Core AI engine, and its `CoreAILanguageModel` conforms to the Foundation Models
protocol. Add the `CoreAILM` product from that package to your app and wrap the model:
Apple's [coreai-models](https://github.com/apple/coreai-models) package
exports language models for the Core AI engine,
and its `CoreAILanguageModel` conforms to the Foundation Models protocol.
Add the `CoreAILM` product from that package to your app and wrap the model:

```swift
import CoreAILanguageModels
Expand All @@ -562,8 +565,14 @@ let model = FoundationLanguageModel {
let session = LanguageModelSession(model: model)
```

The package declares a platform floor of OS 27. Apps with an earlier deployment target can
build it as an XCFramework and link it weakly, guarding every use with an availability check.
`coreai-models` requires a deployment target of OS 27,
so you can add it only to an app that already requires OS 27.
If your app supports earlier releases,
[coreai-models-xcframework](https://github.com/james-333i/coreai-models-xcframework)
is a community recipe for shipping the package as prebuilt frameworks
with the minimum OS lowered.
The recipe isn't maintained here,
and its README covers what can break.

### Core ML

Expand Down