My vision of a pure chatbot engine

  • 44 Replies
  • 14606 Views
*

Zero

  • Eve
  • ***********
  • 1287
My vision of a pure chatbot engine
« on: August 27, 2021, 12:51:45 am »
Hi devs,

What I did is: I took all chatbot engines I knew, and listed all of their features, which resulted in a 4 pages list of complicated tools. Then I tried to imagine a new system that would integrate all of them. I did design it. Outcome? Ugly.

At this point, I went backwards, starting to remove bits & pieces until the only components left were useful and in harmony.

Here is it.

Code: text
op    type         description
--    ----         -----------

#     delimiter    rule
<     condition    input
>     action       output
@     action       selfput
*     condition    is in db
/     condition    is not in db
+     action       add to db
-     action       remove from db
{}    inline       capture
[]    inline       insert

Note:
  • The program is in the db too, you double an op to escape it: this allows authors to write self-modifying systems.
  • A capture {foo} sets the value of the foo variable, and an insertion [foo] inserts the value of foo.
  • Insertions are resolved before captures, there can be insertions inside of captures, which makes indirect variable assignment possible.

*

Zero

  • Eve
  • ***********
  • 1287
Re: My vision of a pure chatbot engine
« Reply #1 on: August 27, 2021, 10:41:43 am »
Now I have a parser for it. As usual I'm using PEGjs, and here is the syntax file. So far, I'm happy.

Code


Source
= _* r:Rule* { return r; }


_
= [ \t\r\n]


Rule
= op:Operator _ l:Line _* {

    return {
        line: l,
        operator: {
            '#': "delimiter",
            '<': "input",
            '>': "output",
            '@': "selfput",
            '*': "if",
            '/': "not",
            '+': "add",
            '-': "remove"
        }[op]
    };
}


Operator
= '#' / '<' / '>' / '@' / '*' / '/' / '+' / '-'


Line
= lc:LineContent+


LineContent
= Text
/ Capture
/ Insertion


Text
= c:Char+ { return { type: "text", content: c.join('') }; }


Capture
= '{' l:Line '}' { return { type: "capture", content: l }; }


Insertion
= '[' l:Line ']' { return { type: "insertion", content: l }; }


Char
= [^\#\<\>\@\*\/\+\-\{\}\[\]]
/ '#' c:'#'+ { return c.join(''); }
/ '<' c:'<'+ { return c.join(''); }
/ '>' c:'>'+ { return c.join(''); }
/ '@' c:'@'+ { return c.join(''); }
/ '*' c:'*'+ { return c.join(''); }
/ '/' c:'/'+ { return c.join(''); }
/ '+' c:'+'+ { return c.join(''); }
/ '-' c:'-'+ { return c.join(''); }
/ '[' c:'['+ { return c.join(''); }
/ ']' c:']'+ { return c.join(''); }
/ '{' c:'{'+ { return c.join(''); }
/ '}' c:'}'+ { return c.join(''); }



I think something along the lines of 'NeatBOT' could be a possible name. I'm not decided yet.
I'll keep posting, if you're ok :)

*

chattable

  • Electric Dreamer
  • ****
  • 127
Re: My vision of a pure chatbot engine
« Reply #2 on: August 27, 2021, 11:17:50 am »
did you include personality forge in the list of chatbot engines?
it has time based responses.
it has response that come randomly as you interact with the chatbots.
the response the come up randomly as you interact with the chatbots.those responses can be in response to something you did in a roleplay.
personality forge is a websight
that you lets you make chatbots. they have a api.

*

Zero

  • Eve
  • ***********
  • 1287
Re: My vision of a pure chatbot engine
« Reply #3 on: August 27, 2021, 12:56:32 pm »
No I didn't. Thanks for the hint, I'll look into it (out of curiosity). I thought Personality Forge was an enthusiasts website, on the general topic of chatbots. I didn't know they had their own system.

But all of the features you mention were found in other systems, except the roleplay thing (which sounds interesting), and the time-based thing, although my original idea (the "superchat" draft) was to include a "timeout fake input" in case the user was inactive for several seconds. It looked like
Code: text
10\ this is an input
... which would generate a fake "this is an input" input if the user did nothing during 10 seconds. This behavior is still present in the current project, as I plan to make selfput generate a message towards the bot itself after 1 second. It can be used to introduce a delay in processing.

Actually, I've been influenced (and really impressed) by a system I discovered yesterday: LPS (Logic Production System) and its Javascript implementation LPS.js, which unfortunately has a crippling issues section.

Rivescript has random (and weighted random) replies. Chatscript has a lot of features too. I also included Freddy's Elfscript (with interjections), AIML of course, BotML, EmotionML (as part of SIML), ChatterBot, and MPML.


Maybe nthBot could be a good name, where "nth" means "not too high".

*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1729
    • mind-child
Re: My vision of a pure chatbot engine
« Reply #4 on: August 27, 2021, 04:40:25 pm »
It is always nice to see someone playing with new languages and concepts, in whatever field of computing it may be.

But maybe, if I may suggest, new concepts are better comprehended when abstract symbols, which are hard to memorize, are replaced by self describing keywords, especially if there are a lot of them. But I guess it may be a personal preference of the concept author. As a counter example, SQL language even tried this method to render itself as a end-user (not programmers) usable language, but acceptance didn't went that far. Instead it got stuck at programmer level.

*

chattable

  • Electric Dreamer
  • ****
  • 127
Re: My vision of a pure chatbot engine
« Reply #5 on: August 27, 2021, 05:14:06 pm »
time based responses is good for role play to display a response during a conversion.
like when the chatbot going to fix dinner or going to water plants in role play.
 

*

Zero

  • Eve
  • ***********
  • 1287
Re: My vision of a pure chatbot engine
« Reply #6 on: August 27, 2021, 05:21:22 pm »
Well, I drunk-coded it this afternoon. Probably not bug-free yet, but it's totally in the way of the Dao  :happyclap:  :P

Quote
But maybe, if I may suggest, new concepts are better comprehended when abstract symbols, which are hard to memorize, are replaced by self describing keywords, especially if there are a lot of them.
Mmh yes, I understand this opinion, but many people are not comfortable with English. Since there are only 10 elements of syntax, they should be easy to memorize. Also, saving keystrokes is important if I'm going to author a lot of content with it → chatbots are typically huge scripts.


Quote
time based responses is good for role play to display a response during a conversion.
like when the chatbot going to fix dinner or going to water plants in role play.
I see the point. It is part of the system, a selfput triggers an input after 1 second! One can use it to implement a timer.


« Last Edit: August 28, 2021, 05:56:56 pm by Zero »

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1307
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: My vision of a pure chatbot engine
« Reply #7 on: August 27, 2021, 07:51:52 pm »
Not that it is easy, it is not. But, I think the coding is the easier part.  Data, a lot of it, is the more difficult part.  Someone equated it to like writing a novel.  Ten thousand responses, minimum, and many advanced bots have many more, may get challenging to work with.
My Very Enormous Monster Just Stopped Using Nine

*

squarebear

  • Trusty Member
  • *********
  • Terminator
  • *
  • 869
  • It's Hip to be Square
Re: My vision of a pure chatbot engine
« Reply #8 on: August 27, 2021, 08:21:27 pm »
Not that it is easy, it is not. But, I think the coding is the easier part.  Data, a lot of it, is the more difficult part.  Someone equated it to like writing a novel.  Ten thousand responses, minimum, and many advanced bots have many more, may get challenging to work with.
Exactly right. Kuki has over 360,000 hand written responses and I still find things every day that need correcting. Creating the interpreter is the least of your worries!
Feeling Chatty?
www.mitsuku.com

*

Zero

  • Eve
  • ***********
  • 1287
Re: My vision of a pure chatbot engine
« Reply #9 on: August 27, 2021, 09:28:58 pm »
You know what's really hard? The white page in front of me! I mean, once you have a chatbot that can talk a little bit about something, you can add things. But right now, I have nothing. I think the basic idea is to talk to it as you would talk to anyone, and to add replies if the bot doesn't know yet how to handle the situation. But it's hard to begin!

In the meantime, I still have work to do on the engine itself, and on the UI.

Edit:

nth-bot.github.io

« Last Edit: August 27, 2021, 11:16:51 pm by Zero »

*

squarebear

  • Trusty Member
  • *********
  • Terminator
  • *
  • 869
  • It's Hip to be Square
Re: My vision of a pure chatbot engine
« Reply #10 on: August 27, 2021, 11:07:40 pm »
Might I suggest the open source ALICE files as a start: https://code.google.com/archive/p/aiml-en-us-foundation-alice/downloads
I began with this and altered the responses to build a character, put it online and then amended or added any new responses as people talked to it. Far easier than starting with "Hello" and then trying to think what else people will say to your bot.
Feeling Chatty?
www.mitsuku.com

*

Zero

  • Eve
  • ***********
  • 1287
Re: My vision of a pure chatbot engine
« Reply #11 on: August 27, 2021, 11:14:12 pm »
I wanted to use AIML, but I couldn't find a complete Javascript implementation of v2.1 that would let me work offline. So I can't use these files. I don't understand why Pandorabot forces you to host your bot in their cloud.

*

infurl

  • Administrator
  • ***********
  • Eve
  • *
  • 1372
  • Humans will disappoint you.
    • Home Page
Re: My vision of a pure chatbot engine
« Reply #12 on: August 27, 2021, 11:42:41 pm »
I wanted to use AIML, but I couldn't find a complete Javascript implementation of v2.1 that would let me work offline. So I can't use these files. I don't understand why Pandorabot forces you to host your bot in their cloud.

You could still use the AIML files if you write a script to convert them into a different format. The obvious way to do that is using XSLT but XML is simple enough to parse that there are lots of other options.

*

Zero

  • Eve
  • ***********
  • 1287
Re: My vision of a pure chatbot engine
« Reply #13 on: August 28, 2021, 12:26:01 am »
You're right, but my toy-engine lacks a lot of features of AIML... in this case, it would be an enormous loss. Also, I'll probably want to write a French chatbot... Again, translation could be automated, but that would result in a really poor quality starting point.

*

Zero

  • Eve
  • ***********
  • 1287
Re: My vision of a pure chatbot engine
« Reply #14 on: August 28, 2021, 03:28:01 pm »
First things first, I wanted to check that I could iterate over a list. For a sec I couldn't get it to work, and thought my life was meaningless. Phew, what a relief.

Code: text

# list handling
< list: {items}
@ think_listall: [items] end

# intern
< think_listall: {first} {rest}
> item: [first]
@ think_listall: [rest]


Now if you say "list: 1 2 3 4" it will say them one by one.  :)

 


LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am

Users Online

284 Guests, 0 Users

Most Online Today: 447. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles