Add Apple Foundation Models support (Apple FM)#2150
Open
jimscard wants to merge 27 commits into
Open
Conversation
…ade and non‑root user
…ade and non‑root user
…API key optional)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…scovery\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tructions\n\nDocument fm serve usage and macOS requirement Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com
…allback for OpenAI-compatible providers Concatenate SSE 'data:' JSON delta content into a single response when the SDK cannot parse non-stream SSE responses (Apple Foundation Models compatibility).\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…allback; build direct HTTP fallback from messages/opts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…enation of JSON delta SSE messages and plain text SSE data lines Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…E responses) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…roubleshooting SSE empty response Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… parsing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…est.json for comparison Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…message fallback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d docs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…: Copilot <223556219+Copilot@users.noreply.github.com>
…tPrefix)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2154
Add Apple Foundation Models support (Apple FM)
Summary
This PR adds support for Apple Foundation Models (OpenAI-compatible) as a provider in Fabric. It includes robust handling for servers that return SSE (text/event-stream) for non-stream responses by parsing SSE "data:" chunks and concatenating content. A secondary fallback resends a single concatenated user message when SSE parsing yields empty output.
Key changes
Lint & cleanup (follow-up)
Files touched (high level)
Testing performed locally
How to test
Start Apple FM server (requires macOS Golden Gate 27.0 beta 1+):
Verify vendor and models:
./fabric --listvendors ./fabric --listmodels --vendor "Apple Foundation Models"Run a non-stream sample to exercise SSE fallback:
Notes for reviewers
Recent commits on add-fm (most recent first):
$(git log add-fm -n 12 --pretty=format:"- %h %s (%an)")