Requirements
- macOS 26+ or iOS/iPadOS 26+
- Apple Intelligence enabled
- Apple Silicon device
- Rust 1.85+ (edition 2024)
Installation
[]
= "0.1"
Enable the derive macro if you want compile-time schema generation:
[]
= { = "0.1", = ["derive"] }
Quick Start
use ;
Key Features
- Blocking and streaming responses
- Tool calling with JSON argument schemas
- Structured JSON output (explicit schemas or derive macro)
- Transcript persistence and restoration
- Context usage estimates and compaction helpers
- Prewarming and timeout-aware respond APIs
Runtime Notes (macOS)
- FFI calls are synchronous. Use
spawn_blockingin async runtimes. - If you see
libswift_Concurrency.dylibload errors, add Swift rpaths in your binary crate’sbuild.rs.
use Command;
Prompting Guidance
For best results on-device:
- Keep prompts focused and explicit about length and style.
- Prefer instructions for stable behavior across prompts.
- Use small examples when you need consistent formatting.
- Break complex tasks into smaller steps.
- Use structured output when you need reliable parsing.
See Apple’s guidance for more detail:
- https://developer.apple.com/documentation/foundationmodels/prompting-an-on-device-foundation-model
- https://developer.apple.com/videos/play/wwdc2024/10150/
- https://developer.apple.com/videos/play/wwdc2024/10163/
Examples
Documentation
See API details and advanced usage in the crate docs (docs.rs).
License
MIT License - see LICENSE for details.