Views
No views yet
llama.cpp, node-llama-cpp, Ollama).1<|im_start|>system
2You are Echo-1, a helpful assistant.<|im_end|>
3<|im_start|>user
4Write a short paragraph explaining the benefits of local-first AI.<|im_end|>
5<|im_start|>assistant
6node-llama-cpp. Ensure you append the raw ChatML structural sequences directly to your execution queries:1import {LlamaModel, LlamaContext, LlamaSequence} from "node-llama-cpp";
2import path from "path";
3
4const model = new LlamaModel({
5 modelPath: path.join(__dirname, "echo-1-0.5b.gguf")
6});
7
8const context = new LlamaContext({model});
9const sequence = new LlamaSequence({context});
10
11const prompt = `<|im_start|>system\nYou are Echo-1.<|im_end|>\n<|im_start|>user\nWhat is 15 + 27?<|im_end|>\n<|im_start|>assistant\n`;
12const tokens = model.tokenize(prompt);
13
14console.log("Echo-1 response:");
15const response = await sequence.evaluate(tokens);
16console.log(model.detokenize(response));
17