SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Add Speech-to-Text to Your Chatbot

Let users talk with your SAP Conversational AI chatbot inside an SAPUI5 app using the speech-to-text APIs of the Web Client bridge.

Overview

🎓 beginner 20 min. SAP Conversational AiBeginnerSapui5JavascriptMachine LearningArtificial IntelligenceSAP Business Technology Platform

You will learn

  • โœ”How to add speech-to-text to your chatbot inside SAPUI5
Unknown U Unknown November 4, 2022
Created by March 16, 2022
Contributors

Prerequisites

Prerequisites

  • Any SAPUI5 app (feel free to build the simple SAPUI5 app described in the 2 Minutes of SAPUI5 playlist)
  • An SAP Conversational AI chatbot to deploy in your SAPUI5 app (you can simply use a new one with the Greetings skill)
  • Knowledge on how to deploy a chatbot to a web page with the Web Client. The tutorial Deploy an SAP Conversational AI Chatbot on a Web Site describes a similar process for the Web Chat client.

Steps

Intro

The speech-to-text capabilities of SAP Conversational AI include:

  • Adding a microphone button and capturing the user’s click.
  • Automatically handling capturing voice from the browser (Media Record)
  • Creating a small area to view in real-time the transcription of the voice
  • Enabling developers to add the interim transcription to this transcription area
  • Adding hooks for, among other events, recognizing when the speech has stopped and adding the transcribed text as a message in the chatbot conversation

Example chatbot
Example chatbot
ย 

Ways to implement speech to text

Basically, there are 4 ways to implement speech to text for SAP Conversational AI:

  • Without using the speech-to-text features of the chatbot, handling the voice recognition outside the chatbot, and sending a message to the chatbot using the Web Client APIs.
  • Using the speech-to-text features, but without the Media Recorder and interim text features.
  • Using the speech-to-text features, but without the Media Recorder feature.
  • Using all the speech-to-text features.

This tutorial will show an example of #3 – all the features from SAP Conversational AI except that you will manage capturing the audio via the browser, not the chatbot.

The speech-to-text APIs are documented in the SAPConversationalAI / WebClientDevGuide GitHub repo.


Step 1 Understand the speech-to-text features
โ€”

The speech-to-text features include displaying a microphone within the chatbot in order to start talking with the bot (1).

Starting microphone
Starting microphone

SAP Conversational AI lets you capture when a user clicks on the microphone, and lets you start the speech recognition and send interim transcriptions to the temporary transcription area of the chatbot (2).

While talking, the user can either end the session and keep the text or abort and throw away the transcription.

Once the session is over, because the user stopped talking long enough or because the user clicked the microphone button again, the text is sent as an utterance into the conversation. (3)

Other features
Other features

Step 2 Add Web Client script
+
Step 3 Add base class for speech-to-text functions
+
Step 4 Add implementation
+
Step 5 Add references to JavaScript files
+
Step 6 Try out the app
+
Step 7 Understand the flow
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 7
1. Understand the speech-to-text features 2. Add Web Client script 3. Add base class for speech-to-text functions 4. Add implementation 5. Add references to JavaScript files 6. Try out the app 7. Understand the flow

Learn more →