Skip to content

Commit b6386e3

Browse files
committed
feat: Add android needed config
1 parent 6f645ec commit b6386e3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/src/llama.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:convert';
22
import 'dart:ffi';
3+
import 'dart:io';
34
import 'dart:math';
45

56
import 'package:ffi/ffi.dart';
@@ -38,7 +39,7 @@ class Llama {
3839
int cursor = 0;
3940

4041
/// set llama.cpp library path
41-
static String? libraryPath;
42+
static String? libraryPath = Platform.isAndroid ? "libllama.so" : null;
4243

4344
/// Getter for the Llama library.
4445
///
@@ -76,7 +77,7 @@ class Llama {
7677
: modelParams = modelParams ?? ModelParams(),
7778
contextParams = contextParams ?? ContextParams(),
7879
samplingParams = samplingParams ?? SamplingParams() {
79-
lib.llama_backend_init(false);
80+
lib.llama_backend_init();
8081
llama_model_params modelParams = this.modelParams.get();
8182

8283
Pointer<Char> char = modelPath.toNativeUtf8().cast<Char>();

0 commit comments

Comments
 (0)