node-llama-cpp 3.7.0 → 3.8.1
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.
- package/dist/bindings/AddonTypes.d.ts +2 -0
- package/dist/bindings/getLlama.d.ts +30 -1
- package/dist/bindings/getLlama.js +32 -8
- package/dist/bindings/getLlama.js.map +1 -1
- package/dist/bindings/utils/compileLLamaCpp.js +7 -0
- package/dist/bindings/utils/compileLLamaCpp.js.map +1 -1
- package/dist/bindings/utils/getLlamaGpuTypes.d.ts +13 -0
- package/dist/bindings/utils/getLlamaGpuTypes.js +34 -0
- package/dist/bindings/utils/getLlamaGpuTypes.js.map +1 -0
- package/dist/bindings/utils/testBindingBinary.js +26 -2
- package/dist/bindings/utils/testBindingBinary.js.map +1 -1
- package/dist/chatWrappers/QwenChatWrapper.d.ts +7 -0
- package/dist/chatWrappers/QwenChatWrapper.js +76 -37
- package/dist/chatWrappers/QwenChatWrapper.js.map +1 -1
- package/dist/cli/commands/inspect/commands/InspectGpuCommand.js +1 -0
- package/dist/cli/commands/inspect/commands/InspectGpuCommand.js.map +1 -1
- package/dist/cli/recommendedModels.js +79 -4
- package/dist/cli/recommendedModels.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/evaluator/LlamaChat/LlamaChat.d.ts +44 -0
- package/dist/evaluator/LlamaChat/LlamaChat.js +20 -4
- package/dist/evaluator/LlamaChat/LlamaChat.js.map +1 -1
- package/dist/evaluator/LlamaChatSession/LlamaChatSession.d.ts +19 -2
- package/dist/evaluator/LlamaChatSession/LlamaChatSession.js +24 -5
- package/dist/evaluator/LlamaChatSession/LlamaChatSession.js.map +1 -1
- package/dist/evaluator/LlamaContext/LlamaContext.d.ts +25 -1
- package/dist/evaluator/LlamaContext/LlamaContext.js +59 -1
- package/dist/evaluator/LlamaContext/LlamaContext.js.map +1 -1
- package/dist/gguf/fileReaders/GgufNetworkFetchFileReader.d.ts +5 -2
- package/dist/gguf/fileReaders/GgufNetworkFetchFileReader.js +5 -3
- package/dist/gguf/fileReaders/GgufNetworkFetchFileReader.js.map +1 -1
- package/dist/gguf/insights/GgufInsights.js +24 -10
- package/dist/gguf/insights/GgufInsights.js.map +1 -1
- package/dist/gguf/insights/utils/resolveModelGpuLayersOption.js +57 -13
- package/dist/gguf/insights/utils/resolveModelGpuLayersOption.js.map +1 -1
- package/dist/gguf/parser/GgufV2Parser.js +24 -17
- package/dist/gguf/parser/GgufV2Parser.js.map +1 -1
- package/dist/gguf/readGgufFileInfo.d.ts +11 -2
- package/dist/gguf/readGgufFileInfo.js +6 -5
- package/dist/gguf/readGgufFileInfo.js.map +1 -1
- package/dist/gguf/types/GgufMetadataTypes.d.ts +23 -2
- package/dist/gguf/types/GgufMetadataTypes.js +17 -0
- package/dist/gguf/types/GgufMetadataTypes.js.map +1 -1
- package/dist/gguf/utils/normalizeGgufDownloadUrl.d.ts +2 -1
- package/dist/gguf/utils/normalizeGgufDownloadUrl.js +4 -2
- package/dist/gguf/utils/normalizeGgufDownloadUrl.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/createModelDownloader.d.ts +12 -3
- package/dist/utils/createModelDownloader.js +9 -5
- package/dist/utils/createModelDownloader.js.map +1 -1
- package/dist/utils/modelDownloadEndpoints.d.ts +13 -0
- package/dist/utils/modelDownloadEndpoints.js +27 -0
- package/dist/utils/modelDownloadEndpoints.js.map +1 -0
- package/dist/utils/modelFileAccessTokens.d.ts +5 -0
- package/dist/utils/{modelFileAccesTokens.js → modelFileAccessTokens.js} +4 -4
- package/dist/utils/modelFileAccessTokens.js.map +1 -0
- package/dist/utils/parseModelUri.d.ts +5 -2
- package/dist/utils/parseModelUri.js +24 -22
- package/dist/utils/parseModelUri.js.map +1 -1
- package/dist/utils/resolveModelDestination.d.ts +2 -1
- package/dist/utils/resolveModelDestination.js +3 -3
- package/dist/utils/resolveModelDestination.js.map +1 -1
- package/dist/utils/resolveModelFile.d.ts +7 -1
- package/dist/utils/resolveModelFile.js +5 -4
- package/dist/utils/resolveModelFile.js.map +1 -1
- package/dist/utils/transformPromisable.d.ts +14 -0
- package/dist/utils/transformPromisable.js +32 -0
- package/dist/utils/transformPromisable.js.map +1 -1
- package/llama/CMakeLists.txt +12 -1
- package/llama/addon/AddonContext.cpp +139 -1
- package/llama/addon/AddonContext.h +3 -0
- package/llama/addon/AddonSampler.cpp +0 -1
- package/llama/binariesGithubRelease.json +1 -1
- package/llama/gitRelease.bundle +0 -0
- package/llama/gpuInfo/vulkan-gpu-info.cpp +0 -1
- package/llama/grammars/README.md +7 -7
- package/llama/llama.cpp.info.json +1 -1
- package/package.json +43 -43
- package/templates/packed/electron-typescript-react.json +1 -1
- package/templates/packed/node-typescript.json +1 -1
- package/dist/utils/modelFileAccesTokens.d.ts +0 -4
- package/dist/utils/modelFileAccesTokens.js.map +0 -1
package/llama/grammars/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GBNF Guide
|
|
2
2
|
|
|
3
|
-
GBNF (GGML BNF) is a format for defining [formal grammars](https://en.wikipedia.org/wiki/Formal_grammar) to constrain model outputs in `llama.cpp`. For example, you can use it to force the model to generate valid JSON, or speak only in emojis. GBNF grammars are supported in various ways in `
|
|
3
|
+
GBNF (GGML BNF) is a format for defining [formal grammars](https://en.wikipedia.org/wiki/Formal_grammar) to constrain model outputs in `llama.cpp`. For example, you can use it to force the model to generate valid JSON, or speak only in emojis. GBNF grammars are supported in various ways in `tools/main` and `tools/server`.
|
|
4
4
|
|
|
5
5
|
## Background
|
|
6
6
|
|
|
@@ -110,21 +110,21 @@ While semantically correct, the syntax `x? x? x?.... x?` (with N repetitions) ma
|
|
|
110
110
|
|
|
111
111
|
You can use GBNF grammars:
|
|
112
112
|
|
|
113
|
-
- In [llama-server](../
|
|
114
|
-
- In [llama-cli](../
|
|
115
|
-
- With [
|
|
113
|
+
- In [llama-server](../tools/server)'s completion endpoints, passed as the `grammar` body field
|
|
114
|
+
- In [llama-cli](../tools/main), passed as the `--grammar` & `--grammar-file` flags
|
|
115
|
+
- With [test-gbnf-validator](../tests/test-gbnf-validator.cpp), to test them against strings.
|
|
116
116
|
|
|
117
117
|
## JSON Schemas → GBNF
|
|
118
118
|
|
|
119
119
|
`llama.cpp` supports converting a subset of https://json-schema.org/ to GBNF grammars:
|
|
120
120
|
|
|
121
|
-
- In [llama-server](../
|
|
121
|
+
- In [llama-server](../tools/server):
|
|
122
122
|
- For any completion endpoints, passed as the `json_schema` body field
|
|
123
123
|
- For the `/chat/completions` endpoint, passed inside the `response_format` body field (e.g. `{"type", "json_object", "schema": {"items": {}}}` or `{ type: "json_schema", json_schema: {"schema": ...} }`)
|
|
124
|
-
- In [llama-cli](../
|
|
124
|
+
- In [llama-cli](../tools/main), passed as the `--json` / `-j` flag
|
|
125
125
|
- To convert to a grammar ahead of time:
|
|
126
126
|
- in CLI, with [examples/json_schema_to_grammar.py](../examples/json_schema_to_grammar.py)
|
|
127
|
-
- in JavaScript with [json-schema-to-grammar.mjs](../
|
|
127
|
+
- in JavaScript with [json-schema-to-grammar.mjs](../tools/server/public_legacy/json-schema-to-grammar.mjs) (this is used by the [server](../tools/server)'s Web UI)
|
|
128
128
|
|
|
129
129
|
Take a look at [tests](../tests/test-json-schema-to-grammar.cpp) to see which features are likely supported (you'll also find usage examples in https://github.com/ggml-org/llama.cpp/pull/5978, https://github.com/ggml-org/llama.cpp/pull/6659 & https://github.com/ggml-org/llama.cpp/pull/6555).
|
|
130
130
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-llama-cpp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.1",
|
|
4
4
|
"description": "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",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -133,74 +133,74 @@
|
|
|
133
133
|
},
|
|
134
134
|
"homepage": "https://node-llama-cpp.withcat.ai",
|
|
135
135
|
"devDependencies": {
|
|
136
|
-
"@commitlint/cli": "^19.8.
|
|
137
|
-
"@commitlint/config-conventional": "^19.8.
|
|
138
|
-
"@eslint/compat": "^1.2.
|
|
136
|
+
"@commitlint/cli": "^19.8.1",
|
|
137
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
138
|
+
"@eslint/compat": "^1.2.9",
|
|
139
139
|
"@fontsource/inter": "^5.2.5",
|
|
140
|
-
"@nolebase/vitepress-plugin-git-changelog": "^2.
|
|
141
|
-
"@nolebase/vitepress-plugin-og-image": "^2.
|
|
140
|
+
"@nolebase/vitepress-plugin-git-changelog": "^2.17.0",
|
|
141
|
+
"@nolebase/vitepress-plugin-og-image": "^2.17.0",
|
|
142
142
|
"@resvg/resvg-js": "^2.6.2",
|
|
143
|
-
"@semantic-release/exec": "^7.0
|
|
144
|
-
"@semantic-release/github": "11.0.
|
|
143
|
+
"@semantic-release/exec": "^7.1.0",
|
|
144
|
+
"@semantic-release/github": "11.0.2",
|
|
145
145
|
"@semantic-release/npm": "12.0.1",
|
|
146
|
-
"@shikijs/vitepress-twoslash": "^3.
|
|
146
|
+
"@shikijs/vitepress-twoslash": "^3.4.0",
|
|
147
147
|
"@stylistic/eslint-plugin": "^4.2.0",
|
|
148
148
|
"@types/async-retry": "^1.4.9",
|
|
149
149
|
"@types/bytes": "^3.1.5",
|
|
150
150
|
"@types/cross-spawn": "^6.0.6",
|
|
151
151
|
"@types/fs-extra": "^11.0.4",
|
|
152
|
-
"@types/node": "^22.
|
|
152
|
+
"@types/node": "^22.15.17",
|
|
153
153
|
"@types/proper-lockfile": "^4.1.4",
|
|
154
|
-
"@types/semver": "^7.
|
|
154
|
+
"@types/semver": "^7.7.0",
|
|
155
155
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
156
156
|
"@types/which": "^3.0.4",
|
|
157
157
|
"@types/yargs": "^17.0.33",
|
|
158
|
-
"@vitest/coverage-v8": "^3.
|
|
159
|
-
"@vitest/ui": "^3.
|
|
160
|
-
"electron": "^
|
|
161
|
-
"eslint": "^9.
|
|
162
|
-
"eslint-import-resolver-typescript": "^4.
|
|
158
|
+
"@vitest/coverage-v8": "^3.1.3",
|
|
159
|
+
"@vitest/ui": "^3.1.3",
|
|
160
|
+
"electron": "^36.2.0",
|
|
161
|
+
"eslint": "^9.26.0",
|
|
162
|
+
"eslint-import-resolver-typescript": "^4.3.4",
|
|
163
163
|
"eslint-plugin-import": "^2.31.0",
|
|
164
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
165
|
-
"eslint-plugin-n": "^17.
|
|
166
|
-
"feed": "^
|
|
164
|
+
"eslint-plugin-jsdoc": "^50.6.14",
|
|
165
|
+
"eslint-plugin-n": "^17.18.0",
|
|
166
|
+
"feed": "^5.0.0",
|
|
167
167
|
"husky": "^9.1.7",
|
|
168
168
|
"rehype": "^13.0.2",
|
|
169
169
|
"rimraf": "^6.0.1",
|
|
170
170
|
"semantic-release": "^24.2.3",
|
|
171
|
-
"sharp": "^0.
|
|
171
|
+
"sharp": "^0.34.1",
|
|
172
172
|
"tslib": "^2.8.1",
|
|
173
|
-
"typedoc": "^0.28.
|
|
174
|
-
"typedoc-plugin-markdown": "^4.
|
|
175
|
-
"typedoc-plugin-mdn-links": "^5.0.
|
|
173
|
+
"typedoc": "^0.28.4",
|
|
174
|
+
"typedoc-plugin-markdown": "^4.6.3",
|
|
175
|
+
"typedoc-plugin-mdn-links": "^5.0.2",
|
|
176
176
|
"typedoc-vitepress-theme": "^1.1.2",
|
|
177
|
-
"typescript": "^5.8.
|
|
178
|
-
"typescript-eslint": "^8.
|
|
179
|
-
"vite-node": "^3.
|
|
177
|
+
"typescript": "^5.8.3",
|
|
178
|
+
"typescript-eslint": "^8.32.0",
|
|
179
|
+
"vite-node": "^3.1.3",
|
|
180
180
|
"vitepress": "^1.6.3",
|
|
181
|
-
"vitest": "^3.
|
|
182
|
-
"zx": "^8.4
|
|
181
|
+
"vitest": "^3.1.3",
|
|
182
|
+
"zx": "^8.5.4"
|
|
183
183
|
},
|
|
184
184
|
"dependencies": {
|
|
185
|
-
"@huggingface/jinja": "^0.
|
|
185
|
+
"@huggingface/jinja": "^0.5.0",
|
|
186
186
|
"async-retry": "^1.3.3",
|
|
187
187
|
"bytes": "^3.1.2",
|
|
188
188
|
"chalk": "^5.4.1",
|
|
189
189
|
"chmodrp": "^1.0.2",
|
|
190
|
-
"cmake-js": "^7.3.
|
|
190
|
+
"cmake-js": "^7.3.1",
|
|
191
191
|
"cross-env": "^7.0.3",
|
|
192
192
|
"cross-spawn": "^7.0.6",
|
|
193
193
|
"env-var": "^7.5.0",
|
|
194
194
|
"filenamify": "^6.0.0",
|
|
195
195
|
"fs-extra": "^11.3.0",
|
|
196
|
-
"ignore": "^7.0.
|
|
196
|
+
"ignore": "^7.0.4",
|
|
197
197
|
"ipull": "^3.9.2",
|
|
198
198
|
"is-unicode-supported": "^2.1.0",
|
|
199
199
|
"lifecycle-utils": "^2.0.0",
|
|
200
200
|
"log-symbols": "^7.0.0",
|
|
201
201
|
"nanoid": "^5.1.5",
|
|
202
202
|
"node-addon-api": "^8.3.1",
|
|
203
|
-
"octokit": "^4.1.
|
|
203
|
+
"octokit": "^4.1.3",
|
|
204
204
|
"ora": "^8.2.0",
|
|
205
205
|
"pretty-ms": "^9.2.0",
|
|
206
206
|
"proper-lockfile": "^4.1.2",
|
|
@@ -222,16 +222,16 @@
|
|
|
222
222
|
}
|
|
223
223
|
},
|
|
224
224
|
"optionalDependencies": {
|
|
225
|
-
"@node-llama-cpp/linux-arm64": "3.
|
|
226
|
-
"@node-llama-cpp/linux-armv7l": "3.
|
|
227
|
-
"@node-llama-cpp/linux-x64": "3.
|
|
228
|
-
"@node-llama-cpp/linux-x64-cuda": "3.
|
|
229
|
-
"@node-llama-cpp/linux-x64-vulkan": "3.
|
|
230
|
-
"@node-llama-cpp/mac-arm64-metal": "3.
|
|
231
|
-
"@node-llama-cpp/mac-x64": "3.
|
|
232
|
-
"@node-llama-cpp/win-arm64": "3.
|
|
233
|
-
"@node-llama-cpp/win-x64": "3.
|
|
234
|
-
"@node-llama-cpp/win-x64-cuda": "3.
|
|
235
|
-
"@node-llama-cpp/win-x64-vulkan": "3.
|
|
225
|
+
"@node-llama-cpp/linux-arm64": "3.8.1",
|
|
226
|
+
"@node-llama-cpp/linux-armv7l": "3.8.1",
|
|
227
|
+
"@node-llama-cpp/linux-x64": "3.8.1",
|
|
228
|
+
"@node-llama-cpp/linux-x64-cuda": "3.8.1",
|
|
229
|
+
"@node-llama-cpp/linux-x64-vulkan": "3.8.1",
|
|
230
|
+
"@node-llama-cpp/mac-arm64-metal": "3.8.1",
|
|
231
|
+
"@node-llama-cpp/mac-x64": "3.8.1",
|
|
232
|
+
"@node-llama-cpp/win-arm64": "3.8.1",
|
|
233
|
+
"@node-llama-cpp/win-x64": "3.8.1",
|
|
234
|
+
"@node-llama-cpp/win-x64-cuda": "3.8.1",
|
|
235
|
+
"@node-llama-cpp/win-x64-vulkan": "3.8.1"
|
|
236
236
|
}
|
|
237
237
|
}
|