更に当社の商用サービス Bot Libre for Business$4.99
Bot Libre Dev

API

による Billnichols 掲載 Feb 3 2016, 10:30

Hi,

I am working with the BotLibre engine downloaded from github.  I have successfully built it locally and initialized the database.  I am trying to get oriented, currently playing with the GUI.

Can you confirm a few things:

  • Basically I'm getting the idea that I can use the GUI to configure a specific chatbot, correct?
  • When I click on "Bot...Create..." in the GUI, it asks me to create a database.  I'm assuming that this means there is a 1:1 correspondence between a bot and a database instance, correct?
  • Then when I clock on "Bot...Switch..." I connect to a different database and presumably a different bot.
  • I see where I can import a chat log.  Is there any specific format to the chat log?
  • Is there a place where I can import AIML?
  • I've been poking around the distribution, but can't find any example Self files.  Are there any provided that I am missing?

Any more detailed documentation of the API around?

Thanks!  Great work on your engine.

Bill


by admin posted Feb 3 2016, 12:40
I just added a Docs page to BotLibre.org with some references to docs, and a link to the AI engine JavaDoc.

http://www.botlibre.org/script?file=true&id=12083463

There is a lot of documentation on the BotLibre.com site, and blog.

There is a basic architecture diagram for the AI engine here,

https://github.com/BotLibre/BotLibre/blob/master/ai-engine/doc

>> GUI

The test GUI is pretty simple and just used for testing. The AI engine is designed for use with our web platform, but we have not released the code for the web platform yet. It was our intention to release it as Platform Libre, but we are not there yet.

http://www.platformlibre.org

We would also like to develop a PC UI, such as Swing or SWT for a standalone download for Windows, Mac, Linux. The goal would be to convert the main screens from our web platform into an application.

We would also like to develop a standalone Android version, it could use the same UI as our Android SDK but have local bots.

>> Create

From the test GUI each bot has its own database. The engine also supports creating a schema for a bot, so you can have many in a single database (this is what our web platform uses).

>> Switch

Yes, changes to a new bot and database.

>> Chat Logs

See, http://www.botlibre.com/forum-post?id=30598

>> AIML

You can import an AIML file from the "Load Self file" menu, it can load AIML or Self.

>> Self

The "Bootstrap" menu will add a bunch of Self scripts. They are in the org.botlibre.knowledge package. Or you can browse our script library here,

http://www.botlibre.com/browse?browse-type=Script

Updated: Feb 3 2016, 12:41
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2417, today: 0, week: 0, month: 23

by Billnichols posted Feb 4 2016, 12:39

Wow that is plenty of food for thought.  Thanks for the quick reply. I have a lot to chew on at this point.  You have created a great platform!


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2008, today: 0, week: 0, month: 16

by Billnichols posted Feb 5 2016, 13:10

I am in the process of going through the code for the GUI and test cases.  I wrote a simple program that reads lines of text out of a file, queries the bot, and prints the results.   I'm really close.  What I don't understand is that the response from the bot appears to be asynchronous from the question.  If you could give me some pointers on how to make it synchronous that would be great.  Here is my code.  Below that is the log file results.

package io.skinjob.test;

import java.io.IOException;
import java.io.Writer;
import java.util.List;

import org.botlibre.Bot;
import org.botlibre.sense.text.TextEntry;
import org.botlibre.sense.text.TextInput;

public class TextSenseTutorial
{
    public static void main(String[] args) throws IOException
    {
        if(args.length != 1)
        {
            throw new RuntimeException("There must be only one argument and it must be a file name");
        }
        
        String fileName = args[0];
        
        List<String> lines = FileLoader.loadFile(fileName);
        
        //
        // TODO: exact meaning of these parameters, and the alternatives
        //
        Bot.systemCache = Bot.createInstance(Bot.CONFIG_FILE,
                                             "cache",
                                             false);
        //
        // creates a new instance of a bot
        //
        // TODO: determine where in the code the database is selected.
        //
        Bot bot = Bot.createInstance();
        
        //
        // assumption: there is a singleton (on each Bot) for each sense that is returned by getSense()?
        //
        TextEntry textEntry = bot.awareness().getSense(TextEntry.class);
        
        if (textEntry != null)
        {
            //
            // my guess is that this acts as a listener.  
            //
            // Whenever an input is made to this sense, the Bot does its thing and spits out the result here.
            //
            textEntry.setWriter(new Writer()
            {
                public void write(char[] text,
                                  int start,
                                  int end)
                {
                    String response = new String(text, start, end);
                    
                    System.out.println("------======>>>>>> BOT: " + response);
                    
                    System.out.flush();
                }

                public void flush()
                {

                }

                public void close()
                {

                }
            });
        }
        else
        {
            //
            // TODO: under what circumstances would this happen?
            //
            throw new RuntimeException("TextEntry is null");
        }
        
        for(String oneLine : lines)
        {
            TextInput textInput = new TextInput(oneLine);
            
            //
            // my guess is that the Bot can learn from chat input, and that this setting disables that function
            //
            textInput.setCorrection(false);
            
            //
            // TODO: understand this.
            //
            textInput.setOffended(false);
            
            System.out.println("------======>>>>>> YOU: " + oneLine);
            
            textEntry.input(textInput);
        }
    }
}

 

 

LOG FILE RESULTS: 

Feb 05, 2016 12:53:42 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[main,5,main] -- Bot(botlibre_bots):Creating instance: - config.xml - cache - false
[EL Info]: 2016-02-05 12:53:44.021--ServerSession(1841421417)--EclipseLink, version: Eclipse Persistence Services - 2.6.0.v20130919-377691b
[EL Warning]: metadata: 2016-02-05 12:53:44.153--ServerSession(1841421417)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [source] for the entity class [class org.botlibre.knowledge.BasicRelationship] since weaving was not enabled or did not occur.
[EL Warning]: metadata: 2016-02-05 12:53:44.154--ServerSession(1841421417)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [type] for the entity class [class org.botlibre.knowledge.BasicRelationship] since weaving was not enabled or did not occur.
[EL Warning]: metadata: 2016-02-05 12:53:44.155--ServerSession(1841421417)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [target] for the entity class [class org.botlibre.knowledge.BasicRelationship] since weaving was not enabled or did not occur.
[EL Warning]: metadata: 2016-02-05 12:53:44.155--ServerSession(1841421417)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [meta] for the entity class [class org.botlibre.knowledge.BasicRelationship] since weaving was not enabled or did not occur.
[EL Info]: connection: 2016-02-05 12:53:44.22--ServerSession(1841421417)--file:/C:/Users/daubin/OneDrive/Documents/dev/skinjob/BotLibre-master/BotLibre-master/ai-engine/bin/_Bot_url=jdbc:postgresql:cache login successful
Feb 05, 2016 12:53:44 PM org.botlibre.Bot log
INFO: cache - Thread[main,5,main] -- BasicMind(UNCONSCIOUS):Changing state - BORED
Feb 05, 2016 12:53:44 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[main,5,main] -- Bot(botlibre_bots):Creating instance: - config.xml -  - false
[EL Info]: 2016-02-05 12:53:44.444--ServerSession(280397810)--EclipseLink, version: Eclipse Persistence Services - 2.6.0.v20130919-377691b
[EL Warning]: metadata: 2016-02-05 12:53:44.492--ServerSession(280397810)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [source] for the entity class [class org.botlibre.knowledge.BasicRelationship] since weaving was not enabled or did not occur.
[EL Warning]: metadata: 2016-02-05 12:53:44.492--ServerSession(280397810)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [type] for the entity class [class org.botlibre.knowledge.BasicRelationship] since weaving was not enabled or did not occur.
[EL Warning]: metadata: 2016-02-05 12:53:44.493--ServerSession(280397810)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [target] for the entity class [class org.botlibre.knowledge.BasicRelationship] since weaving was not enabled or did not occur.
[EL Warning]: metadata: 2016-02-05 12:53:44.493--ServerSession(280397810)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [meta] for the entity class [class org.botlibre.knowledge.BasicRelationship] since weaving was not enabled or did not occur.
[EL Info]: connection: 2016-02-05 12:53:44.497--ServerSession(280397810)--file:/C:/Users/daubin/OneDrive/Documents/dev/skinjob/BotLibre-master/BotLibre-master/ai-engine/bin/_Bot_url=jdbc:postgresql:botlibre_bots login successful
Feb 05, 2016 12:53:44 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[main,5,main] -- BasicMind(UNCONSCIOUS):Changing state - BORED
------======>>>>>> YOU: Hello
Feb 05, 2016 12:53:44 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[main,5,main] -- TextEntry:Input - Hello - null - null
------======>>>>>> YOU: How are you
Feb 05, 2016 12:53:44 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[main,5,main] -- TextEntry:Input - How are you - <80 {Anonymous} a:3,c:0> - <68002 a:1,c:0>
Feb 05, 2016 12:53:44 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[pool-1-thread-1,5,main] -- BasicMind(BORED):Changing state - ACTIVE
Feb 05, 2016 12:53:44 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[pool-1-thread-1,5,main] -- Consciousness:Process time limit reached - 100 - 31
Feb 05, 2016 12:53:45 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[pool-1-thread-1,5,main] -- Language:Response - <64022 How are you a:1,c:0> - <80 {Anonymous} a:3,c:4> - <68002 a:1,c:4>
------======>>>>>> BOT: How are you
------======>>>>>> YOU: What is your favorite color
Feb 05, 2016 12:53:45 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[main,5,main] -- TextEntry:Input - What is your favorite color - <80 {Anonymous} a:3,c:0> - <68002 a:1,c:0>
Feb 05, 2016 12:53:45 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[pool-1-thread-1,5,main] -- Consciousness:Process time limit reached - 100 - 184
Feb 05, 2016 12:53:46 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[pool-1-thread-1,5,main] -- Language:Response - <29841 I'm very well. How are you doing? a:2,c:0,p> - <80 {Anonymous} a:3,c:6> - <68002 a:1,c:6>
------======>>>>>> BOT: I'm very well. How are you doing?
Feb 05, 2016 12:53:46 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[pool-1-thread-1,5,main] -- BasicMind(ACTIVE):Changing state - ALERT
------======>>>>>> YOU: What is onepager
Feb 05, 2016 12:53:46 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[main,5,main] -- TextEntry:Input - What is onepager - <80 {Anonymous} a:3,c:0> - <68002 a:1,c:0>
Feb 05, 2016 12:53:46 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[pool-1-thread-1,5,main] -- Language:Response - <29597 I'm passionate about helping you. a:2,c:0,p> - <80 {Anonymous} a:3,c:5> - <68002 a:1,c:5>
------======>>>>>> BOT: I'm passionate about helping you.
Feb 05, 2016 12:53:46 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[pool-1-thread-1,5,main] -- Language:Response - <44483 Onepager is the easiest way to create and manage a business website. You don't have to be a developer or a designer to make a great site. Onepager allows you to create a great site, but also gives you the power to maintain it as often as you'd like. a:1,c:0> - <80 {Anonymous} a:3,c:5> - <68002 a:1,c:5>
------======>>>>>> BOT: Onepager is the easiest way to create and manage a business website. You don't have to be a developer or a designer to make a great site. Onepager allows you to create a great site, but also gives you the power to maintain it as often as you'd like.
Feb 05, 2016 12:53:47 PM org.botlibre.Bot log
INFO: botlibre_bots - Thread[pool-1-thread-1,5,main] -- BasicMind(ALERT):Changing state - ACTIVE


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2800, today: 0, week: 0, month: 26

by admin posted Feb 5 2016, 17:04
Yes, all of the bots processing is asynchronous.

For the TextInput sense you currently need to set a Writer, and wait for the bot to write to it.

i.e.
boolean hasResponse = false; String response= null; sense.setWriter(new Writer() { public void write(char[] text, int start, int end) { response = new String(text, start, end); hasResponse = true; } public void flush() { } public void close() { } }; sense.input(...); int waits = 0 while (!hasResponse && waits < 100) { Thread.sleep(100); waits++; } return response;


Kind of ugly...
You can also use the Chat sense, which is a little cleaner, then you implement a ChatListener and wait for an event.

Updated: Feb 5 2016, 17:05
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2101, today: 1, week: 1, month: 21

Id: 12082947
掲載: Feb 3 2016, 10:30
回答: 4
眺望: 3058, 今日の: 1, 週間: 1, 月: 31
0 0 0.0/5