ODA Chatbot using Bucket Storage in Cloud

You can easily setup static website with storage bucket in Cloud. Do you know that you can extend this setup for your ODA (Oracle Digital Assistant) Chatbot? This is provided as a JavaScript library for the Chatbot web channel.

The Setup

The setup is much easier than I had thought. This is a standard setup for ODA Chatbot web channel.

  1. Create folder for JavaScript and css in the object storage bucket.
  2. Create index.html or any main page for linking to ODA Chatbot.
  3. Create authenticated URL with access to the all objects within the bucket.
  4. Test your URL to start the Chatbot.

The setup of ODA Chatbot using web channel is simpler using the object storage architecture. You do not need to create new server instance or worry about the server capacity. This is because object storage comes with having high availability and huge storage.

ODA: Upload to Embedded Component Service Results in Failed to fetch custom component metadata, error response: 504

Today, I hit a really $&#% issue regarding Oracle Digital Assistant (ODA) Chatbot. This has to do with custom component feature. I find this error message misleading and leads to hours of troubleshooting efforts. So, it is better to share here for our further reference.

Oracle Solution

The typical cause for this error is that your component folders contain non-component files. The directories that you name in the components array in the main JavaScript file should point to directories that contain only component files. This includes files in any subdirectories.

Say, for example, that the main JavaScript file sets the components array like the following code example. This statement tells the component service upload process to look in the components directory structure for the custom component definitions. The server will look at every file in the directory structure and try to process each one as a custom component. If there are files in that directory structure that aren’t custom components, the upload process fails because it can’t parse the file as a custom component.

If you get this error, create a separate folder, such as helpers, in the same folder that main.js is in. Then move the non-component files into it, and modify your code accordingly.

Source from Oracle
The Actual Error

The root cause I got from this error is JavaScript syntax error. While loading the custom component, the JavaScript with error is not identified as a component file. As such, it throws this error message in ODA.

Common Syntax Error

Reference to other JavaScript module must be within invoke function.

invoke: (context, done) => {

const fetch=require("node-fetch")
}

Be careful of syntax like semicolon after keepTurn. This will cause the same error message while loading of custom component.

context.transition('success')
context.keepTurn(true);

Hope these ODA tips helps and ease hours of frustration. Great thanks to Oracle Kevin for these!

Freemarker Array in ODA

Freemarker array can be confusing to use in ODA (Oracle Digital Assistant). It is hard to find documentation on how to index the content for JSON array. These are the Freemarker syntax I had found to index array for ODA. Hope this helps!

Access First Level

First level JSON array are as follow:

{"results": 
[
{
"index": 0,
"field": "Number",
"value": 1
},
{
"index": 1,
"field": "Name",
"value": “Peter”
}
]
}

The syntax to access the first level array is:

${results.value[selValue.value?number].index}

Access 2nd Level

The JSON format are:

{"results": 
“count”: 2,
“items”:
[
{
"index": 0,
"field": "Number",
"value": 1
},
{
"index": 1,
"field": "Name",
"value": “Peter”
}
]
}

The syntax to access the 2nd level array is:

${results.value.items[selValue.value?number].index}

This will help you access a specific content by index in the array with Freemarker expressions in ODA.

ODA Custom Component

Oracle Digital Assistant (ODA) custom component is a nice addition to extend the functionality of Chatbot. With custom component, you can utilise the functionality of NodeJs and integrate to backend services. However, it is not straightforward to be used for the typical users. You will need an intermediate level of development to understand and set it up. Of course, it is great if you have someone to guide you the overwhelming process. Here are some tips to get you started on custom components.

Getting Started

The best way to get started on custom components is to go through below steps.

  1. Read and understand the purpose of custom components.
  2. Do the tutorials for custom components.
  3. Modify the sample template for simple use case.
  4. Test your custom components and enable logs.
  5. As you build more custom components, you will gain confidence for complex use cases.
Moving Forward

Custom components is a good addition. However, you will need to be familiar with JavaScript and Integration of Cloud services. It will take a while before cloud providers can come up with wizard, template or even SaaS. Meanwhile, you may need a lot of patience to setup the base library of custom components for your business needs.

One method for integration to backend services is done via custom components. It take courage to take the first step to do the tutorials. Once you setup your environment for custom components, you can create simple custom components for your use case. This will build your confidence to develop more complex scenarios.

Chatbot Team

After months of Chatbot review, I find that NLP (Natural Language Processing) development is a different ball game. These are some skillset that you may want to consider to build your Chatbot team.

A new Paradigm

Chatbot is a new paradigm. Thus, it will take experienced developers to change and gat used to this approach. You will need to find someone who is patience and willing to redesign from a user centric approach. An entrenched mindset will be difficult for development of Chatbot.

Right Fit not Right Skills

If you are building a Chatbot team, do look for aptitude instead of someone with good technical skills. Thus, a person who is interested to Chatbot development is a better fit. Technical skills can get obsolete but a person who have the right learning mindset will grow with Chatbot.

Chatooth development is a new paradigm and faces resources issues in filling these roles. You should aim to build a team who is dedicated to grow and champion the usage of Chatbot. If not, it will remain another white elephant as time goes by.

Chatbot Date NLP

Chatbot NLP have an interesting feature to interpret dates with NLP (natural language processing). In traditional applications, we need to set user preferences and identify the dates format and convert it accordingly. This is a key advantage of using AI driven Chatbot.

Why NLP Inputs?

A key issue with data input is user formatting. Date is one notorious input as shown in here for OTM. NLP is a great solution to resolve this data input. With NLP, you can key in different flavors of dates and formats like below:

  • Yesterday
  • Today
  • 2 days ago
  • 2 months ago
  • 12 Aug
  • Jun 10
A New Paradigm

It will be a matter of time before we see the input forms disappearing. This will be replaced by smart Chatbot that extract data from your responses. So, there will be increased interest in NLP development. This new paradigm is more intuitive and smart. For eCommerce, it will helps to uncover impulse purchases and unarticulated needs.

A new way of NLP data input will gain popularity as Chatbot development becomes mature. This will change the way we view UI (User Interface). Of course, the initial development will be challenging as we lack NLP developers. If this is the case, why not transition your existing UI to NLP development?

Cryptic Freemarker Array in ODA

Apache Freemarker continues to be a challenge in ODA (Oracle Digital Assistant). I am trying to tackle Freemarker Array operations. It proves to be a headache to figure out how this works.

Tips

These are some tips and lesson learn from my battles with Freemarker Array operations.

  1. Check the actual JSON to determine the where the array is located e.g. root or sub items.
  2. Start with simple listview for Freemarker.
  3. Do backup and unit test often.
  4. Array location in sub items level may not be accessible directly.
  5. Index start from zero.
  6. Build your code template for Arrays because there are no many examples for ODA.
  7. Validation check in ODA does not work for Freemarker.

Array operations in ODA is one of the challenges faced during coding in ODA. While the validation do not work, you may need to test often to find the errors.

Oracle Digital Assistant

Oracle Digital Assistant (ODA) is the platform I mostly used for my Chatbot testing. Overall, it is functional and easy to setup. Usually, this means I can configure and deploy Chatbot within a day or two. As with all platforms, there are pros and cons. This is a quick summary if you are interested in ODA.

What I Like

These are some features which I like the most.

  • Sample templates and tutorials to get started.
  • Easy integration to translation services.
  • Quick setup for some Channels integration like Teams and Web
  • Extension via web hook and custom components.
  • Versioning support
  • Easy switch of versions on different channels
What I would Like

This will be some common configuration which Chatbot platform should have for the future.

  • Languages without consideration to native or non native.
  • Configurable connection to REST API.
  • Configuration for login services.
  • Rich UI for chat messages.
  • More samples chat with REST custom components.
  • Configuration for map services, camera, QR scan or document storage.
  • Web SDK for PWA (Progressive Web App)

In summary, ODA serves well to setup Chatbot quickly without much fanfare if you are creating basic needs like knowledge base or technical support. However, you will require advanced technical knowledge to integrate different services to ODA as they are still quick code driven than configuration.

Chatbot and Responsive Web Design

There are many Chatbot options for different channels like Ms Teams, WhatsApp, WeChat or Web. Each channel have its characteristics and efforts to be displayed nicely. You can try to use responsive web design (RWD) if your Chatbot have a web version.

Why RWD for Chatbot

Building a Chatbot for all channels are impossible. As mentioned in Chatbot channel selection, web is usually the default preferred channel. Many devices can support web with the main browser like Chrome and Safari. Using RWD will help your Chatbot to display properly across different screensize. If you are evaluating Chatbot, you can include RWD support for web as a key criteria.

Omnichannel with RWD

Your user reach is also a key reason for RWD in your web. Since mobile devices is a key factor for user reach, you will find it time consuming to include mobile development in your roadmaps. RWD approach allows Chatbot to be standardise for omnichannel. This reduces your time to market and increases user reach globally without the need of specific channel.

A key consideration of Chatbot is to default web as your main channel. You must test the Chatbot web to be compatible with RWD. Combining these 2 approaches will help you ready your Chatbot to be used globally.

How to Create a Knowledge Base Chatbot

A very useful feature of Chatbot is to turn your user guide into an interactive knowledge base for users. In ODA (Oracle Digital Assistant), this is the QnA feature. You can even upload some popular translated version of your user guide into QnA.

For new users to your application, they are often lost on how to start using your application. Traditional approach is user guide or demo. Some will conduct training workshops. With COVID-19, this is not cost effective as we are not bound by location or timezone.

Building your Lexicon

A first step is to load your lexicon to Chatbot that will define the languages used for your application. The AI enabled Chatbot will learn with NLP (Natural Language Processing) to understand user queries. Lexicon serve as a baseline to set your application domain language. For example, booking can means orders or delivery in logistics domain.

Content Create in Chatbot

Once you define your lexicon, it is time to include the contents such as user guide into your Chatbot. These contents can even include cheatsheet, cookbook, sharepoint documents or SOP (Standard Operating Procedure). You will never get the desired results from the start. It is a progressive and continuous tweaking as you build your knowledge base in Chatbot.

Chatbot is changing the way we create our knowledge base. These AI enabled Chatbot will aim to understand smartly user queries and provide the best results. It is time you setup your content in Chatbot.