IBM offers a wide range of artificial intelligence services. In principle, these services can be called from the IBM Cloud and can therefore also be used in conjunction with GuiXT and an SAP transaction.

We integrate the IBM Watson Assistant into an SAP transaction, thereby enabling the user to request help on the current process using natural language or ask to create a new standard order.
Solution 1 - Embed as HTML
The first possibility is to embed the Assistant in an HTML file and display it in the SAP transaction using GuiXT Controls:
Solution 2 - Using the Watson SDK
There are a number of interfaces for Watson and we can use the .NET interface with GuiXT. That means we can create a library that we can call via callVB in an InputScript. To allow the user to interact with the chatbot, we use GuiXT to create input fields in the SAP easy access menu.

The Chatbot understands the intention and creates an InputScript, so that transaction VA01 is automatically opened, the value OR (standard order) is set as order type and enter is triggered.
IBM Watson Assistant is a cloud service that is free with moderate usage. However, you need to initiate this service yourself in the IBM Cloud to get an API key. You can find more information at IBM Watson Assistant Catalog
Implementation of Solution 1 - Embed as HTML
Integrating HTML files is usually done with GuiXT using the following command:

Control   (1,1)   (12.5,97.6)   progid= "file://myfile.html"   name= "mymenu"

At the present time the current version 2021 Q3 1 of GuiXT does only support the Internet Explorer Control. The Watson Assistant however requires the Chromium based rendering engine. It is possible to create a small library that can render webpages with this new engine, called WebView2. We therefore refer you to the following article which describes exactly how you can use the control. You can also download it directly there:
Use WebView2 (Chromium)

The HTML code to embed your created Watson Asisstant can be found in the Cloud cockpit:
Create a new HTML file and embed it with the following lines of code:

// area for VB.NET control.
Control     (1,1)     (18,125)   _ 
   progid= "Shell.Explorer"  _ 
   name= "r1"  _
   initflag= "r1init"    _ 
// embed control
if     V[r1init]
   callVB      guixt_webview2.webview2.setUserDir    _ 
     dir:= "C:\guixtscripts"
   CallVB     guixt_webview2.webview2.embed     "&V[r1]"
callVB     guixt_webview2.webview2.setSize  _ 
   width:= 1000   height:= 500
callVB   r =  guixt_webview2.webview2.navigate2    _ 
   url:= "file:///C:/mywatson.html"

This only embeds the chatbot in the SAP GUI transaction. You can also use the -floating option if you want to have a seperate window.

To interact with the Watson Assistant, for example send or recieve messages, you can use the JavaScript API: Web chat from Watson Assistant
Implementation of Solution 2 - Using the Watson SDK
IBM offers ready-to-use libraries for the .NET framework that you can use to interact with Watson Services (SDK). Essentially, you need to create a new .NET project, install the libraries, and compile the project as a class library. Then you can call them directly via GuiXT. A detailed description of the .NET interfaces can be found here: IBM Cloud API Docs Watson Assistant v2

(You can download the C# project at the bottom of this page)

Since there is no web interface in this case, we use a simple GuiXT script that allows the user to enter data.

InputField     (7,1)     "Enter message: "   (7,21)   size= 35  name= "mytext"
Pushbutton     (7,58)     "Send to Watson"   process= "test_watson.txt"
using  text =  [mytext]

In the InputScript we then call the created .NET library. In our example the Watson Assistant itself can again provide an InputScript, which is then saved and executed immediately:

Parameter text
// SAP Easy Access 
// Create a new session in the IBM cloud
callvb WatsonWithGuiXT_Csharp.Form1.testWatson_createsession
// Send the user input to the API
callvb result_v = WatsonWithGuiXT_Csharp.Form1.testWatson_sendtext "&U[text]"
// Copy the result to a text variable
set text[result] "&V[result_v]"
// Save the result as a file
copytext  fromtext="result" tofile="includeme.txt"
// Execute the script
Enter "?" process="includeme.txt"
The content for the InputScript can be defined in the Watson Assistant Cloud. In our example, the wizard is able to detect the user's intention to create a new order. Therefore, a script is generated that triggers a redirect to transaction VA01 and sets the order type to 'OR' (standard order):

Example Use Case - Generate infos for Support
A good combination of the chatbot with GuiXT is to send the status information of the current transaction, e.g. username, field names and user input or even error messages. This information can then be evaluated by machine or also by a human employee and thus assistance can be carried out far more effectively.

This following InputScript will read some of the available data and saves it into a variable so it can be shown in a Textbox. It also puts the text into the clipboard so the user can paste it into the chatbot-window at once:

// Clear variables
Set   V[k]  0
Set   V[line]   ""
clear   text[result]
// Read status fields
Set   V[line]   "Database: &V[_database]"
copytext   fromstring= "line"   totext= "result"    -appendline
Set   V[line]   "Client: &V[_client]"
copytext   fromstring= "line"   totext= "result"    -appendline
Set   V[line]   "Transaction: &V[_transaction]"
copytext   fromstring= "line"   totext= "result"    -appendline
Set   V[line]   "Username: &V[_user]"
copytext   fromstring= "line"   totext= "result"    -appendline
Set   V[line]   "Title: &V[_title]"
copytext   fromstring= "line"   totext= "result"    -appendline
if   V[_message]
   Set   V[line]   "Errormessage: &V[_message]"
   copytext   fromstring= "line"   totext= "result"    -appendline
// Read fields and values from current screen
label  nextfield
Set   V[k]   "&V[k]"  + 1
GetFieldattribute   #[&V[k]]   text= label  techname= techname
if   q[ok]   and   V[label]   and   V[techname]
   Set   V[line]   "&V[label]: &F[&V[techname]]"
   copytext   fromstring= "line"   totext= "result"    -appendline
   goto  nextfield
// Put the output into the clipboard
// -> user can paste it somewhere
copytext   fromtext= "result"   -toclipboard
// Set output field to visible
set   V[screen_report_visible]   "X"

Video - user perspective
You can find all files in this .zip archieve:

InputAssistant + Controls