https://github.com/mobile-artificial-intelligence/llama_sdk
lcpp is a dart implementation of llama.cpp used by the mobile artificial intelligence distribution (maid)
https://github.com/mobile-artificial-intelligence/llama_sdk
facebook flutter-ai gemma ggml gguf llama llama2 llamacpp llm llm-inference local-ai meta mistral mixtral mobile-ai
Last synced: about 1 month ago
JSON representation
lcpp is a dart implementation of llama.cpp used by the mobile artificial intelligence distribution (maid)
- Host: GitHub
- URL: https://github.com/mobile-artificial-intelligence/llama_sdk
- Owner: Mobile-Artificial-Intelligence
- License: mit
- Created: 2024-02-29T05:08:07.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-09T00:31:25.000Z (about 1 month ago)
- Last Synced: 2025-04-09T00:56:36.194Z (about 1 month ago)
- Topics: facebook, flutter-ai, gemma, ggml, gguf, llama, llama2, llamacpp, llm, llm-inference, local-ai, meta, mistral, mixtral, mobile-ai
- Language: Dart
- Homepage:
- Size: 1.57 MB
- Stars: 73
- Watchers: 6
- Forks: 18
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
# llama_sdk
[](https://github.com/Mobile-Artificial-Intelligence/llama_sdk/actions/workflows/build-android.yml)
[](https://github.com/Mobile-Artificial-Intelligence/llama_sdk/actions/workflows/build-ios.yml)
[](https://github.com/Mobile-Artificial-Intelligence/llama_sdk/actions/workflows/build-linux.yml)
[](https://github.com/Mobile-Artificial-Intelligence/llama_sdk/actions/workflows/build-macos.yml)
[](https://github.com/Mobile-Artificial-Intelligence/llama_sdk/actions/workflows/build-windows.yml)llama_sdk is a dart implementation of llama.cpp used by the mobile artificial intelligence distribution (maid)
## Features
- Optional use of isolations for parallel processing
- Streaming support## Getting started
To use this package, add `llama_sdk` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).
```yaml
dependencies:
llama_sdk: ^0.0.2
```then you can import llama in your Dart code
```dart
import 'package:llama_sdk/llama_sdk.dart';
```## Usage
Below is a simple example of how to use llama
```dart
final llama = LlamaIsolated(LlamaParams(
modelFile: File('path/to/model'),
nCtx: 2048,
nBatch: 2048,
greedy: true
));final messages = [
LlamaMessage.withRole(role: 'user', content: 'Hello World'),
];final stream = llama.prompt(messages);
stream.listen((event) {
print(event);
});
```## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
```
MIT LicenseCopyright (c) 2023 Dane Madsen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```