Thursday, 04 November 2021 10:53

Call SAP Search APIs in SAP Conversational AI to Enrich your Fallbacks

Written by Mohammadhadi Shadmehr
Rate this item
(0 votes)
Source https://blogs.sap.com/?p=1432453
“© 2020. SAP SE or an SAP affiliate company. All rights reserved.” “Used with permission of SAP SE”

In my previous blog postI wrote about some tips around SAP Conversational AIFAQ bot configuration. Here I want to describe one of those tips in detail and show step by step how we can use a search API like SAP Search API to enrich our fallback.

The following guidelines are based on FAQ bot. However, a similar approach can be used in Action bots.

Intro

There are some points in the chat flow that your bot cannot provide the desired answer like when the confidence score is lower than 5%, when the user has been clicked on “None of the above” option, or when the user had a negative feedback caught in customer-satisfaction-reply skill.

In this situation, one of the possible additional services could be providing a search result based on the user initial query. We can do this in SAP Conversational AI by calling APIs and formatting the responses. Here I will show how to use SAP Search API to provide search result from SAP open access information when the confidence score is lower than 5%.

Figure%2011%20Providing%20search%20result%20when%20confidence%20score%20is%20low%2C%20showing%20in%20the%20CAI%20Chat%20Preview.

Figure 11 Providing search result when confidence score is low, showing in the SAP Conversational AI chat preview.

As SAP Search API requires a JWTtoken for search query, we first need to consume an API to get the token and save it in the memory and then call another API to post our query and get the search result. At the end we just need to format the response body and show the user few search results (e.g., the first five titles and links).

How to?

Step 1: Call the API

1. Go to the Build tab

2. Click on faq skill

3. Add a new Action Group

4. Add an API service to get JWT token

a) Click on Connect External Service

b) Select Consume API Service

c) Configure it as shown below

Figure%2012%20Using%20API%20service%20to%20get%20the%20JWT%20token

Figure 12 Using API service to get the JWT token

d) Go to the Response tab and check the Include headers check box

5. Add a memory to save the token

a) Click on Update Conversation

b) Select Edit Memory

c) Configure it as shown below:

Figure%2013%20By%20clicking%20on%20the%20value%20box%20this%20black%20box%20will%20pop%20up.%20On%20the%20right%20side%20there%20are%20some%20scripting%20examples.%20Headers%20are%20in%20the%20property%20named%20default.

Figure 13 By clicking on

Continue reading here
Read 148 times

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.