Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
alichtenau
Advisor
Advisor
Digital assistants in an ideal world talk any language, the user’s language.

This blog post sketches how multilingual chatbots can easily be built with SAP Conversational AI (CAI) and SAP Translation Hub.

 

Current situation & challenges


SAP Conversational AI is an end-to-end chatbot-building platform allowing users to train, build, connect and monitor chatbots in a single interface. Chatbots are helping end-users to be redirected to the right content, answer FAQs, and execute routine tasks.
Creating an account on the platform is free.

Including low-code connections with other SAP solutions and easy-to-use UI, chatbots built with SAP Conversational AI are multilingual, meaning they understand several languages.
The languages differ with respect to capabilities that CAI provides: basic, standard and advanced levels (see details in the user guide).

SAP Conversational AI platform also provide the capability of building multilanguage chatbots. To do so, it’s important to gather sample user input, and train intents for the different languages (currently, FAQ bots are restricted to advanced level languages).

 

However, building and maintaining each language in the bots can be a challenging team effort.

 

How to overcome this challenge


To overcome this challenge, SAP Cloud Platform Product Success, SAP Conversational AI, and SAP Language Experience Lab, organized an internal virtual hackathon with the participation of two line of businesses (SAP Customer Success/LCX, and S/4HANA). The idea is to hack a solution which enables the creation of multilingual bots in SAP CAI via SAP’s Machine Translation (MT).

SAP HackAI are rapid prototyping hackathon events, organized internally at SAP, and externally to customers and partners, to help drive early stage inspiration, use case exploration and technology discovery.
Participants learn how to leverage SAP AI/ML applications and technologies (such as SAP AI Business Services, SAP Conversational AI, and SAP Intelligent RPA), to create new use-cases, resolve business challenges, and showcase them by prototypes.
During the events, we take a real-life business scenario challenge, and we use the solution to solve it over two to five days, depending on the complexity of the use case. There are presentations, hands-on exercises and expert trainers who helps. It’s a creative working environment that helps to brainstorm and find innovative solutions.

The purpose of this internal virtual hackathon was to build a prototype that enables monolingual SAP CAI chatbots to become multilingual bots by performing on-fly translation of a chatbot conversation from/to many languages, powered by SAP Translation Hub.

 

SAP Translation Hub is SAP’s Machine Translation solution. It is a Cloud Business Service which translate texts by using a repository of SAP-approved translations and terminology, as well as, Machine Translation. The translation capabilities are offered as a range of API methods, or by using integrated workflow scenarios on a UI.

 

Solution Proposal


Process


After a brainstorming and exchange about different solutions architecture and process flow, we came to a solution of building a chatbot, that we call it Machine Translation chatbot (MT chatbot), that behaves as an orchestrator with the different components to perform the process flow during the runtime.

  • The user conversation is first sent to the MT chatbot, as an entry point

  • The MT chatbot check the user’s conversation language (using language detection API in Service Ticket Intelligence)

  • Case 1; the user conversation language is the same chatbot language, then the conversation is directed to the original chatbot. This later behaves as it is, and actions are triggered

  • Case 2; the user conversation language is different from the chatbot language, then the MT chatbot will use SAP Translation Hub to translate the conversation:

    • The user conversation text is forwarded to SAP Translation Hub for translation to the LoB chatbot language

    • The translated conversion is then sent to the LoB chatbot

    • The LoB chatbot now behaves at it is supposed to be, by identifying intents and entities, triggers actions, and constitute a response/output

    • The response is then sent back to the MT chatbot, who’s in return forward it to SAP Translation Hub to translate the text in the user’s conversation language

    • And finally, the translated output is sent to the user




A custom middleware application/extension was built in SAP Cloud Platform to connect, interact and perform pre-processing and post-processing tasks between the MT chatbot, and Service Ticket Intelligence and SAP Translation Hub.



Set up the translation part


The translation process contains two parts: language detection and the translation itself.

The process was implemented via a mini app/middleware on the SAP Cloud Platform.

The Machine Translation is provided by the Document Translation Service (part of SAP Translation Hub, STH) and the language detection is provided by SAP Service Ticket Intelligence (STI). Both can be found on the SAP Cloud Platform Discovery Center.

The middleware app is a Flask web application which transforms the requests/responses between CAI and STH or STI services. The app is deployed in the same subaccount as the services and authenticates via service bindings. Alternatively, a set of service keys can be used for authentication.

There are 3 endpoints in the app:

  • /text_classification : takes in a text, forward to STI service, returns the language code of the language that the text is in. The language code returned from STI does not contain country code, this value is enriched here before returning in the final response.

  • /translate: takes in a JSON request body containing source and target language codes, the text for translation. It then format the request into a POST request with form-data body that Translation service accept and forward it on. The final reponse contains the translated string.

  • /translate_message: takes in a JSON request body containing source and target language codes, and an array of CAI rich message objects. The response contains translated messages, with format so that can be directly used in CAI, and all possible attributes translated


Creating the Chatbot


In this blogpost, we will not cover the part of how to build a chatbot. If you’re not familiar how to build a chatbot in SAP Conversational AI, you can refer to the following blog posts.

 

The MT chatbot acts as an entry point. The user input will be stored into a variable and a direct forward will lead to the language detection skill.


The detection skill gets the text stored in user_input to classify the language:


The response will again be stored into a variable (we call it ”user_language“) and we directly move to the translation skill. This skill is available to translate the user input into the chatbots language:


Having that in place, we forward the response (the translated text) to the desired LOB chatbot.



The reply of above LOB chatbot will be re-translated by sending the API response again to the MT chatbot, which finally displays the output provided by the LOB chatbot in the language entered by the user:


An example is given below. The chatbot processes the input query “How long does it take to create a service report?” in English, French and Arabic.


 

Results


Using Machine Translation the team was able to establish a chatbot which detects the language input, processes the queries in a language the bot understands and replies back in the user language.
Thank you akramnjeh, beatrice.pasch, Christian Lieske, benjamingraf, timothy.janssen, Pablo Roisman, minh.thu.le, Nora Spoo, Felix Sauerzapf, Marcel Jacobs, fathya.zemmouri, Vaclav Nemcik and michal_kopulety for being part of this journey. It was a pleasure working with you on this challenge.

 

More information:

 

 

Andreas Lichtenau
Senior Support Engineer, LCX Global Customer Empowerment, SAP SE
2 Comments
Paul_P
Product and Topic Expert
Product and Topic Expert
Amazing achievement! Congrats to all the team. Looking forward to more 🙂
wk
Participant
0 Kudos
Michael ... and me will contact you ...