Welcome Aigents’ Bots

Any Aigents® bot can speak “controlled language”, called Aigents Language. It can be used to pose any directives to the Aigents engine, enter the new knowledge in forms of semantic relationships of query for that knowledge from the internal graph database. However, the “controlled “language” appears not expressive enough for novel users to perform simple searches against the data contained in the Aigents Core or maintain friendly and practical conversations with Aigents Engine. The Aigents Platform Core release 3.0.0 changes this, so the conversational interface supports free-text queries as well as extensible pattern-based conversation templates. Both kinds of interactions are supplied with emotional feedback and all of that is accompanying “classic controlled language” chat style.

Below we describe how to construct the Aigents® bot of your own to maintain conversations based on interactively defined templates, involving implicit and explicit search operations — all supplied with emotional feedback.

Setting up

You need your own Aigents Node running to get your proprietary Aigents’s bot. You can run it as a Server command-line (in the cloud or on the workstation), Desktop GUI application, or Mobile Android application on any smartphone or tablet. In any of these cases, you can either use a pre-built binary release or build it from open source yourself with your own customization. Here are the resources that you may need.

Making your bot accessible

You can make your bot accessible by others on either on your Web site or using any messenger platform with bot integration API such as the following.

Web site: You can run your Web site such as https://aigents.com re-using or replacing the current Aigents Demo Web UI. You can re-use only the small part of the Web UI such as “Chat” view supporting interactions with the Aigents Node, relying on the authentication flow based on email, secret question, and secret answer. Either Server or Desktop edition can be used to serve the Aigents Node.

Aigents Free Chat working on Aigents Web Demo site in the “Chat” view. Most of the replies above are based on interactively pre-configured “Aigents patterns” while the two replies on “What is artificial intelligence?” and “Are humans intelligent?” are provided by implicit search, so if no matching conversation patterns are found to provide a response, the search is done and the most relevant text snippet with a Web link is returned as a reply.

Telegram: You can configure your Telegram bot, no matter if your Aigents Node is a Server, Desktop, or even Mobile. Yes! You can run your Aigents bot on your smartphone or a tablet without the need of any server or desktop resources allocated at all. You need to use Telegram BotFather bot on Telegram to register your bot name and get token for it and then set up the bot name and token in chat session of your Aigents Node in the Server or Desktop “Chat” view. You need to use telegram name and telegram token properties for that, like it is shown on the following figure.

Getting telegram token from Telegram BotFather bot (on the right) and configuring telegram name and telegram token via Aigents Web UI (on the left) — replace the AigentsBot with your unique bot name and replace 99…9999 with the token supplied by the BotFather.
Configuring telegram name for the bot via Telegram BotFather bot (on the right) and configuring telegram name and telegram token via Aigents Desktop GUI (on the left) — replace the MyFirstAigentsBot with your unique bot name and replace 99…9999 with the token supplied by the BotFather.

Facebook and Slack: You can similarly configure the Aigents bot for Facebook Messenger and Slack, however, the process involves multiple cumbersome steps registering development account with Facebook and Slack, associating it with your business entity, applying for permissions, etc. If you are done with all that, get in touch with us at https://t.me/aigents or https://www.facebook.com/aigents and we will give you further directions.

Whatsapp, WeChat, Viber, TikTok, Vkontakte, etc.: As long as these services provide programmable API-s, they can be supported as a plugins implementing subclasses of either Communicator of Mediator class of the Aigents Core Platform.

Accessing the bot

The bot needs user’s identities to be recognized so it requires authentication. The authentication requires the registration of a user by email, name, and surname which should be collected under the terms like GDPR. For instance, the Aigents Web Demo site provides the appropriate Privacy Policy which can be reused as a template for your own Aigents Node and the bot.

In the future, we may remove the need for email for the users logged in via messengers like Telegram or Facebook Messenger but currently, we collect emails as unique keys of user identities. That means, you can have your users registered with fake emails, names, and surnames as long as they are unique.

Besides the email, name, and surname, registration requires a secret question (which can be thought as a password where the word “password” can be made more collaborative like “your dog name plus your license number”) and a secret answer to that question (which can be thought as a password value itself like “buddy+ET12345”).

Registering with Aigents Telegram bot called Webstructor via Telegram (on the left) and then performing login to the same Aigents Node via Web UI (on the right).

You and your users can access any Aigenst bot in a Telegram group if the bot is added to the group by group Admin, like the AigentsBot is added to the Aigents community group on Telegram. You can address the bot either replying to its earlier message in the group, or mentioning the bot in your request.

Addressing the Aigents Telegram bot (AigentsBot in the Aigents community group for example) my mentioning bot in the first message and replying to it in the second and third messages.

Teaching to talk

The pattern-based conversation needs teaching the Aigents Node how to respond to specific conversational patterns. This is done by creating pattern-response objects with multiple patterns and multiple responses. To have the pattern-response objects stored persistently across user sessions and re-used by multiple users, they need to have a trust relationship associating them with at least one user, typically — the user who creates such an object. The pattern-response objects that are not “trusted” by anyone, are periodically getting forgotten by the “garbage collector” process.

For instance, if you want your bot to reply to sentences containing “how are you” and “what’s up” with responses such as either “I am fine” or “Just great”, you just need to spell out the “controlled language” sentence having the two former phrases entered as “patternsproperty, two latter phrases entered as “responses” property and the “trust” property set to true, like in the following example.

Example of the chat session with the same Aigents bot living on https://aigents.com accessed on Telegram as @AigentsBot (on the left) and Facebook Messenger as Aigents (on the right), where the bot is being posed quests and explained how to handle them at the same time.

The example above presents the dialog flow involving both questions, responses, and directives explaining what are the expected responses for corresponding patterns, with the following order and comments.

  • Human: What is intelligence? (Human asks question)
  • Bot: Trump reportedly called johnson earlier this year to discuss the matter, and at least one member of congress said the us was reconsidering its intelligence partnership with the uk. https://www.theverge.com/2020/5/23/21268397/uk-phase-out-huawei-boris-johnson-trump-5g 😊(Bot fails to find a corresponding pattern and replies with simplistic search to its internal knowledge base, plus provides emotional feedback based on content)
  • Human: I mean human intelligence (Human keeps asking)
  • Bot: The vaccine in this trial uses a weakened human common cold virus ( adenovirus, which infects human cells readily but is incapable of causing disease ) to deliver genetic material that codes for the sars-cov-2 spike protein to the cells. These cells then produce the spike protein, and travel to the lymph nodes where the immune system creates antibodies that will recognize that spike protein and fight off the coronavirus.. Advertisement. 508 participants took part in the trial of the new vaccine. Of these, 253 received a high dose of the vaccine ( at 1*1011 viral particles/1.0ml ), 129 received a low dose ( at 5*1010 viral particl… (Bot keeps failing to find a corresponding pattern and replies with simplistic search to its internal knowledge base)
  • Human: there patterns ‘{[what is] [meaning of]} intelligence’, responses ‘By intelligence I mean general intelligence as an ability to reach complex goals in complex environments using limited resources’, trust true. (Human tells which patterns correspond to which responses)
  • Bot: Ok. (Bot acknowledges)
  • Human: there patterns ‘human intelligence’, responses ‘human-level intelligence is subclass of general intelligence corresponding to the complexity and diversity of goals, environments and resources of human species’, trust true. (Human keeps telling which patterns correspond to which responses)
  • Bot: Ok. (Bot acknowledges)
  • Human: what is the meaning of intelligence? (Human asks again)
  • Bot: By intelligence I mean general intelligence as an ability to reach complex goals in complex environments using limited resources. 😊 (Bot answers correctly, plus provides emotional feedback based on content)
  • Human: What about human intelligence? (Human asks again)
  • Bot: Human-level intelligence is subclass of general intelligence corresponding to the complexity and diversity of goals, environments and resources of human species. 😊 (Bot answers correctly with emotional feedback)
  • Human: There patterns ‘stupid’, ‘idiot’, ‘dumb’, responses ‘I am sad to hear that’, ‘I am upset hearing this’, trust true. (Human keeps telling which patterns correspond to which responses)
  • Bot: Ok. (Bot acknowledges)
  • Human: You are stupid! (Human says something bad)
  • Bot: I am sad to hear that. 😞(Bot answers correctly with emotional feedback)

The patterns and responses are in the statements above should be directed in plain single or double quotes (like when you are using a simple plain text editor). Both patterns or responses may have multiple elements separated by commas. The patterns are canonical Aigents patterns such as ones used for topic configuration for news monitoring, including disjunctive sets or lemmas, ordered patterns, standard regular expressions, and constrained variables.

NOTE: The subsequent releases will use Aigents patterns supported in responses as well, having the variables filled in based on the current conversational context.

Searching by chat

As has been shown in the previous section, when a bot can’t find a pattern to get a response, it falls back to doing so-called “implicit search” and returns whatever it finds in its memory base on the texts it finds itself during the conventional news monitoring, or, in case of commercially subscribed user account, referring to “custom search” via Google Custom Search API, Serp API or Gigablast Search.

As it has been announced in the previous publication, users can get search results using an explicit “search” directive.

At the same time, if a request or a statement made by a user in a chat is not recognized as a “controlled language” statement and there is no matching pattern found to provide a response, the entered text is used to perform an implicit search as it was requested explicitly and then the most corresponding excerpt is extracted from the found text with applicable Web link.

Adding emotions

Both kinds of chat — the one based on known pattern-response objects and the other one based on implicit search are accompanied sentiment detection. That means the sentiment provided with positive 😊 and negative 😞 emoji is evaluated both in user input and the bot output and presented to the user along with the reply from the bot.

You can have control over the sentiment detection providing custom positive and negative lexicon files deployed along with the server, called lexicon_negative_english.txt, lexicon_positive_english.txt, lexicon_negative_russian.txt, lexicon_positive_russian.txt. One can contribute to these files in GitHub, or customize them for their purposes or contribute respective files for the other languages, bearing in mind that adding more languages needs minor extensions in LangPack module of Aigents — adding a respective entry in the language registry.

Gory Details

The magic of the Aigents chat is now under complete control and can be customized. One can use existing implementations of the Intenter interface such as the following default ones.

  • Responser — default intent handler taking care of multiple directives including registration and authentication flow and framing the other dependant intent handlers below;
  • Searcher — serving explicit custom search;
  • ControlledResponser — serving “controlled language” handling processing queries in Aigents Language;
  • PatternResponser — matching known patterns and returning replies to them as it has been presented above;
  • Answerer — falling back in case if no patterns are matched — executing implicit custom search.

The order of applying the intent handlers above is defined by getRepsonser method of Body and then getIntenters method of respective Responser class or its subclass — see Demo class showing how to do that with your own Responser and/or Intenters or custom order of the latter ones.

What’s Next

The next thing you can do is to try Aigents yourself and provide us with your feedback in our communities such as https://t.me/aigents and https://www.facebook.com/aigents.

The next improvements that we are going to do in addition to your feedback are:

  • contextual disambiguation of responses so given multiple responses may be returned the most relevant is selected based on the context of the current conversation;
  • contextual completion of responses, having patterns in responses with disjunctive sets and variables filled based on the context of the current conversation;
  • mining patterns in conversation histories so the past interactions of the bot with its users are used to infer pattern-response objects used in the subsequent conversations;
  • experiential learning and causal inference on the chains of pattern-response histories to find the most successful combinations leading to maximum positive emotional feedback.
Welcome to Aigents®!

--

--

--

Creating personal artificial intelligence and agents of collective intelligence for individuals and small businesses.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Flutter Sqflite Tutorial

The Best VS Code Extensions (according to me)

Why to learn PYTHON in 2022 !

Linux — Networking Deep Dive

Spring Application Events

Why use GraphQL?

🏆Days 1 of My #66DaysofData

Why are chat apps implemented using socket communication?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aigents with Anton Kolonin

Aigents with Anton Kolonin

Creating personal artificial intelligence and agents of collective intelligence for individuals and small businesses.

More from Medium

Artificial Intelligence: How Marketers Can Use AI to Their Advantage

Talking About Natural Language Processing (NLP) — PxidaX

The Evolution of Conversational AI

Old fashioned red telephone

Artificial Intelligence in E-commerce

Artificial Intelligence in E-commerce