ChatGPT in SAP Analytics Cloud

The world is full of stories of innovative ways to use ChatGPT. You’ve probably heard some of them already — developers using it to automate code, scriptwriters creating viral content, and copywriters churning out stellar ad copies.

But what if we told you there’s a new way to harness the power of ChatGPT in analytics?

With its advanced analytics, planning, and predictive features, SAP Analytics Cloud is a comprehensive solution for data-driven decision-making that has taken the business world by storm. And now, with the integration of artificial intelligence like ChatGPT, this platform has become even more robust, taking analytics to a new level of innovation.

Integrating ChatGPT with SAP Analytics Cloud can potentially transform how companies function entirely. With seamless and effortless communication capabilities, this pair is revolutionary in enhancing efficiency and saving valuable time.

This is the competitive edge businesses seek to propel them toward unprecedented success.

Read on to learn more about leveraging this trend and bringing out the best in the SAP world.

Integrating ChatGPT with SAP Analytics Cloud – How it Helps

Companies can leverage the incredible potential of AI to discover hidden patterns and unlock insights in their data by merging ChatGPT and SAP Analytics Cloud. Here are some business use cases that illustrate how integrating ChatGPT with SAP Analytics Cloud can help businesses:

Customer Service

Integrating ChatGPT with SAP Analytics Cloud can enable businesses to provide personalized customer service and support. The chatty AI tool can answer frequently asked questions and provide personalized recommendations based on the customer’s behavior and preferences.

Sales and Marketing

ChatGPT can analyze customer data and provide real-time insights to sales and marketing teams. By integrating ChatGPT with SAP Analytics Cloud, businesses can identify potential customers based on their behavior and preferences and personalize their marketing messages to better engage with their target audience.

Data Analysis

SAP Analytics Cloud provides businesses with powerful data analysis capabilities, and integrating ChatGPT further enhances these. ChatGPT can analyze data from various sources and provide real-time insights to businesses. For example, ChatGPT can analyze customer feedback and provide insights into customer sentiment, enabling businesses to improve their products and services.

Forecasting and Planning

ChatGPT can help enterprises with forecasting and planning by analyzing historical data and providing insights into future trends and patterns. By integrating ChatGPT with SAP Analytics Cloud, companies can better understand their market and make informed decisions about future investments.

ChatGPT Integration in SAP Analytics Cloud – Getting Started

Businesses can unleash the true power of natural language processing by integrating ChatGPT-3 through the OpenAI API.

Here’s a step-by-step guide to incorporate ChatGPT with SAP Analytics Cloud (using a custom widget) to deliver an unmatched user experience and unlock hidden insights previously out of reach.

Step 1: Prerequisites

There are prerequisites to creating a custom widget for SAP integration.

You must copy and save the key upon successfully creating the secret key, as the key is essential for further API calls.

Step 2: Develop the custom widget

The custom widget will help integrate the SAP Analytics Cloud with the OpenAI API. A JSON file and various web components are used to build a custom widget. The use case for the custom widget affects how these web component files are different. In this instance, “customWidget.json” and “main.js” are the two required files.

Method 1 – Plug and Play

Code: 

{

“eula”: “”,

“vendor”: “Danish”,

“license”: “”,

“id”: “com.danish.sap.sac.chatgpt”,

“version”: “1.0.0”,

“name”: “chatGPT SAC”,

“newInstancePrefix”: “chatGPTInSAC”,

“description”: “A custom widget to integrate chatGPT3 in SAC Analytic application”,

“webcomponents”: [

{

“kind”: “main”,

“tag”: “custom-widget”,

“url”: “https://dmeraj.github.io/integrating-chatGPT3-in-SAC/main.js”,

“integrity”: “”,

“ignoreIntegrity”: true

}

],

“properties”: {

“width”: {

“type”: “integer”,

“default”: 1

},

“height”: {

“type”: “integer”,

“default”: 1

}

},

“methods”: {

“post”: {

“description”: “Wrapper for jQuery post”,

“parameters”: [

{

“name”: “APIKey”,

“type”: “string”,

“description”: “”

},

{

“name”: “endPoint”,

“type”: “string”,

“description”: “”

},

{

“name”: “prompt”,

“type”: “string”,

“description”: “”

}

],

“returnType”: “string”

}

},

“events”: {

}

}

Method 2 – 

Code: 

var ajaxCall = (key, url, prompt) => {

return new Promise((resolve, reject) => {

$.ajax({

url: url,

type: “POST”,

dataType: “json”,

data: JSON.stringify({

model: “text-davinci-002”,

prompt: prompt,

max_tokens: 1024,

n: 1,

temperature: 0.5,

}),

headers: {

“Content-Type”: “application/json”,

Authorization: `Bearer ${key}`,

},

crossDomain: true,

success: function (response, status, xhr) {

resolve({ response, status, xhr });

},

error: function (xhr, status, error) {

const err = new Error(‘xhr error’);

err.status = xhr.status;

reject(err);

},

});

});

};

const url = “https://api.openai.com/v1”;

(function () {

const template = document.createElement(“template”);

template.innerHTML = `

<style>

</style>

<div id=”root” style=”width: 100%; height: 100%;”>

</div>

`;

class MainWebComponent extends HTMLElement {

async post(apiKey, endpoint, prompt) {

const { response } = await ajaxCall(

apiKey,

`${url}/${endpoint}`,

prompt

);

//console.log(response.choices[0].text);

return response.choices[0].text;

}

}

customElements.define(“custom-widget”, MainWebComponent);

})();

To proceed further, copy the code from either of the methods and change the “url” to “webcomponents” to the hosted URL and save the file name as “customWidget.json”.

Step 3: Adding the custom widget in SAC

By going to the Analytic application -> Custom widgets and clicking on the “+” icon as shown dow, you can add a custom widget in SAC. Choose the file from the local system and hit “OK”

Here is how you can upload a JSON file in SAC:

Step 4: Add the custom widget to Analytic designer

Step 5: Create a User interface in Analytic designer

You can always step up the operations with additional widgets in the UI. The required widgets are given below.

The final user interface will look something like this:

Step 6: Adding a script to the onClick event

Include the following script in the “button submit” onClick event. Change SECRET_API _KEY to the secret API key you generated in Step 1.

var endpoint = “completions”;

var APIKey = “SECRET_API_KEY”;

var prompt = InputField_prompt.getValue();

var response = chatGPTInSAC_1.post(APIKey,endpoint,prompt);

Text_response.applyText(response);

//console.log([“output”, response]);

Step 7: Test the final integration

ChatGPT integration in SAP Analytics Cloud is complete once the sixth step is implemented. You can now test your integration as you need. The size of the “Text_response” widget can be increased if you encounter issues, such as the output not appearing. As well, start with shorter responses and adjust the rest of the UI as needed.

Summing Up

The potential for ChatGPT is truly staggering, with endless possibilities waiting to be explored.  Experience the perfect blend of digital efficiency and innovative technology with ChatGPT and SAP integration – a partnership that promises to revolutionize how we conduct our operations and rise to new heights of success.

Allow this dynamic duo to invigorate your business with the much-needed breakthrough it requires to stay ahead of the competition. Accelerate your growth like never before and prepare to be thrilled with the seamless integration of ChatGPT and SAP.

Leave a Comment

Your email address will not be published. Required fields are marked *