From f671ec5666ba690d8440f125e920a5aad1cda153 Mon Sep 17 00:00:00 2001 From: Gilad S Date: Tue, 4 Feb 2025 04:40:24 +0200 Subject: [PATCH] feat: simplify `node-llama-cpp` snippet --- packages/tasks/src/local-apps.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/tasks/src/local-apps.ts b/packages/tasks/src/local-apps.ts index 1882fe9a8c..d9ca9a5d0f 100644 --- a/packages/tasks/src/local-apps.ts +++ b/packages/tasks/src/local-apps.ts @@ -138,18 +138,21 @@ const snippetLlamacpp = (model: ModelData, filepath?: string): LocalAppSnippet[] }; const snippetNodeLlamaCppCli = (model: ModelData, filepath?: string): LocalAppSnippet[] => { + let tagName = "{{OLLAMA_TAG}}"; + + if (filepath) { + const quantLabel = parseGGUFQuantLabel(filepath); + tagName = quantLabel ? `:${quantLabel}` : tagName; + } + return [ { title: "Chat with the model", - content: [ - `npx -y node-llama-cpp chat \\`, - ` --model "hf:${model.id}/${filepath ?? "{{GGUF_FILE}}"}" \\`, - ` --prompt 'Hi there!'`, - ].join("\n"), + content: `npx -y node-llama-cpp chat hf:${model.id}${tagName}`, }, { title: "Estimate the model compatibility with your hardware", - content: `npx -y node-llama-cpp inspect estimate "hf:${model.id}/${filepath ?? "{{GGUF_FILE}}"}"`, + content: `npx -y node-llama-cpp inspect estimate hf:${model.id}${tagName}`, }, ]; };