withcatai/node-llama-cpp

★ 2,184⑂ 218

Run AI models locally on your machine with node.js bindings for llama.cpp. Enforce a JSON schema on the model output on the generation level

About withcatai/node-llama-cpp

withcatai/node-llama-cpp is an open-source project on GitHub, mainly written in TypeScript. Run AI models locally on your machine with node.js bindings for llama.cpp. Enforce a JSON schema on the model output on the generation level It currently holds 2,184 stars and 218 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).

Project Overview

AI Homed tracks it on the Local & On-Device AI board.

GitHub Repository Details

Repository withcatai/node-llama-cpp · default branch - · size 0 KB · watchers 0 · source: GitHub REST API and repository README

README

https://github.com/withcatai/node-llama-cpp/blob/HEAD/node-llama-cpp Logo

node-llama-cpp

Run AI models locally on your machine

Pre-built bindings are provided with a fallback to building from source with cmake

Build License Types Version

Gemma 4 is here!

Features

Documentation

Try It Without Installing

Chat with a model in your terminal using a single command:
npx -y node-llama-cpp chat

Installation

npm install node-llama-cpp

This package comes with pre-built binaries for macOS, Linux and Windows.

If binaries are not available for your platform, it'll fallback to download a release of llama.cpp and build it from source with cmake. To disable this behavior, set the environment variable NODE_LLAMA_CPP_SKIP_DOWNLOAD to true.

Usage

import {fileURLToPath} from "url";
import path from "path";
import {getLlama, LlamaChatSession} from "node-llama-cpp";

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const llama = await getLlama(); const model = await llama.loadModel({ modelPath: path.join(__dirname, "models", "Meta-Llama-3.1-8B-Instruct.Q4_K_M.gguf") }); const context = await model.createContext(); const session = new LlamaChatSession({ contextSequence: context.getSequence() });

const q1 = "Hi there, how are you?"; console.log("User: " + q1);

const a1 = await session.prompt(q1); console.log("AI: " + a1);

const q2 = "Summarize what you said"; console.log("User: " + q2);

const a2 = await session.prompt(q2); console.log("AI: " + a2);

For more examples, see the getting started guide

Contributing

To contribute to node-llama-cpp read the contribution guide.

Acknowledgements


https://github.com/withcatai/node-llama-cpp/blob/HEAD/Star please

If you like this repo, star it ✨                                                    

GitHub Stars & Activity

2,184Stars
218Forks
0Open issues
TypeScriptLanguage

GitHub Popularity

GitHub stars2,184
Forks218
Open issues0
Primary languageTypeScript
License-
Stars gained today0
Created-
Last pushed-

Trending History

Trending statusnot on today's boards

Related AI Projects

1

dyad-sh / dyad

TypeScript★ 21,594⑂ 2,640
2

getumbrel / llama-gpt

TypeScript★ 10,937⑂ 704
3

n4ze3m / page-assist

TypeScript★ 8,220⑂ 785
4

OpenCoworkAI / open-codesign

TypeScript★ 7,952⑂ 831
5

open-multi-agent / open-multi-agent

TypeScript★ 6,947⑂ 2,433
6

vas3k / TaxHacker

TypeScript★ 6,713⑂ 1,093
7

buxuku / SmartSub

TypeScript★ 5,277⑂ 401
8

vinta / pangu.js

TypeScript★ 4,828⑂ 315

More AI Rankings