node-llama-cpp

(β˜… 2,160)

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

  • .commitlintrc.json
  • .editorconfig
  • .gitignore
  • .prettierignore
  • .releaserc.ts
  • CONTRIBUTING.md
  • eslint.config.js
  • giscus.json
  • LICENSE
  • package-lock.json
  • package.json
  • README.md
  • tsconfig.json
  • vitest.config.ts

# Installation Guide

1. Get the code
git clone https://github.com/withcatai/node-llama-cpp

Downloads the entire project code from GitHub to your computer.

cd node-llama-cpp

Moves into the project folder you just downloaded.

2. CMake

Medium Recommended
Prerequisites
  • Git Needed to download the project code from GitHub.
  • CMake The tool used to generate build configuration.
  • C/C++ 컴파일러 Windows needs Visual Studio (Community edition, free), macOS needs Xcode Command Line Tools, Linux needs the gcc/g++ package.
<sub>Pre-built bindings are provided with a fallback to building from source with cmake</sub>

Type this command into your terminal and run it.

βœ… Check that an executable was created inside the build folder, then run it directly (e.g. ./build/app_name).

Pulled directly from this repo's README.

3. Node.js

Easy
Prerequisites
  • Git Needed to download the project code from GitHub.
  • Node.js Node.js must be installed to use npm. The LTS version is recommended.
npm install node-llama-cpp

Downloads and installs the libraries listed in package.json.

βœ… After running the command, open the address shown in the terminal (usually something like http://localhost:3000) in your browser.

Pulled directly from this repo's README.

// repository documentation