{"id":51105583,"url":"https://github.com/rudrankriyam/Foundation-Models-Framework-Lab","last_synced_at":"2026-06-28T07:01:05.864Z","repository":{"id":298178262,"uuid":"999128119","full_name":"rudrankriyam/Foundation-Models-Framework-Lab","owner":"rudrankriyam","description":"A practical lab for building, testing, and evaluating apps with Apple's Foundation Models framework.","archived":false,"fork":false,"pushed_at":"2026-06-20T07:29:42.000Z","size":29959,"stargazers_count":1121,"open_issues_count":0,"forks_count":68,"subscribers_count":10,"default_branch":"main","last_synced_at":"2026-06-20T08:08:04.906Z","etag":null,"topics":["ai","apple-foundation-models","apple-intelligence","foundation-models","foundation-models-framework","generative-ai","healthkit","ios","large-language-models","llm","macos","multilingual","on-device-ai","rag","speech-recognition","swift","swiftui","text-to-speech","tool-calling","xcode"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rudrankriyam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"Agents.md","dco":null,"cla":null},"funding":{"github":["rudrankriyam"]}},"created_at":"2025-06-09T19:29:16.000Z","updated_at":"2026-06-20T07:29:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f5fc870-83a2-41c4-8bbc-901580b0e5b8","html_url":"https://github.com/rudrankriyam/Foundation-Models-Framework-Lab","commit_stats":null,"previous_names":["rudrankriyam/foundation-models-framework-example","rudrankriyam/foundation-models-framework-lab"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rudrankriyam/Foundation-Models-Framework-Lab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudrankriyam%2FFoundation-Models-Framework-Lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudrankriyam%2FFoundation-Models-Framework-Lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudrankriyam%2FFoundation-Models-Framework-Lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudrankriyam%2FFoundation-Models-Framework-Lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rudrankriyam","download_url":"https://codeload.github.com/rudrankriyam/Foundation-Models-Framework-Lab/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudrankriyam%2FFoundation-Models-Framework-Lab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34880189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","apple-foundation-models","apple-intelligence","foundation-models","foundation-models-framework","generative-ai","healthkit","ios","large-language-models","llm","macos","multilingual","on-device-ai","rag","speech-recognition","swift","swiftui","text-to-speech","tool-calling","xcode"],"created_at":"2026-06-24T14:00:22.929Z","updated_at":"2026-06-28T07:01:05.859Z","avatar_url":"https://github.com/rudrankriyam.png","language":"Swift","funding_links":["https://github.com/sponsors/rudrankriyam"],"categories":["Developer"],"sub_categories":[],"readme":"# Foundation Lab\n\nFoundation Lab is a native iOS and macOS workbench for learning, testing, and\nshipping with Apple's Foundation Models framework. It keeps the prompt,\nconfiguration, tools, transcript, and run evidence in one place while still\nproviding focused labs for APIs that need a specialized interface.\n\nThe app is designed for two complementary workflows:\n\n- Open a working recipe, change one thing, and run it immediately.\n- Compose custom prompts and tools, inspect every run,\n  compare adapters, and use the repository's CLI and evaluation tooling.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"images/FoundationLab-Library-macOS.png\" alt=\"Foundation Lab for macOS showing the Library with editable recipes and built-in tool examples\" width=\"1000\"/\u003e\n  \u003cbr/\u003e\n  \u003cstrong\u003eLibrary\u003c/strong\u003e\n  \u003cbr/\u003e\n  \u003cbr/\u003e\n  \u003ctable\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" style=\"padding: 15px;\"\u003e\n        \u003cimg src=\"images/FoundationLab-Playground-macOS.png\" alt=\"Foundation Lab for macOS showing an empty Playground with runtime, reasoning, generation, instructions, and tool controls\" width=\"500\"/\u003e\n        \u003cbr/\u003e\n        \u003cstrong\u003ePlayground\u003c/strong\u003e\n      \u003c/td\u003e\n      \u003ctd align=\"center\" style=\"padding: 15px;\"\u003e\n        \u003cimg src=\"images/FoundationLab-Xcode27-macOS.png\" alt=\"Foundation Lab for macOS showing the Xcode 27 workshop with runtime, context, tool, security, transcript, and agent labs\" width=\"500\"/\u003e\n        \u003cbr/\u003e\n        \u003cstrong\u003eXcode 27 Workshop\u003c/strong\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n\u003c/div\u003e\n\n## App Structure\n\nFoundation Lab has three primary destinations:\n\n| Destination | Purpose |\n| --- | --- |\n| Library | Browse 18 editable recipes, 14 guided labs, three workshops, saved experiments, and two workspaces. |\n| Playground | Edit prompts and instructions, configure the model and tools, stream responses, use voice input, save experiments, and export Swift. |\n| Runs | Inspect persisted run status, configuration, transcript events, tool calls, timing, and token usage. |\n\nLibrary entries identify how they open:\n\n- **Recipe** opens in Playground and can be edited, run, and saved.\n- **Guided Lab** uses a focused interface for a specific Foundation Models API.\n- **Workshop** groups related schema, language, or Xcode 27 examples without adding another top-level destination.\n- **Workspace** opens a dedicated tool such as Adapter Comparison or FMFBench.\n\n## Requirements\n\n- iOS 26.0+ or macOS 26.0+\n- Apple Silicon for on-device model execution\n- Apple Intelligence enabled for live model runs\n- Xcode 26.6 or Xcode 27\n\nThe project builds with both Xcode 26.6 and Xcode 27. APIs introduced with the\nOS 27 SDK are compiler- and availability-gated, so the core app remains usable\nwith Xcode 26 while Xcode 27 exposes the newest labs.\n\n## Getting Started\n\n```bash\ngit clone https://github.com/rudrankriyam/Foundation-Models-Framework-Lab.git\ncd Foundation-Models-Framework-Lab\nopen FoundationLab.xcodeproj\n```\n\nBuild from the command line:\n\n```bash\nxcodebuild \\\n  -project FoundationLab.xcodeproj \\\n  -scheme 'Foundation Lab' \\\n  -destination 'generic/platform=macOS' \\\n  CODE_SIGNING_ALLOWED=NO \\\n  build\n\nxcodebuild \\\n  -project FoundationLab.xcodeproj \\\n  -scheme 'Foundation Lab' \\\n  -destination 'generic/platform=iOS Simulator' \\\n  CODE_SIGNING_ALLOWED=NO \\\n  build\n```\n\nLive model execution requires a compatible physical device. Simulator builds\nremain useful for compilation and interface validation.\n\n## Capabilities\n\n### Experiments and conversations\n\n- Streaming multi-turn conversations with context-window management\n- Editable instructions, sampling, response limits, runtime, and reasoning controls\n- Saved experiment configurations and persistent run history\n- Swift export for Playground configurations\n- Speech recognition and synthesis integrated into Playground\n\n### Built-in tools\n\nNine ready-made tool recipes use the shared `FoundationModelsTools` package:\n\n- Weather through Open-Meteo\n- Keyless Search1 web search\n- Contacts\n- Calendar\n- Reminders\n- Location and place search\n- Authorized HealthKit data\n- Apple Music\n- Web metadata\n\nTool recipes open in Playground, where tools can be combined or removed. Tools\nthat can change user data require confirmation through the app-owned workflow.\n\n### Structured output and applied projects\n\n- `@Generable` models and `@Guide` constraints\n- Dynamic schemas, nested objects, unions, forms, and invoice extraction\n- Multilingual sessions and supported-language inspection\n- RAG document indexing and semantic retrieval with LumoKit and VecturaKit\n- A HealthKit dashboard and chat grounded only in authorized Health data\n\n### Xcode 27 labs\n\nWhen built with Xcode 27, Foundation Lab also demonstrates:\n\n- `PrivateCloudComputeLanguageModel`\n- Shared `LanguageModel` execution\n- Image attachments and references\n- Explicit tool-calling modes\n- Dynamic profiles and reasoning controls\n- Transcript inspection and history transforms\n- Context-budget visualization\n- Custom model executors, including a video-capable provider bridge\n\nThe image-input probe under [`Tools/ImageInputProbe`](Tools/ImageInputProbe)\ncan measure the current SDK's practical decoded-buffer boundary.\n\n## Workspaces\n\n### Adapter Comparison\n\nOn macOS, import a `.fmadapter` package and run the same prompt through fresh\nbase-model and adapter sessions. The workspace shows both streams and diagnostic\ntime-to-first-token and total-duration measurements.\n\nTraining and export remain in the companion `fmas` CLI:\n\n```bash\npython3.11 -m venv .venv-fmas\nsource .venv-fmas/bin/activate\npython -m pip install -e Tools/AdapterStudio\nfmas init\nfmas setup\nfmas train-adapter --help\nfmas export --help\n```\n\nSee [`Tools/AdapterStudio`](Tools/AdapterStudio) for the full workflow.\n\n### FMFBench\n\nFMFBench is the repository's repeatable quality, agentic-tool, safety, and performance\nsuite. Its agentic corpus includes 25 deterministic cases covering multi-tool execution,\nambiguity, failures, duplicate prevention, and untrusted tool data.\nThe in-app workspace explains the protocol and artifacts. Canonical on-device Mac\nresults come from the CLI; PCC on Mac and all iPhone and iPad measurements use the\nsigned runner on physical Apple Intelligence hardware.\n\n```bash\nswift run fmfbench list\nswift run fmfbench --suite quick --model on-device\nswift run fmfbench --suite agentic --warmups 0 --repetitions 1\nswift run fmfbench --suite full --warmups 5 --repetitions 20 \\\n  --json Tools/FMFBench/Results/run.json \\\n  --markdown Tools/FMFBench/Results/run.md\n```\n\nSee [`Tools/FMFBench`](Tools/FMFBench) for workloads, methodology, graders, and\nthe device runner.\n\n## Command-Line Interface\n\nThe `afm` CLI uses the same `FoundationLabCore` and `FoundationModelsKit`\nruntime as the app.\n\n```bash\nbrew tap rudrankriyam/tap\nbrew install afm\n\nswift run afm --help\nswift run afm model status\nswift run afm token-count -i @instructions.md --prompt @prompt.md --breakdown\nswift run afm session respond --prompt \"Summarize Foundation Models.\"\n```\n\nSee [`Tools/AFMCLI/README.md`](Tools/AFMCLI/README.md) for the command reference.\nAFM releases use `afm-vx.y.z` tags so CLI releases remain independent from app releases.\n\n## Repository Map\n\n| Surface | Location | Purpose |\n| --- | --- | --- |\n| Foundation Lab | [`Foundation Lab`](Foundation%20Lab) | Native Library, Playground, Runs, guided labs, and workspaces |\n| FoundationLabCore | [`FoundationLabCore`](FoundationLabCore) | UI-independent requests, results, use cases, providers, and experiment models |\n| FoundationModelsKit | [`Packages/FoundationModelsKit`](Packages/FoundationModelsKit) | Transcript, context, history, and system-tool packages |\n| AFM CLI | [`Tools/AFMCLI`](Tools/AFMCLI) | Scriptable Foundation Models workflows |\n| FMFBench | [`Tools/FMFBench`](Tools/FMFBench) | Quality, agentic-tool, safety, and performance evaluation |\n| Adapter tooling | [`Tools/AdapterStudio`](Tools/AdapterStudio) | Adapter training and export with `fmas` |\n| Book playgrounds | [`BookPlaygrounds`](BookPlaygrounds) | Chapter-oriented `#Playground` examples |\n\nThe former standalone CLI, FMFBench, and Adapter Studio repositories are\narchived in favor of this shared implementation.\n\n## Swift Package Products\n\n`FoundationModelsKit` and `FoundationModelsTools` are defined by\n[`Packages/FoundationModelsKit/Package.swift`](Packages/FoundationModelsKit/Package.swift).\nLocal package consumers should depend on that package path directly rather than\nrequesting those products from the repository's root manifest.\n\n- `FoundationModelsKit` provides transcript history transforms, provenance-aware\n  token accounting shared by the app and CLI, calibrated estimation, and\n  context-budget utilities.\n- `FoundationModelsTools` provides calendar, contacts, health, location, music,\n  reminders, weather, web search, and web metadata tools.\n- `FoundationLabCore` provides the shared capability and experiment runtime.\n- `FMFBenchCore` provides the evaluation corpus, graders, runner, metrics, and reports.\n- `BenchmarkCore` remains as an FMFBench compatibility alias.\n- `fmfbench` is the canonical benchmark executable.\n\n## Localization and Permissions\n\nThe app ships English, German, Spanish, French, Italian, Japanese, Korean,\nPortuguese (Brazil), Simplified Chinese, and Traditional Chinese localizations.\n\nFeatures request permissions only when needed. Depending on the selected recipe\nor lab, the app may request microphone, speech recognition, contacts, calendar,\nreminders, location, HealthKit, or Apple Music access.\n\n## Validation\n\n```bash\nswiftlint lint --strict --config .swiftlint.yml\nswift test\n```\n\nCI additionally builds Foundation Lab for macOS and iOS Simulator and validates\nthe AFM, FMFBench, Adapter Studio, and TestFlight workflows.\n\n## TestFlight\n\nJoin the Foundation Lab beta on\n[TestFlight](https://testflight.apple.com/join/JWR9FpP3).\n\nPushes to `main` that affect the app can run the repository-local ASC workflow\nin [`.asc/workflow.json`](.asc/workflow.json) through\n[`foundation-lab-testflight.yml`](.github/workflows/foundation-lab-testflight.yml).\n\n## Agent Skills\n\nThe repository includes two reusable skills:\n\n- `foundation-models-app-builder` for production Foundation Models patterns\n- `foundation-models-os27-updater` for Xcode 27 and OS 27 migrations\n\n```bash\nnpx skills add rudrankriyam/Foundation-Models-Framework-Lab \\\n  --skill foundation-models-app-builder\n\nnpx skills add rudrankriyam/Foundation-Models-Framework-Lab \\\n  --skill foundation-models-os27-updater\n```\n\n## Contributing\n\nContributions are welcome. Please open an issue or pull request with a focused\nchange and include the relevant lint, test, and build results.\n\n## License\n\nFoundation Lab is available under the MIT License. See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frudrankriyam%2FFoundation-Models-Framework-Lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frudrankriyam%2FFoundation-Models-Framework-Lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frudrankriyam%2FFoundation-Models-Framework-Lab/lists"}