Skip to content
프로젝트

소개

llama.cpp용 node.js 바인딩으로 컴퓨터에서 AI 모델을 로컬로 실행합니다. 생성 단계에서 모델 출력에 JSON 스키마를 강제할 수 있습니다

AI 및 머신러닝

이 수치를 측정하는 방법

What you can do

  • Run LLMs locally on your machine
  • Metal, CUDA and Vulkan support
  • Pre-built binaries are provided, with a fallback to building from source without node-gyp or Python
  • Adapts to your hardware automatically, no need to configure anything

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
+6
in 1 month
+13

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original
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

✨ New: Structured Decisions with any model ✨

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


Star please

If you like this repo, star it ✨                                                    

관련 프로젝트 살펴보기

불러오는 중…