Skip to content

Commit 9997471

Browse files
committed
embedding and rag
1 parent 8747473 commit 9997471

36 files changed

+1330
-5146
lines changed

Diff for: example/apple_pie.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void main() async {
1818
samplerParams.penaltyRepeat = 1.1;
1919

2020
Llama.libraryPath = "bin/MAC_ARM64/libllama.dylib";
21-
String modelPath = "/Users/adel/Downloads/gemma-3-12b-it-Q4_K_M.gguf";
21+
String modelPath = "/Users/adel/Workspace/gguf/gemma-3-12b-it-Q4_K_M.gguf";
2222
Llama llama = Llama(modelPath, ModelParams(), contextParams, samplerParams);
2323

2424
llama.setPrompt(

Diff for: example/apple_pie.qwq.dart

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// ignore_for_file: avoid_print
2+
3+
import 'dart:io';
4+
5+
import 'package:llama_cpp_dart/llama_cpp_dart.dart';
6+
7+
void main() async {
8+
try {
9+
ContextParams contextParams = ContextParams();
10+
contextParams.nPredict = 512;
11+
contextParams.nCtx = 512;
12+
contextParams.nBatch = 512;
13+
14+
final samplerParams = SamplerParams();
15+
samplerParams.temp = 0.6;
16+
samplerParams.minP = 0;
17+
samplerParams.topK = 20;
18+
samplerParams.topP = 0.95;
19+
// samplerParams.penaltyRepeat = 1.1;
20+
21+
Llama.libraryPath = "bin/MAC_ARM64/libllama.dylib";
22+
String modelPath = "/Users/adel/Workspace/gguf/qwq-32b-q4_k_m.gguf";
23+
Llama llama =
24+
Llama(modelPath, ModelParams(), contextParams, samplerParams, true);
25+
26+
llama.setPrompt("apple pie recipe?");
27+
while (true) {
28+
var (token, done) = llama.getNext();
29+
stdout.write(token);
30+
if (done) break;
31+
}
32+
stdout.write("\n");
33+
34+
llama.dispose();
35+
} catch (e) {
36+
print("Error: ${e.toString()}");
37+
}
38+
}

Diff for: example/chat_cli.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import 'dart:io';
44

55
import 'package:llama_cpp_dart/llama_cpp_dart.dart';
6-
import 'package:llama_cpp_dart/src/chat.dart';
76

87
void main() async {
98
try {
@@ -25,7 +24,7 @@ void main() async {
2524
// Load the LLM model
2625
print("Loading model, please wait...");
2726
Llama.libraryPath = "bin/MAC_ARM64/libllama.dylib";
28-
String modelPath = "/Users/adel/Downloads/gemma-3-12b-it-Q4_K_M.gguf";
27+
String modelPath = "/Users/adel/Workspace/gguf/gemma-3-12b-it-Q4_K_M.gguf";
2928
Llama llama =
3029
Llama(modelPath, ModelParams(), contextParams, samplerParams, false);
3130
print("Model loaded successfully! ${llama.status}");

Diff for: example/chat_cli_isolated.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import 'dart:io';
44
import 'dart:async';
55

66
import 'package:llama_cpp_dart/llama_cpp_dart.dart';
7-
import 'package:llama_cpp_dart/src/chat.dart';
87

98
void main() async {
109
print("Starting LLM CLI Chat App with Isolates...");
@@ -26,7 +25,7 @@ void main() async {
2625

2726
// Initialize load command for the isolate
2827
final loadCommand = LlamaLoad(
29-
path: "/Users/adel/Downloads/gemma-3-12b-it-Q4_K_M.gguf",
28+
path: "/Users/adel/Workspace/gguf/gemma-3-12b-it-Q4_K_M.gguf",
3029
modelParams: ModelParams(),
3130
contextParams: contextParams,
3231
samplingParams: samplerParams,

0 commit comments

Comments
 (0)