node-llama-cpp 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +25 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/llama/binariesGithubRelease.json +1 -1
  6. package/llamaBins/linux-arm64-16.node +0 -0
  7. package/llamaBins/linux-arm64-17.node +0 -0
  8. package/llamaBins/linux-arm64-18.node +0 -0
  9. package/llamaBins/linux-arm64-19.node +0 -0
  10. package/llamaBins/linux-arm64-20.node +0 -0
  11. package/llamaBins/linux-armv7l-16.node +0 -0
  12. package/llamaBins/linux-armv7l-17.node +0 -0
  13. package/llamaBins/linux-armv7l-18.node +0 -0
  14. package/llamaBins/linux-armv7l-19.node +0 -0
  15. package/llamaBins/linux-armv7l-20.node +0 -0
  16. package/llamaBins/linux-ppc64le-16.node +0 -0
  17. package/llamaBins/linux-ppc64le-17.node +0 -0
  18. package/llamaBins/linux-ppc64le-18.node +0 -0
  19. package/llamaBins/linux-ppc64le-19.node +0 -0
  20. package/llamaBins/linux-ppc64le-20.node +0 -0
  21. package/llamaBins/linux-x64-16.node +0 -0
  22. package/llamaBins/linux-x64-17.node +0 -0
  23. package/llamaBins/linux-x64-18.node +0 -0
  24. package/llamaBins/linux-x64-19.node +0 -0
  25. package/llamaBins/linux-x64-20.node +0 -0
  26. package/llamaBins/mac-arm64-16.node +0 -0
  27. package/llamaBins/mac-arm64-17.node +0 -0
  28. package/llamaBins/mac-arm64-18.node +0 -0
  29. package/llamaBins/mac-arm64-19.node +0 -0
  30. package/llamaBins/mac-arm64-20.node +0 -0
  31. package/llamaBins/mac-x64-16.node +0 -0
  32. package/llamaBins/mac-x64-17.node +0 -0
  33. package/llamaBins/mac-x64-18.node +0 -0
  34. package/llamaBins/mac-x64-19.node +0 -0
  35. package/llamaBins/mac-x64-20.node +0 -0
  36. package/llamaBins/win-x64-16.node +0 -0
  37. package/llamaBins/win-x64-17.node +0 -0
  38. package/llamaBins/win-x64-18.node +0 -0
  39. package/llamaBins/win-x64-19.node +0 -0
  40. package/llamaBins/win-x64-20.node +0 -0
  41. package/package.json +3 -4
package/README.md CHANGED
@@ -175,6 +175,23 @@ console.log("AI: " + a2);
175
175
  console.log(JSON.parse(a2));
176
176
  ```
177
177
 
178
+ ### Metal and CUDA support
179
+ To load a version of `llama.cpp` that was compiled to use Metal or CUDA,
180
+ you have to build it from source with the `--metal` or `--cuda` flag before running your code that imports `node-llama-cpp`.
181
+
182
+ To do this, run this command inside of your project directory:
183
+ ```bash
184
+ # For Metal support on macOS
185
+ npx node-llama-cpp download --metal
186
+
187
+ # For CUDA support
188
+ npx node-llama-cpp download --cuda
189
+ ```
190
+
191
+ > In order for `node-llama-cpp` to be able to build `llama.cpp` from source, make sure you have the required dependencies of `node-gyp` installed.
192
+ >
193
+ > More info is available [here](https://github.com/nodejs/node-gyp#on-unix) (you don't have to install `node-gyp` itself, just the dependencies).
194
+
178
195
  ### CLI
179
196
  ```
180
197
  Usage: node-llama-cpp <command> [options]
@@ -206,6 +223,10 @@ Options:
206
223
  ronment variable [string] [default: "latest"]
207
224
  -a, --arch The architecture to compile llama.cpp for [string]
208
225
  -t, --nodeTarget The Node.js version to compile llama.cpp for. Example: v18.0.0 [string]
226
+ --metal Compile llama.cpp with Metal support. Can also be set via the NODE_LLAMA_CP
227
+ P_METAL environment variable [boolean] [default: false]
228
+ --cuda Compile llama.cpp with CUDA support. Can also be set via the NODE_LLAMA_CPP
229
+ _CUDA environment variable [boolean] [default: false]
209
230
  --skipBuild, --sb Skip building llama.cpp after downloading it [boolean] [default: false]
210
231
  -v, --version Show version number [boolean]
211
232
  ```
@@ -220,6 +241,10 @@ Options:
220
241
  -h, --help Show help [boolean]
221
242
  -a, --arch The architecture to compile llama.cpp for [string]
222
243
  -t, --nodeTarget The Node.js version to compile llama.cpp for. Example: v18.0.0 [string]
244
+ --metal Compile llama.cpp with Metal support. Can also be set via the NODE_LLAMA_CPP_MET
245
+ AL environment variable [boolean] [default: false]
246
+ --cuda Compile llama.cpp with CUDA support. Can also be set via the NODE_LLAMA_CPP_CUDA
247
+ environment variable [boolean] [default: false]
223
248
  -v, --version Show version number [boolean]
224
249
  ```
225
250
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { LlamaGrammar } from "llamaEvaluator/LlamaGrammar.js";
1
+ import { LlamaGrammar } from "./llamaEvaluator/LlamaGrammar.js";
2
2
  import { LlamaChatSession } from "./llamaEvaluator/LlamaChatSession.js";
3
3
  import { LlamaModel } from "./llamaEvaluator/LlamaModel.js";
4
4
  import { AbortError } from "./AbortError.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { LlamaGrammar } from "llamaEvaluator/LlamaGrammar.js";
1
+ import { LlamaGrammar } from "./llamaEvaluator/LlamaGrammar.js";
2
2
  import { LlamaChatSession } from "./llamaEvaluator/LlamaChatSession.js";
3
3
  import { LlamaModel } from "./llamaEvaluator/LlamaModel.js";
4
4
  import { AbortError } from "./AbortError.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAC,UAAU,EAAC,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAC,sBAAsB,EAAC,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAC,sBAAsB,EAAC,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAC,wBAAwB,EAAC,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAC,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAC,mBAAmB,EAAC,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,0CAA0C,CAAC;AAK7E,OAAO,EACH,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EAEtB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAC,UAAU,EAAC,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAC,sBAAsB,EAAC,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAC,sBAAsB,EAAC,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAC,wBAAwB,EAAC,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAC,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAC,mBAAmB,EAAC,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,0CAA0C,CAAC;AAK7E,OAAO,EACH,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EAEtB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  {
2
- "release": "b1107"
2
+ "release": "b1108"
3
3
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-llama-cpp",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "node.js bindings for llama.cpp",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -70,6 +70,8 @@
70
70
  "prebuilt-binaries",
71
71
  "llm",
72
72
  "gguf",
73
+ "metal",
74
+ "cuda",
73
75
  "grammar",
74
76
  "json-grammar",
75
77
  "temperature",
@@ -111,7 +113,6 @@
111
113
  "zx": "^7.2.3"
112
114
  },
113
115
  "dependencies": {
114
- "bytes": "^3.1.2",
115
116
  "chalk": "^5.3.0",
116
117
  "cli-progress": "^3.12.0",
117
118
  "cross-env": "^7.0.3",
@@ -119,9 +120,7 @@
119
120
  "env-var": "^7.3.1",
120
121
  "fs-extra": "^11.1.1",
121
122
  "node-addon-api": "^7.0.0",
122
- "node-downloader-helper": "^2.1.9",
123
123
  "node-gyp": "^9.4.0",
124
- "node-stream-zip": "^1.15.0",
125
124
  "octokit": "^3.1.0",
126
125
  "ora": "^7.0.1",
127
126
  "simple-git": "^3.19.1",