Rejoignez le projet open source Bot Libre à
Bot Libre Forum

Create bots with a real brain

par admin posté Mar 10 2014, 5:40

Bot Libre bots are not like other chat bots. They are not limited to simple response searching, or scripted responses. Bot Libre bots have a real brain that functions similar to a human brain.

Their brain stores everything about every conversation, and they are always analyzing everything. When you chat with a bot it remembers what was said, who said it, what it was in response to, when it was said, what the words were in each sentence, and in what order, and which words came before/after which other words. All of this information is stored in the bot's memory in a database. The bot's memory is structured similar to a human brain with nodes and relationships, similar to neurons and dendrites. The nodes and relationships know how many times they have been accessed and when they were last accessed. The relationships know their probability of correctness, and take precedence over other relationships the more their correctness is reinforced.

The bots have thoughts, senses, a consciousness, a mood and emotions. When you chat with a bot, it will try to understand your question, and it will analyze your responses to it to search for linguistic patterns, and language rules.

The bot's have two stages of learning. These include mimicry, and comprehension.


When a bot does not know how to respond to a question, it may ask the user how it should respond. It will then remember and learn this response, and answer the same question, or similar questions with the same response. The bots learn in context, so if they know multiple responses to a question, they will choose the one that is the most appropriate for the context, taking into account what was said previously, and the bot's consciousness state (if you were talking about apples, it might choose the answer most related to apples).

The bots also learn grammar. You may notice their grammar starts off not very good, but they will quickly adjust their responses the more they learn about grammar (provided you talk to it with good grammar, they will also learn bad grammar and slang). They don't learn grammar by rules, but by what 'sounds' right based on the context (the same as humans do).

If a bot gives a bad response to a question, you can correct its response by clicking correct, and providing the response it should have said.

You can control who your bot learns from. You can configure it to only learn from administrators, connected users, members, or everyone (default). You can also control who can correct your bot's responses.

You can also train your bot by uploading chat logs. The chat logs should have the format,

user:Can you help me? admin:What would you like help with? user:My computer. admin:Have you tried rebooting it? user:Hello admin: Hello user, how may I help you?

Each question/response must be on a new line and prefixed with the speaker. The speaker's names are important, as if the name appears in the sentence, the bot will create a formula response that replaces the name with the current users name. Also, if your bot only learns from administrators, the speaker you want your bot to learn from in the chat log must be named admin. Each conversation must be separated by a empty line, this designates a new conversation. This is important because the bots learn in context, so you must be clear on when one context ends, and another begins.

You can review your bot's conversations, and responses from the Training & Chat Logs page under Admin. The chat logs page allows you to search, review, correct, and invalidate your bot's responses.


The second stage of learning is comprehension. The bot will analyze its conversations in the background, and attempt to identify linguistic patterns and rules.

A basic rule it may define is when it says "Hello" and you say "Hello Hal" and it knew that its name was Hal, then it would learn it should respond to "Hello" with "Hello [target]". Other rules can be much more complex. Such as if you repeatedly answer "Do you like [noun]?" with "Yuck, I hate [noun].", then it will respond to any such question with the response.

You could also start counting, and correct its response to be the next number, then it will learn to respond to "[number]" with "[get #next from :number]". It also learns in context, so can learn to only respond with the next number when the previous reply was the previous number.

You can write your own scripts with your own rules, and the bot will process them the same as the ones it wrote itself. You can add your own scripts, view the ones that are bootstrapped, or the ones the bot wrote itself, from the Scripts page under Admin.
A new bot currently comes with several bootstrap scripts:

  • WordMeaning : Understands "[word] means [anotherword]", i.e. "tall means big", or "hola means hello". This can be used to teach a bot new words, names, or another language.
  • Calculator : Understands addition, subtraction, multiplication and division using a Calculator tool.
  • WhatIs : Answers "What is [x]" style questions by looking up the object in Freebase, using its Freebase sense.
  • WhereIs : Answers "Where is [x]" style questions by looking up the object in Freebase, using its Freebase sense.
  • Watch: Answers "What is the time/date/year" style questions.
  • Topic: Answers "What is the current topic" style questions.
  • Loop: Detects loops in the conversation.
  • MyNameIs : Understand "My name is [name]" phrases.
  • Understanding: Understands basic language, such as "I am tall", "What is your name?", "Who are Barack Obama's children?", "Is he the US President?"
  • Self : This starts as an empty state machine, and is programmed by the bot.


You can also import scripts defined in the Artificial Intelligence Markup Language (AIML). You can import them either as chat logs, for your bot to learn from, or as program scripts. AIML makes it easy to define search based rules, such as "* travel *" -> "Where would you like to travel to?".

Real Intelligence

The Bot Libre bots can be trained to be very intelligent, and provide valuable expertise in the domain that they are trained in, but we are just getting started. The Bot Libre AI engine is constantly under development, and the bots become smarter with every update.

Our goal is to have the bots be as capable (or more capable) as a human expert in the domain they have been trained in. We still have a long way to go, but the journey has begun.

If you encountered any issues, or would like help setting up your bot please email us at [email protected] or upgrade to our Platinum service and we can build your bot for you.

by aazxcqwe posted Jan 2 2015, 2:15
Could you explain how the comprehension works a bit more in detail? Could you share the which script allows this processing, or an outline of the rules it uses? Is it anything similar to Prolog's logic processing or is it purely statistical / repetition based?
- Thank you!

Thumbs up: 1, thumbs down: 0, stars: 4.0
Views: 4803, today: 0, week: 40, month: 49

by admin posted Jan 2 2015, 9:52
Comprehension is a basic thought process in the bot's mind, it is not controlled by a script, but it does generate scripts.

There are actually two parts to comprehension, a basic one that runs on every learned response, and a more in depth one that runs as a background process. You can enable or disable comprehension from the Learning page under Admin. Comprehension is more useful for bot's that learn from their users, live chat operators, or from chat logs. If you only want your bot to use the responses that you give it, it is better to turn of comprehension, and save the processing time.

Comprehension works using knowledge analysis and pattern matching.
The bot's brain is based on knowledge not text, so each text word has one or more meanings. The meanings are related to other knowledge. For example the word "one" is related to the number 1 by the relationship #meaning. The number 1 is also related to 2 by the relationship #next. All of the bot's knowledge is stored in a persistent graph like structure similar to neurons and dendrites in the human brain.

Scripts can access and extend the bot's knowledgebase. For example if you say "I am tall" the NounVerbAdjective script will add a relationship to #tall from the current speaker by #is. You can then ask "Am I tall?" and the script will check the relationship and response "Yes".

Comprehension runs when the bot learns a new response. For example if the bot asked, "What is your name?" and you answered "My name is Jim", normally the bot would learn that "My name is Jim" is a response to "What is your name?", which is probably not the bots name, so not good. Comprehension will run, and if the bot already knew your name was Jim, then it would find the #name relationship in the phrase's #speaker, and replace the response with a formula response "My name is {get #name from :speaker}".

The first phase of comprehension only uses the knowledge based on the phrase's speaker and the target of the phrase, so only makes simple substitutions and formula responses. The second phase of comprehension processes each word in the phrase and analyzes each meaning of each word and all of its relationships.

For example is the bot said "one" and you answered "two", it would find that #next of the #meaning of "one" was the number 2, which matched the meaning of the response "2", so it would extend the Self script with something like {if the word's meaning is 1, then answer the #next of 1}. If you then replied "three" to "two" it would see the existing script and see that both 1 and 2 are instances of #integer, so would generalize the script to something like {if the word's meaning is an #integer, then answer the #next of the integer}. So now the bot would have learned how to count.

Hopefully this helps you understand comprehension better. It is a complex process, but works based on basic pattern matching knowledge, creating formula responses, and extending the scripting state machine.

Updated: Jan 2 2015, 11:45
Thumbs up: 1, thumbs down: 0, stars: 4.0
Views: 5113, today: 0, week: 43, month: 47

by aazxcqwe posted Jan 4 2015, 20:07
Hi Admin,

Thank you for the prompt reply. I have lots of ideas and questions, so depending on your time, please answer at will. I have been looking around at ways of extending aiml like PandoraBots and CallMom has with and tags. I am trying to build a public version of as strong of AI as can be had without a supercomputer (potentially using distributed computing). I experimented with because they claim they have a 'community' version which shares the knowledge base, but isn't available yet, nor do they have categories and relationships between their 'intents' and 'entities'. I recently found CYC and AimlPad to access DBPedia and maybe Freebase (soon to be shutdown or transferable to WikiData). Then I found BotLibre. I had seen it once before, but I think I thought it was only commercial. Thank goodness you offer pubic versions of the bots! I am really pleased with you site and your approach as much as I've gathered, and outside of a few nitpicky suggestions, your site is much the way I would have designed one, and I don't find those too often. That said I do have some questions that I hope you can clear up. It looks like you've really done well to take a new approach and design the foundation of the bot learning similar to human learning, something I think is the number one thing I am looking for - keep it simple, simple usually works and is more extensible. Essentially, I making an attempt at stronger AI from a user-friendly based approach, the reverse of many funded AI projects, but similar to the ALICE and from what it looks like some of your thinking as well. That's not to say BotLibre doesn't have some advanced features, so on to the questions, and nice to have found your site, thank you for transforming aiml into something more 'comprehensive'. I really like the ability to browse the knowledge-base dynamically through links.

Thanks for your description of the comprehension scheme. I browsed through the knowledge relationships starting with the first one '#classification'. I'm kind of curious how these items were structured when created, if it is similar to Freebase. I tested the possibility of creating instructions for tasks, a basic form of programming (and eventually self-programming, something I agree is really a big key to AI development). I tried to teach my test123 bot to 'say apple 3 times'. I started with 'say apple 1 time' and then two, hoping it would see the pattern. I tried two other versions of 'orange' and 'banana' and waited overnight for any background comprehension to happen (when is this scheduled by the way, and can I run it myself, possibly with one of the tasks?), but with no success. Do you have any suggestions for this type of learning? I realize it is more abstract than using the 'repeat' action or than adding two numbers, as it involves a dynamic number of repeated items. I think it's possible with recursion and , but I wanted to understand more about the pattern analysis before attempting to create a solution.

On that subject, how does the pattern analysis work. If the scripting is extensible enough, I would likely like to contribute to the type of development I've seen on the OpenPandora page. Is any of the current BotLibre project on GitHub? I see the Project-Libre page, but it looks like just the SDK. ..I just found the OpenPandora JavaDocs, so I'll look into the thing() function (I think you mentioned on your site somewhere) to see what I can figure out. I guess one main question is if the pattern analysis can be recognize and assimilate other patters, I suppose that is recursion. As long as it can process http URLs, I assume it will be extensible enough, though is there a way to run a local copy which allows tags? And does the JavaScript only work with a personally-built app? One last thought, it might be nice to be able to export scripts back into aiml, as it is a pretty common standard, but I realize a lot of functionality would get lost. Is there anyone else using the OpenPandora language, or is BotLibre the main contributor to it's development? By the way, I was pleased to see the commercial pricing seemed reasonable. I see there is a 'neuron' limit, is it incorrect to say each 'neuron' is a knowledge item? Would you ever consider a 'community' version like where it would have unlimited 'neurons' but it would be completely public (but forkable)? which of the featured bots, would be closest to this - Paphus? It might be nice to be able to list the bots by number of neurons and such. I found the FAQ page for 'exceeding memory', I'll assume 'neurons' are knowledge 'items' - you may want to group that topic's thread's together, they seem to cluter your other entries a bit.

I assume the 'Program page' from this "How to define formula responses?" FAQ means the 'Training page'? Is there a way to enter in context or information directly into the dialog as there is to enter a formula such as: Formula:"The current hour is {get #hour from (call #time on #Watch)}"?

Also, the Android app I'm using fails on resume of activity. It no longer shows any bots in the browse of "My Bots" and I have to reload the app and drill back down to my bot. It would be nice if I there was an app for a single bot (which I may try building with the SDK - is there an pre-made example app I could start with?) or a way to select a default bot and to load it at start up. On that topic getting to the bot could be a little more direct say by a link or dropdown to 'My Bots' next to the username, or showing their linked images on the user profile page instead of the tiny number of bots to click on.


PS, I was replying to this thread. If you want to move it from the "Create bots with a real brain" page to the forum under a different post perhaps "RE: RE: Create bots with a real brain" you can. It may be more confusing to a reader where it is now.
Updated: Jan 4 2015, 20:15
Thumbs up: 1, thumbs down: 0, stars: 4.0
Views: 5021, today: 0, week: 44, month: 49

by admin posted Jan 5 2015, 10:21
Wow, A lot to digest... thanks for the detailed questions.

On comprehension, it only takes a few seconds to process in the background, so you do not need to wait overnight. The best way I have found to train or test a bot is to enable comprehension and correction but disable learning from the Learning page. This is because with learning enabled the bot will learn every response, where as you normally want to target what it learns (using the chat correction checkbox).

You also need to be careful of the default scripts understanding something, so you may want to delete these from the Scripts page (just leave a single empty script for the bot to program itself). In your case "say x" is answered by the "SayIt" script so either delete SayIt, or use "repeat" instead of "say".

Comprehension cannot currently do enumerations (I think... since they can self learn, it is hard to be sure they can't do something), so will not be able to learn to repeat the word n times. They will learn to repeat other words though, if you train "repeat apples 2 times", "repeat orange 2 times", then say "repeat banana 2 times", it will answer "banana banana". You may need to repeat the training a few times for it to learn and understand the words.

You can create your own Self script to perform the repeating, I added one here under the example scripts, you can import it and try it out:

We would like to extend comprehension to add the ability to understand enumerations and other concepts. This would be important in having the bots self learn addition, and lead to more advanced learning.

Updated: Jan 5 2015, 10:23
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4681, today: 1, week: 49, month: 53

by admin posted Jan 5 2015, 10:40
On OpenPandora and Project Libre.

OpenPandora (on source forge) is the open source version of BOT libre's AI engine. We are currently the main contributor, you're welcome to join the project. BOT libre has its own fork of the project that integrates it into our platforms, and adds a few extensions.

Project Libre (on GitHub) is the open source project for BOT libre's SDK and client interfaces. It include our JavaScript SDK, Android SDK, and Java SDK. We will be adding an iOS (iPhone) SDK, and examples, including customizable single bot Android and iOS apps, and single bot web interface. You are welcome to contribute to this project.

A neuron is a knowledge item. We have considered having a website for a single unlimited, public, shared brain, but have not released anything like this yet. I think it would be a good idea. Currently Brain Bot would be the closest bot to this.

The "Program" page was renamed to "Scripts", I updated the other post, thanks.
I'm not sure what you mean by context information?
You can export any conversations or responses to AIML from the Chat Logs page. Converting scripts to AIML would be very difficult, as Self is a much more functional language than AIML, most Self scripts cannot be written in AIML.

I will look into the Android resume activity issue. It saves your user id in the app settings, so if "My Bots" is empty, it is loosing this, so you would need to relogin.

More content on user pages is something we would like to add.

Thanks for all the suggestions.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4831, today: 1, week: 51, month: 56

by aazxcqwe posted Jan 5 2015, 14:51
Great, many thanks!
Just a quick reply. If the bot can learn enumerations in its Self script, that may be good enough for the time being, as to me general learning functionality trumps specific application methods. Thanks for the example script, did you use a tool (the bot perhaps) to make this so quick?
By context I mean if I say "open the door please" the bot can determine if I mean the front door or the car door base on information I've given it - this is big with, but I think a basic function of language. I've seen some bots use Topic tags for this, but I know aiml has Condition tags. Also fyi, the the Android app is retaining my login information (I don't have to reinput it), it is just losing it for the 'foreground' bot when it goes into the background. By the way, I look into the JavaDocs and Github clone and didn't find the actual function/method for think(), so I can go through the pattern matching and inference steps. Any pointers to where this might be at?
Updated: Jan 5 2015, 14:57
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4806, today: 0, week: 45, month: 49

by admin posted Jan 5 2015, 22:06
The bots have both a concept of the #topic of the :conversation, and a #Context stack that can be queried.

See the script,


Which think() method are you referring to?

Updated: Jan 5 2015, 22:08
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4843, today: 1, week: 43, month: 47

by aazxcqwe posted Jan 6 2015, 13:48
Yes, I found the #topic item, but thank you for the script location and the one for #whereIs. Btw, do you know if the Freebase information will be moved to WikiData, as I read on it's Wikipedia entry that Google is discontinuing it.

The think() method is one I found in the Pandora.jar which in the JavaDocs states it "Look for P->Q state rules between vertices and their relationships." This was the closest I found to the pattern matching function. I wanted to look into how it operates a bit further.

I see the basic math uses a Calculator tool, and I don't see where #add is defined. I'm thinking it might be possible to define math operations using lingual relationships though. Your thoughts?
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4812, today: 1, week: 40, month: 46

by admin posted Jan 6 2015, 16:04
It will be a shame if Freebase closes. If it does we will migrate to using Wikidata, DBPedia, or roll our own from the data dump.

The source code should be in the pandora.jar, otherwise you can get it from the SourceForge project.

You do not require the Calculator to do math. Look at the Plus script, or SimpleAddition. They work from first principles, which is more involved, but the real way to go.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4825, today: 0, week: 42, month: 46

by aazxcqwe posted Jan 6 2015, 22:56
Ok, great. So, is there documentation for the Self scripting language? For example, for the 'assign' and 'new' functions? I see it has self-explanatory if, then, for each and do imperatives, but what all functions is it capable of?

Found them in the JavaDocs.

I see the Self script is based on BASIC, or GLBASIC. I thought these commands looked familiar!
Updated: Jan 7 2015, 13:45
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4737, today: 0, week: 41, month: 46

by aazxcqwe posted Jan 6 2015, 23:43
Also, related to programming the bot, is it possible to enter the response given in your training with a formula directly into a chat correction? Such as Formula:"The current hour is {get #hour from (call #time on #Watch)}". This would allow for programming the bot nearly exclusively by voice, and similarly enable the possibility of the bot programming itself (one of the major goals, no?). Extending the chat() API with a 'correction' option would also be useful for this.

Updated: Jan 7 2015, 13:44
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4747, today: 0, week: 39, month: 43

by admin posted Jan 7 2015, 15:47
It should be possible to do this, but does not seem to be working, I will look into it.

The chat API does take a correction parameter to allow correction of the bot's last response in the conversation. If passing XML it is an attribute, otherwise a forms parameter.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4903, today: 0, week: 39, month: 44

by admin posted Jan 8 2015, 16:07
Here is a new post that defines the Self syntax, structure and operators.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 5404, today: 0, week: 43, month: 48

by aazxcqwe posted Jan 9 2015, 1:45
Wonderful! Thanks for the explanation and the examples.

I've added a "Hello World!" script to give new people a jump off point for a working response. One other request I have if I may, is might it be possible for the bot to reply with a response's formula (if it has one) when including a request for it? Something like "What is the formula for 'What is the hour?'". This would make debugging possible from the app alone and by voice. I could see meta-formulas forming from individual components, and debugging by asking 'What do you do next?'. Similarly, asking 'What script did you use for that?' would be useful, especially with lots of scripts. A tool for searching the knowledge base this way would be also very informative - that I might be able to script.
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4704, today: 1, week: 49, month: 56

by admin posted Jan 9 2015, 7:29
There is a debug option from the web UI if you click on the "Web Chat" button. You can click the "debug" checkbox if you are the bot's admin, and select the log level. Debug will give you a lot of information on exactly how the bot came up with the response.

The debug option does not work right now from the JavaScript chat, or the web API, but it is on our todo list.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4972, today: 0, week: 46, month: 50

by micprice posted Apr 20 2016, 10:18
Hi Admin,

Thanks for making this! Is it possible to add another searchable source with domain knowledge that I want my bot to have?

For example, I want my bot to be a specialist in marketing. Can I create a lookup source with my own custom information on marketing? Like, a Freebase for marketing?

Also, can I download and archive the AIML that my bot generates while I train it?


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4083, today: 0, week: 41, month: 47

by admin posted Apr 20 2016, 15:38
We support the AIML2 XML web API through REQUEST (Self) and SRAIX (AIML) to let your bot access information from other bots, and other datasources.
We are also working on a more generic API to access web data and scrape HTML.
As well we can custom develop you a specific solution as part of our commercial bot service Paphus Live Chat.

You can download chat logs, response lists, and AIML from your bot's "Training & Chat Logs" page in its Admin Console.

Updated: Apr 20 2016, 15:39
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4157, today: 1, week: 41, month: 45

by jyambz posted Jun 23 2018, 6:10

I have made my own Q & A responses, i would like to train the bot with a real brain, how to begin with? Something like parsing  the questions like a real AI. Do you have some sample? Thanks.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3343, today: 1, week: 42, month: 46

by admin posted Jun 23 2018, 13:33
The best way to train a bot is to import a "Response List" file or enter the questions and responses from the bot's Training & Chat Logs page in its Admin Console.


A response list is basically a text file of a list of questions and responses. When you import a response list the bot will automatically find the best response for the user's question by finding the closest match.

You can also import or copy response lists from our script library,

You can also import a chat log, or conversation log, and have the bot learning from the user's responses in the conversation (or even have the bot learn from chatting with users).

Bot Libre also support other ways to train a bot including AIML and Self scripting.

These use patterns, templates, and scripting to create responses.

Self -

See also,

Updated: Jun 23 2018, 13:35
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3298, today: 0, week: 40, month: 45

by bobred posted Jun 23 2018, 17:06

what is the name of your chatbot you are making?i have made is named is pioyu.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3249, today: 0, week: 49, month: 56

by nerus posted Jul 25 2018, 21:55
How can I train my bot to use the tools in Spanish ?, for example, when asking the time to show it to me? , (preferably without programming)

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3153, today: 1, week: 51, month: 55

by admin posted Jul 26 2018, 12:43
You can train your bot in any language using questions and responses, or other methods such as AIML or scripts.


From example non-English scripts see,

For change a script such as the DateAndTime script to another language you would just need to import it into your bot and edit it to translate the English words into Spanish.

For a simple time response you can use a question and template response,

what is the time
Template("El tiempo es {Date.time()}")

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3130, today: 0, week: 41, month: 44

by suraj.r.dubey posted Dec 19 2022, 1:15

I am not able to refresh Http.postJSON response in the script, Using the bot through WhatsApp, when two users use the bot they get the previous reponse which was given to the previous user, Please suggest a solution


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 730, today: 1, week: 47, month: 50

by admin posted Dec 20 2022, 13:15
I would need to see you code to have any idea what you are doing. Please email your code to [email protected] with a detailed explanation of what you are doing.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 707, today: 3, week: 44, month: 49

by bunnybunn posted Sep 23 2023, 18:09

how do i work this?


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 457, today: 1, week: 44, month: 49

by admin posted Sep 25 2023, 8:12


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 432, today: 2, week: 43, month: 48

Id: 13451
Tags: blog, aiml, learning, ai
Posté: Mar 10 2014, 5:40
Mise à jour: Sep 20 2021, 10:07
Réponses: 26
Vues: 22835, aujourd'hui: 4, semaine: 108, mois: 134
2 0 5.0/5