Skip to content

feat: add Core AI provider package#219

Draft
grabbou wants to merge 11 commits into
mainfrom
feat/core-ai-provider
Draft

feat: add Core AI provider package#219
grabbou wants to merge 11 commits into
mainfrom
feat/core-ai-provider

Conversation

@grabbou

@grabbou grabbou commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new @react-native-ai/core-ai package for Apple Core AI model bundles exported from apple/coreai-models.

The package now follows the same light shape as the other React Native AI providers:

  • coreAI exposes AI SDK-compatible model adapters: language, image generation, text embeddings, and transcription.
  • CoreAI exports the raw native TurboModule for Core AI-specific calls such as model inspection, specialization, task execution, and raw function execution.
  • Persistent language sessions live on the returned language model via model.prepare() and model.createSession(...).
  • There is no separate core.ts facade and no package-level static model catalog. Starter model data stays in docs/example code for now; real apps should load available models dynamically.
  • Starter model docs link the prebuilt Core AI bundles we found online and mark the remaining bundles as planned Callstack-hosted artifacts.
  • Docs cover SPM host-app integration, the React Native/CocoaPods workaround, native-only APIs, unsupported AI SDK surfaces, recommended starter models, and the model-management TBD.

Native Notes

React Native installs this package through CocoaPods, but Apple Core AI helpers live in Swift Package products. The host iOS app still needs to add https://github.com/apple/coreai-models through SPM and link the products it uses:

  • CoreAILM
  • CoreAIDiffusion
  • CoreAISegmentation
  • CoreAIObjectDetection

For Expo this should be handled by a config plugin that patches the generated Xcode project. Bare React Native apps can add the package in Xcode or with a deterministic project patching script.

Model Management TBD

Core AI does not load remote URLs directly. Apple’s API expects a local .aimodel or .aimodelc URL, then specializes that local asset with AIModel(contentsOf:) or AIModel.specialize(contentsOf:).

A follow-up should add a first-class model-management path that downloads remote model bundles into app storage, returns a local source: { type: 'file', uri }, optionally specializes before first use, and persists bookmark data for specialized cached assets. The downloader and storage pieces should share helpers with other React Native AI runtimes where practical, instead of duplicating provider-specific plumbing.

Validation

  • bun run --cwd packages/core-ai typecheck
  • swiftc -parse packages/core-ai/ios/CoreAIError.swift packages/core-ai/ios/CoreAIImpl.swift
  • bun run lint
  • bun run --cwd website build
  • bun run build
  • bun run typecheck

Caveats

The Swift file parses locally, but full iOS compilation with Apple Core AI products linked still needs to be verified in an Xcode 27/iOS 27 app target. Embeddings, ASR, depth, super-resolution, classification, specialization persistence, remote model download/bookmark restore, and raw tensor execution still need real device/runtime validation before we claim they are production-ready.

@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai Ready Ready Preview, Comment Jun 17, 2026 11:04pm

Request Review

- Exported `.aimodel` bundles from `apple/coreai-models`
- The Apple Core AI Models Swift Package linked to the host app target

## Swift Package Setup

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to be verified whether that setup process is sound.

- `CoreAILM` for `coreAI.languageModel(...)` and sessions
- `CoreAIDiffusion` for `coreAI.imageModel(...)`
- `CoreAISegmentation` for `coreAI.segmenter(...)`
- `CoreAIObjectDetection` for `coreAI.objectDetector(...)`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can turn this into config plugin that takes options of what to use, unless already the case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And by default, I think we can link all.

Comment thread website/src/docs/core-ai/models.md Outdated
@@ -0,0 +1,35 @@
# Starter Models

Source this list from `apple/coreai-models/python/src/coreai_models/model_registry.py` when updating the package catalog. Prefer iOS examples. Use macOS only when the registry has no iOS entry.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This preface is unnecessary

Comment thread website/src/docs/core-ai/models.md Outdated
| ------------------------------------------------------------ | ----------------------------- | ----------- | ------------------------------ | -------------------------------------------------------------- |
| Language sessions, text generation, structured output, tools | `qwen3-0.6b` | iOS + macOS | Implemented | Best first Core AI session demo. |
| Better iOS language quality | `qwen2.5-1.5b-instruct` | iOS + macOS | Implemented | Good second example after the session API works. |
| Larger iOS language validation | `qwen3-4b` | iOS + macOS | Implemented | Useful for memory and specialization testing. |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here i think better this table to group by type, models, platform + link to model file as TBD, we willadd links later, i assume there somewhere available.

For things not avialable/not-exposed, we do not list them at all.

@artus9033 artus9033 changed the title [codex] Add Core AI provider package feat: add Core AI provider package Jun 20, 2026
@grabbou

grabbou commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

BTW @artus9033 this is ready for you to be taken into non-draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant