flutter_foundation_models 0.2.1
flutter_foundation_models: ^0.2.1 copied to clipboard
Flutter plugin for Apple's on-device Foundation Models. Generate text, structured output, and use tools with the on-device language model.
0.2.1 #
- Update documentation
0.2.0 #
Breaking Changes #
LanguageModelSessionnow uses async factory methodLanguageModelSession.create()instead of constructor- Moved
isAvailablefromLanguageModelSessiontoSystemLanguageModel.isAvailable
New Features #
- Swift Package Manager support - Plugin now supports both SPM and CocoaPods
- SystemLanguageModel class - Manage language models with configuration options
SystemLanguageModel.defaultModel- Access the default system modelSystemLanguageModel.create()- Create custom model with adapter, useCase, or guardrailsSystemLanguageModel.isAvailable- Check if Foundation Models API is availableSystemLanguageModel.availability- Get detailed availability info with unavailability reason
- Adapter support - Load custom adapters
Adapter.create(name:)- Create adapter by nameAdapter.fromAsset(assetPath)- Create adapter from Flutter asset
- UseCase configuration -
UseCase.generalandUseCase.contentTagging - Guardrails configuration -
Guardrails.defaultGuardrailsandGuardrails.permissiveContentTransformations - Text streaming -
streamResponseTo()for plain text streaming without schema - Session prewarm -
session.prewarm()to reduce latency on first request - Session state -
session.isRespondingto check if session is actively generating
0.1.1 #
- Add runtime availability check with
LanguageModelSession.isAvailable() - Lower minimum iOS version to 16.0 (API requires iOS 26+ at runtime)
- Improve documentation
- Clean up published package (exclude unnecessary example files)
0.1.0 #
- Initial release
- Text generation with
respondTo() - Structured output with
respondToWithSchema() - Streaming support with
streamResponseToWithSchema() - Tool use support
- Generation options (sampling mode, temperature, max tokens)
- System instructions support
- Availability checking with
LanguageModelSession.isAvailable() - Supports iOS 16+ (Foundation Models API requires iOS 26+ at runtime)