AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Limits for RiveScript?
 
 

Are there limits regarding number of categories / topic files that can be placed in the brain folder in Rivescript-js? I am using an external server that ordinarily works quite well.

Am I correct in that the same amount and name of inserted brain files must reside in both the brain folder AND in the chat.html file?

My browsers (Chrome / Firefox) both worked with the minimum / startup files but I grew tired of the eliza file, removed it and began inserting my own (that previously worked fine under the command prompt mode and a somewhat dated version of RS).

I have a total (not counting other brain files which haven’t been completed nor added), of 36 files with 92,800 lines of code totaling almost 2 MB. The files that make up the bot’s brain are modified files like ‘admin.rive, aimla.rive, aimlb.rive, aimlc.rive, begin.rive’ and so forth.

As it is the chat.html loads in and waits, stating in the Text entry box to please wait…loading….

Should I have loaded these files into the chat.html entry one at a time, then run the browser & chat.html, repeat as necessary?

I would appreciate some help. Retirement is starting not to be as much fun any longer. :(

Thanks!

 

 
  [ # 1 ]

As a follow up, I started with the 5 or 6 base files (minus the eliza and RGP game file).

I took a chance after doing more reading and added all the .rive files that I wanted my bot to use to the brain folder.

Then I added the name of a single .rive file to the chat.html file in the brain load section of the rivescript-js folder. Sounds more complicated than it is.

I started the server then Firefox, followed by the localhost command to get to the Rivescript files. Success!

The input line allow me to test some Trigger words that were contained in the file.

Quit Firefox.

Add another .rive file name to the chat.html file in the correct section. Test again. Good!

Repeated process until all my desired files were listed in the chat.html file.

By the time I was finished, it would take the bot about 6-7 seconds to load. Not too shabby.

The conversations went pretty smoothly and the chat interface works quite nicely!

Lots of fun and a lot of learning along the way.

Limits as in my previous posting? Well, at this point, I don’t see any and I’ve got practically all my files in the brain folder. There are a few more I’m working on like the memories and dream files. (yes, bots can have childhood memories and be able to dream too!) wink

Big thanks to Noah and to a new friend who is likewise quite interested in RiveScript! Thanks M!

 

 
  [ # 2 ]

The practical limitations of RiveScript mostly come down to how much RAM you have available (as the whole brain has to exist in memory to be used), and when you start getting a large amount of triggers, the speed of the processor and/or programming language runtime.

I have this GitHub repo where I was using the Alice brain to benchmark the performance of RiveScript across all the various implementations: https://github.com/aichaos/alice-benchmarks

Each of the implementations have varying performance for how quickly they can parse the .rive files and then how quickly they can scan their memory for a response. JavaScript performs the best overall.

A note about Alice, though: because of the way AIML works as opposed to RiveScript, Alice isn’t the most optimized brain for RiveScript. For example, in AIML you need one pattern for every permutation of a message (“hi”, “hello”, “hey”, etc.), whereas in RiveScript all the permutations can be represented in a single trigger; and Alice’s brain is full of triggers for all kinds of facts (“what is the capitol of Texas?”), and these could be greatly trimmed down by using an object macro that looks up facts in a database rather than needing so many hundreds of triggers. A bot personality designed for RiveScript could perform a lot better and with less triggers than the AIML-converted Alice brain.

Am I correct in that the same amount and name of inserted brain files must reside in both the brain folder AND in the chat.html file?

If you’re using rivescript-js embedded within a web page, then yes, you’ll have to manage the list of .rive files in your JavaScript (HTML) source. That’s because there isn’t a consistent way for JavaScript embedded in a web browser to enumerate the files in a directory on the server (for example, Apache and nginx both have different formatting for listing directories, and it would be an uphill battle to make RiveScript aware of how to handle these). If you’re using RiveScript from a server side program (in Node.js or otherwise), you can use the `loadDirectory()` function and just give it the path to the folder and it will automatically find the .rive files inside.

Also, to go back to the limitations on RAM and CPU speed, when you’re embedding RiveScript in a web page, the limitations are applied to the end user’s computer and not the server. This can result in varying performance depending on the end user’s device; if they’re on an older or weaker computer, or viewing your bot on their mobile device (which tend to be less powerful than desktop computers), the performance may drop for an especially large bot. If your RiveScript sources add up to about 2MB, you can roughly expect that ~2MB of RAM will be needed on the end user’s device to contain the bot in memory, and if the bot has to scan through 50,000 triggers on average to find a match to the user’s message, this can take longer on weaker devices than on more powerful ones.

If you’re running an Alice-sized bot, it would probably be better to run the bot on the server side and have the web front-end talk to it via ajax or websockets. This way you can fully control the RAM and CPU behind the bot with your server’s configuration and provide a consistent experience to the end user, regardless of their own device.

 

 
  login or register to react