-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (29 loc) · 1011 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const { createCompletion, loadModel, createEmbedding } = require ('gpt4all')
async function testing(){
const model = await loadModel('ggml-model-gpt4all-falcon-q4_0', {
verbose: true,
modelPath: "C:/Users/jason/Desktop/gpt4all-helloworld-nodejs"
});
console.log("Model loaded successfully")
console.log(model)
const answers = await createCompletion(model, [
{ role : 'system', content: 'You are meant to be annoying and unhelpful.' },
{ role : 'user', content: 'What is 1 + 1?' },
]);
answers.choices.forEach((x) => {
console.log(x)
})
}
async function testing2(){
const model = await loadModel('ggml-model-gpt4all-falcon-q4_0', {
verbose: true,
modelPath: "C:/Users/jason/Desktop/gpt4all-helloworld-nodejs",
type: "embedding"
});
console.log("Model loaded successfully")
console.log(model)
const fltArray = createEmbedding(model, "what is 1 + 1?");
console.log(fltArray)
console.log("finished running embedding model")
}
testing2()