mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-07 19:40:21 +00:00
nodejs bindings (#602)
* chore: boilerplate, refactor in future * chore: boilerplate * feat: can compile succesfully * document .gyp file * add src, test and fix gyp * progress on prompting and some helper methods * add destructor and basic prompting work, prepare download function * download function done * download function edits and adding documentation * fix bindings memory issue and add tests and specs * add more documentation and readme * add npmignore * Update README.md Signed-off-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> * Update package.json - redundant scripts Signed-off-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> --------- Signed-off-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
This commit is contained in:
32
gpt4all-bindings/typescript/spec/index.mjs
Normal file
32
gpt4all-bindings/typescript/spec/index.mjs
Normal file
@@ -0,0 +1,32 @@
|
||||
import { LLModel, prompt, createCompletion } from '../src/gpt4all.js'
|
||||
|
||||
|
||||
|
||||
const ll = new LLModel("./ggml-vicuna-7b-1.1-q4_2.bin");
|
||||
|
||||
|
||||
try {
|
||||
class Extended extends LLModel {
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
console.log("Extending from native class gone wrong " + e)
|
||||
}
|
||||
|
||||
console.log("state size " + ll.stateSize())
|
||||
|
||||
console.log("thread count " + ll.threadCount());
|
||||
ll.setThreadCount(5);
|
||||
console.log("thread count " + ll.threadCount());
|
||||
ll.setThreadCount(4);
|
||||
console.log("thread count " + ll.threadCount());
|
||||
|
||||
|
||||
console.log(createCompletion(
|
||||
ll,
|
||||
prompt`${"header"} ${"prompt"}`, {
|
||||
verbose: true,
|
||||
prompt: 'hello! Say something thought provoking.'
|
||||
}
|
||||
));
|
||||
|
Reference in New Issue
Block a user