AWS just announced the availability of 4 new languages in Amazon Lex earlier today. With this launch, users of Amazon Lex will be able to create chatbots in the following languages and locales: en-AU (Australian English), en-GB (British English), en-US (US English), es-US (US Spanish), fr-FR (French), fr-CA (Canadian French), es-ES, (Spanish) and it-IT (Italian).

Amazon Lex is one of the most powerful integrations available today in CSML Studio, the main platform for developing and deploying CSML-powered chatbots. By adding new languages to its offering, Amazon Lex provides even more options to CSML developers wishing to address an international user base.

At Clevy.io, the team behind the open-source CSML programming language and CSML Studio, we are extremely proud to be partners of this tremendous launch by our long-time friends at AWS.

As we are based in Paris, France 🥖🐓🇫🇷, we are especially proud to be able to better serve our users all over the world in our own mother tongue. We have a large community of CSML developers in many French-speaking countries in Africa (Cameroon, Ivory Coast, Senegal, Morocco...), Europe (France and Belgium), and North America (Canada), and expect a tremendous welcome for this new capability!


With no further ado, let's create a simple French CSML + Lex chatbot together. You can already find a more complete, but not quite as fun, example for English here.

Setting up Lex and CSML Studio

The source code for the chatbot we are going to create can be found on this github repository. You can simply import it in CSML Studio for free in one click with this magic link.

You will also need to create a Lex bot by downloading this zip file and importing it in the Lex console.

Finally, you need to configure Lex as a NLP provider in CSML Studio, for which you need an IAM user with the AmazonLexRunBotsOnly policy.

The Chatbot

This chatbot is extremely simple. Its goal is to help you find various shops around Paris. It is connected to a real-time database of Parisian shops that are accessible during the lockdown, provided in open data by the city of Paris: https://opendata.paris.fr/. In the bottom right corner of this page, you can see a demo of the end result. Try it!

By using Lex NLP in French, we are able to analyze sentences such as "Je cherche une boulangerie près d'Opéra" (I'm looking for a bakery near Opera), and extract both the intent (what the user wants to do in general: find some shop somewhere) and the entities in the sentences (the type of shop, and the place).

In our Lex definition, we have defined such an intent, called BusinessNear, and provided some utterances to train it (for production use, you would obviously need more utterances!). We also filled some example slots:

If I enter the sentence in the Lex test bot, I get the following result:

The intent is correctly recognized, and so are both entities, businessType and streetName. Time to integrate it in the CSML bot!

Configuring AI Rules

Once you have imported the chatbot in CSML Studio, you can use AI Rules so the intent's name behaves as a flow trigger: if this intent is found, start the selected flow. The flow we want to trigger is find_shop, so we will use those settings, save, and build our bot.

Analyzing the flow

When the flow is triggered, the event will be analyzed by the CSML Engine. As shown above, in our case, not only does Lex find the user's intent, it also finds the correct slots! We can use them in our flow by referencing them directly:

  // If the flow was triggered with an intent, we can extract the slots
  // and format them as specified by the Open Data API specification
  do params = []
  do slots = event._nlp_result.slots
  if (slots.businessType) do params.push(slots.businessType)
  if (slots.streetName) do params.push(slots.streetName)
  do query = params.join("+")

If the user failed to mention one of the slots (the type of shop, or the place), it would not matter: we can still continue with only one parameter.

Next, CSML calls the APIs of the Paris Open Data platform mentioned earlier, where we only need to add the query terms to the search in order to get a list of matching records.

We can then iterate over the results and display the data with a nice Carousel:

Once the user selects a shop, we can also offer some helpful information, such as its address, its website and maybe even a link to its location on Google Maps!

For your convenience, we integrated the chatbot directly in this blog post. You can test it with various queries to see what happens... And if Lex does not understand what you are looking for, CSML's default flow will be triggered!

As a next step, you can now deploy your chatbot on a channel such as Facebook Messenger and help fellow Parisians and tourists alike find some cool shops to buy 🧀, 🥖 or even 🐌 for some nice French cuisine!

Conclusion

We are thrilled to be able to help Amazon Lex developers build richer, more powerful chatbots through CSML Studio. Lex is a great tool to build experiences in Natural Language, and CSML is a fantastic tool to enrich your conversations and drive end-user engagement by connecting to other APIs and deploying your bots at scale on any channel. By using both together, there is no limit to what types of bots you can create!

If you enjoyed this short introduction to Lex + CSML, feel free to reach out to us on Slack!


About Amazon Lex:
Amazon Lex is an AWS service for building conversational interfaces for applications using voice and text. With Amazon Lex, the same conversational engine that powers Amazon Alexa is now available to any developer, enabling you to build sophisticated, natural language chatbots into your new and existing applications. Amazon Lex provides the deep functionality and flexibility of natural language understanding (NLU) and automatic speech recognition (ASR) so you can build highly engaging user experiences with lifelike, conversational interactions, and create new categories of products.

About CSML Studio:
CSML Studio is a chatbot development powerhouse, leveraging the open-source CSML programming language and created to answer the needs of enterprise chatbot development factories. It merges the capabilities of the best-in-class Natural Language Processing services such as Amazon Lex with a simple yet extremely scalable low-code approach to designing, developing, deploying and maintaining rich conversational experiences with more powerful and more integrated chatbots. CSML Studio includes integrations with hundreds of business applications such as Service Now, Zapier, Google Sheets, Gorgias, SAP, Google Calendar, Airtable, Amplitude Analytics, Zendesk, Box, Clickup...