Skip to content

AI Chat: Apple Intelligence transport via Foundation Models #1048

Closed

Description

@datlechin

Add Apple Intelligence as a chat provider on macOS 26+. On-device, no API key, no network. Schema and queries do not leave the Mac.

What it does

  • New AppleIntelligenceTransport: ChatTransport backed by the Foundation Models framework (LanguageModelSession, @Generable, Tool).
  • Gated by if #available(macOS 26, *) and SystemLanguageModel.default.availability. Users on older macOS or Intel Macs see it greyed out with the reason: .deviceNotEligible, .appleIntelligenceNotEnabled, .modelNotReady.
  • Bridges ChatTool (from the chat rewrite) to Foundation Models' Tool protocol so the on-device model can call MCP tools.
  • Default provider for new users on macOS 26+ when Apple Intelligence is available.

Depends on

#1047. The ChatTransport and ChatTool abstractions land there first.

Out of scope

Bumping the project's macOS minimum. Stays at 14.0. The transport is feature-gated.

Activity

  1. added
    enhancement
    on May 6, 2026
  2. datlechin commented on Jun 8, 2026

    @datlechin
    MemberAuthor

    Closing this. After getting the on-device transport working end to end, Foundation Models isn't a good fit for TablePro's agentic AI chat, and the blocker is structural rather than a bug we can patch.

    What works

    Plain chat and single-turn tool calls run fine. Sign-in and availability detection, the transcript building, schema generation, and the tool bridge all work on macOS 26.

    Why it can't ship

    The on-device model has a fixed ~4k-token context window. TablePro's AI chat sends a large system prompt plus every tool's JSON schema, and each tool result (for example list_tables with row counts on a 30+ table database) gets added back into the transcript. That fills the window after one or two agentic turns, and the next generation fails with GenerationError.exceededContextWindowSize.

    Making it usable would mean trimming conversation history and truncating tool outputs for this provider only. That degrades answers: the model would see partial results and forget earlier turns. It isn't a tradeoff worth shipping when every other provider runs the same agent flow without it.

    Worth keeping for a future attempt

    Two findings from this work (the code stays on the feat/1048-apple-intelligence-transport branch for reference):

    • Tool definitions must be declared in the Transcript.Instructions entry, not just passed via the session's tools: parameter. Without that, multi-pass tool calling dies mid-stream with an opaque GenerationError -1.
    • Foundation Models wraps tool-call failures in ToolCallError, so error as? GenerationError misses the real cause. You have to unwrap ToolCallError.underlyingError to get the actual reason, which is how the context-window error above was finally identified.

    Worth revisiting if a future macOS release grows the on-device context window, or if we add a context-condensation strategy for small-window models. Reopening then.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions