2.8.9 • Published 4 days ago

node-llama-cpp v2.8.9

Weekly downloads
-
License
MIT
Repository
github
Last release
4 days ago

Build License Types Version

Features

  • Run a text generation model locally on your machine
  • Metal and CUDA support
  • Pre-built binaries are provided, with a fallback to building from source without node-gyp or Python
  • Chat with a model using a chat wrapper
  • Use the CLI to chat with a model without writing any code
  • Up-to-date with the latest version of llama.cpp. Download and compile the latest release with a single CLI command.
  • Force a model to generate output in a parseable format, like JSON, or even force it to follow a specific JSON schema

Documentation

Installation

npm install --save 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 the latest version 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 {LlamaModel, LlamaContext, LlamaChatSession} from "node-llama-cpp";

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

const model = new LlamaModel({
    modelPath: path.join(__dirname, "models", "codellama-13b.Q3_K_M.gguf")
});
const context = new LlamaContext({model});
const session = new LlamaChatSession({context});


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

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


const q2 = "Summerize 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

3.0.0-beta.17

4 days ago

3.0.0-beta.16

15 days ago

3.0.0-beta.15

24 days ago

2.8.9

1 month ago

3.0.0-beta.14

1 month ago

3.0.0-beta.13

2 months ago

3.0.0-beta.12

2 months ago

2.8.8

2 months ago

3.0.0-beta.11

2 months ago

2.8.7

2 months ago

3.0.0-beta.10

3 months ago

3.0.0-beta.9

3 months ago

2.8.6

3 months ago

3.0.0-beta.7

3 months ago

3.0.0-beta.8

3 months ago

3.0.0-beta.6

3 months ago

3.0.0-beta.5

3 months ago

3.0.0-beta.3

3 months ago

3.0.0-beta.2

3 months ago

3.0.0-beta.4

3 months ago

2.8.5

3 months ago

2.8.4

3 months ago

2.8.3

4 months ago

2.8.2

5 months ago

2.8.1

5 months ago

3.0.0-beta.1

5 months ago

2.5.0

7 months ago

2.7.0

7 months ago

2.6.1

7 months ago

2.6.0

7 months ago

2.5.1

7 months ago

2.7.2

7 months ago

2.6.3

7 months ago

2.8.0

6 months ago

2.7.1

7 months ago

2.6.2

7 months ago

2.7.4

6 months ago

2.7.3

7 months ago

2.7.5

6 months ago

2.4.1

8 months ago

2.4.0

8 months ago

2.3.2

8 months ago

2.3.1

8 months ago

2.3.0

8 months ago

2.2.0

8 months ago

2.1.2

8 months ago

2.1.1

8 months ago

2.1.0

8 months ago

2.0.0

8 months ago

1.3.1

8 months ago

1.3.0

8 months ago

1.2.1

9 months ago

1.2.0

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago

0.0.1

9 months ago

1.0.0

9 months ago