dalai icon indicating copy to clipboard operation
dalai copied to clipboard

Node.js example returning toUpperCase error

Open Mammouth1979 opened this issue 1 year ago • 4 comments

const Dalai = require('dalai') new Dalai().request({ model: "7B", prompt: "The following is a conversation between a boy and a girl:", }, (token) => { process.stdout.write(token) })

return error Cannot read properties of undefined (reading 'toUpperCase') node_modules/dalai/index.js:160:19)

Mammouth1979 avatar Mar 21 '23 15:03 Mammouth1979

You need to specify the model "7B" for example "llama.7B" or "alpaca.7B"

Kucra avatar Mar 21 '23 19:03 Kucra

You need to specify the model "7B" for example "llama.7B" or "alpaca.7B"

I was about to answer but you already gave the solution. If you go to the line the error is highlighting you can see 1 line before the following: let [Core, Model] = req.model.split("."). So yeah. :)

LaraGuardiola avatar Mar 21 '23 19:03 LaraGuardiola

Just to be clear here is this correct?

` const Dalai = require('dalai') new Dalai().request({ model: "alpaca.7B", prompt: "The following is a conversation between a boy and a girl:", }, (token) => { process.stdout.write(token) })

`

chefbennyj1 avatar Mar 26 '23 00:03 chefbennyj1

oh, okay in earlier testing I used Dalai serve to access and test the bot. However, inorder to do this I has to rename "llama.cpp" to "main.cpp". Now, when attempting to use an express server in Node, I had to rename the .cpp file back to "llama.cpp", and it seems to load without the "toUpperCase" issue.

Also, making sure to set the "model" property to "llama.7B", or "alpaca.7B".

I have run into another issue which deserves it's own thread.

chefbennyj1 avatar Mar 26 '23 00:03 chefbennyj1

Hello, the process.stdout.write(token) method doesn't stop. How can I stop it forcibly or after the ending. Also it crashed when I used request twice in a row (probably my fault). Thank you

berksara145 avatar Mar 29 '23 23:03 berksara145