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..

Query regarding external scripting on Pandorabots’ AIaas.
 
 

Background
I’m a part of team developing a chatbot based on the Pandorabots platform. We are subscribed and are using AIaas(using the PHP module to access the PB API). While the pb-cli and other functions work well, there is small query that I could not find the answer to.

Query
One of the functions of the bot is to fetch information externally : sometimes over the internet, sometimes from a database. In the past(for a personal project) I used Rivescript and by writing small javascript snippets in conjunction with a php script, I was able to fetch data externally. How can I achieve a similar functionality using Pandorabots? The PB blog post linked below presents a similar concept to the one we’re trying to achieve :

Handling Sensitive Data-PB blog

But I cannot figure out how to use the mustache scripting engine within the AIaas. I would really appreciate if someone could explain to me how to use the mustache (or any other scripting language) to access data external from with AIaas.

 

 
  [ # 1 ]

Hi Siddarth,

You cannot “execute scripts” from within your bot on AIaaS. The bot will simply treat your script or Mustache template as a string. Whatever you choose to do with that string is up to you and your client application:

<category>
<
pattern>TEST</pattern>
<
template>Here is a mustache template{{ foo }}</template>
</
category

Input: TEST
Output: Here is a mustache template: {{ foo }}

When you receive this response, your application can compile the template with the appropriate data (from a database or elsewhere), and return the compiled string to the user.

If you want to use Mustache, there is a PHP library. I only chose Mustache as an example for that post - use any template engine you’d like! The purpose was to show how you might work with APIs alongside AIaaS, rather than from within it.

 

 

 
  [ # 2 ]

Thankyou for your response. So potentially javascript can also work in similar fashion? Also, will the AIML engine ignore any constructs of the templating engine,for instance delimiters and/or tags? Or do I have to use it as below (example for embedding an HTML url within a response)?

<category>
    <
pattern>GOOGLE *</pattern>
    <
template><![CDATA[<><star/><![CDATA[" target=_blank>]]><star/><![CDATA[</a>]]>
    </template>
</category> 
 

 
  [ # 3 ]

You can use the normal.substitution file to handle these types of things.

Substitutions and Sentence Splitting

 

 
  login or register to react