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: 
VinayBhatt
Product and Topic Expert
Product and Topic Expert

Introduction

The primary focus of this article is to lucidly present a broad classification of SAP Business AI, followed by an in-depth explanation on how to infuse AI into applications using SAP Business Technology Platform (BTP). The spotlight will be on the AI/ML services within SAP BTP.

The article features some use cases drawn from my own projects. These examples are intended to illustrate the practical application of various technologies within SAP BTP, showing how they can be synergistically utilized to create end-to-end applications that are infused with AI.

Agenda

  1. Broad classification of SAP Business AI & Introduction to various Services.
  2. SAP BTP AI : AI services & solutions in SAP BTP to build applications infused with AI.
  3. Example Use Cases 
    • Semantic Search App
    • Zero shot classification with LLM's
    • AI Quiz App

Broad classification of SAP Business AI 

SAP Business AI can be broadly classified into following categories : 

  •  Embedded AI : AI Integrated into business processes and solutions. SAP business AI includes AI solutions & features infused in S4HANA (Finance , Sales & Service), ARIBA( procurement), SAP Digital Assistant for Cx ( marketing & commerce) , SAP Success Factors(HR), SAP Transport Management (Supply Chain), SAP Extended Warehouse Management (Supply Chain) and Cross Functional use cases with "Just Ask" at SAP Analytics cloud and many more.
  •  SAP BTP AI : Build custom AI solutions and integrate them to your SAP landscape. BTP AI solutions Infuse artificial intelligence into your apps with scalability and responsibility in mind by enabling consumption of ready-to-use AI Models , training & deployment of custom AI models, using Enterprise Process Automation, SAP's Foundation Models, AI through SAP Partnerships : IBM Watson, Google Cloud, Data Robot, Microsoft OpenAI etc. SAP combines the power of generative AI with the context of business data and business processes and applies fine-tuning and prompt engineering at scale. 
  • SAP AI Services : Models Pretrained on Business Data, access pretrained AI capabilities e.g. Document information extraction, Personalized recommendation and Data attribute recommendation.         
  • Ecosystem AI : Procure best-of-breed AI solutions from SAP's ecosystem. 

VinayBhatt_0-1708062648875.png

SAP BTP AI

We will now focus on SAP BTP AI foundational platform & services. Let's look at the foundational platform and services available to customers & partners today to infuse AI into applications.

SAP AI Services

Access Pretrained models as APIs for Document Information Extraction (Dox), Personalized Recommendation services, Data Attribute recommendations & Machine translation services etc. These pretrained models from SAP are trained on Business data and can be infused in BTP Applications to perform task like extracting Text from Images using OCR, retrieving master data from Invoices (e.g. pdf etc) or building custom recommendation services or machine translation services.

How can this help partners and customers to build AI applications ?

Partners and customers can consume SAP AI services API for DoX & recommendation services etc in custom BTP apps ( No code/ Low code apps plus Pro code apps)  , to create side by side AI applications or extentions to existing exterprise applications.

Document Information Extraction Video

Documentation

 

SAP BTP Generative AI hub 

 SAP BTP Generative AI hub is available on SAP AI Launchpad/ SAP AI Core on BTP and provides a central place for accessing Large Language models from different providers such as GPT-4 by Azure OpenAI or OpenSource Falcon-40b .

      How can this help partners and customers to build AI applications ?

    1. The generative AI hub provides tooling for prompt engineering, experimentation, and other capabilities to accelerate the development of BTP applications infused with generative AI, in a secure and trusted way.
    2. Partners and customers can build AI Applications on BTP using the Gen AI hub based access to LLM models as an API from SAP AI Core – Reference Architecture

      Generative AI Hub – Out now! : Includes a Demo of Gen AI Hub.

 

SAP HANA Cloud Vector Engine (planned GA Q1 2024)

The world of Gen AI / LLM’s has lot of mention on vector data (embeddings) , which is simply put numerical representation of text, voice, Image data etc. With this vector representation of text, voice & images, use cases like similarity search or contextual search or Retrieval Augment Generation (RAG) are prevalent, wherein similar documents matching a user query are pulled from a vector data store , before being fed to a LLM for a contextual response.

Such application development can now happen in BTP for enterprise applications using the Reference architecture above which includes Gen AI Hub, HANA Vector Engine etc.

Video  Vector Engine

Below is a 2D representation of embeddings generated on simple text like dog, cat, kitten, man,woman and SAP BTP etc. Words similar in meaning are clustered together.

VinayBhatt_0-1708173607147.png

 

VinayBhatt_0-1708174348894.png

I have created a Google colab notebook for basic understanding of these NLP terms including : 

  • Transformers & self Attention mechanism
  • Word Embeddings
  • Similarity search
  • Retrieval Augmented Generation (RAG)
  • Interaction with PDF documents

 

SAP BTP AI Core/ AI Launchpad

This is the foundational technology stack for orchestrating and deploying custom AI/ML applications on BTP. AI Core/Launchpad allows you to incorporate your GIT Code repository along with config.yaml file containing the templatized parameters for your ML/AI scenarios, Docker secret & docker image, AI core resource to use (CPU/GPU config), any input parameters etc. AI core provides an SDK to interact with the foundation where as AI launchpad provides a UI5 Frontend to configure your ML/AI scenario. You can configure, deploy & Monitor your scenarios on AI Core & AI launchpad.

Example Application : Reduce your CO2 footprint using a smart Generative AI application on SAP BTP

 

SAP Analytics Cloud "Just Ask" & SAP Datasphere

Just Ask(GA Q1 2024) will provide a Natural Language processing AI interface within SAP Analytics cloud allowing the ability to interact with your data models & dashboards using Natural language based queries.

Video Demo

 SAP Datasphere (SAAS Datawarehouse) allows federated data access from many systems allowing Partners to use data from SAP Business applications ( S/4, Success Factors, Ariba etc) or Non SAP Business applications with other datasets on varied on premise/cloud environements to produce powerful Business reporting applications in SAP Analytics cloud, which now also provides inbuilt Gen AI capability with Just Ask.

 Below discovery mission includes details on how customers & partners can use data from AWS, Azure, and Google Cloud with the federation capabilities of SAP Datasphere.

  Discovery Mission : Explore your Hyperscaler data with SAP Datasphere 

  Video : SAP Datasphere 

  Try & Experience SAP Datasphere

 

SAP Build Code 

Build Code will provide “Joule” assistant for faster application development by generating code, data models & by providing Guided experience for developers.

 

 

Example Use Cases

Semantic search app

Following is a sample search application deployed on Cloud foundry using Python Build pack. A csv of all documents uploaded to sharepoint (or sap workzone) was extracted (typically using the "Reports" section which extracts the list of docs, url, num of clicks, Title, decription etc). This is then processed in python and the Text from Title & description is merged and tokenized. The tokenized text for all docs is then converted into a TF-IDF Matrix (for Term based search which is the default option in below app screen) and also converted to Vector Embeddings using Google BERT model for  contextual search.

When a user puts in a query its processed to removed white spaces , special characters etc, tokenized and then compared with the existing Matrices for TF-IDF or Embeddings using Cosine Similarity to retrieve the top matching documents

The missing piece in the architecture below is a Vector database to store the text embeddings as a persistent layer. I have used a FAISS in memory index which is loaded in memory when the app starts up. For full fledged guidance from SAP on such architectures refer the Reference Architecture

VinayBhatt_0-1708053712083.png

 

VinayBhatt_1-1708053855634.png

To understand what contextual search means here let's look at an example, Let's say a user searches for  "Aviation Industry relared demo & presentation content" , the results will include all documents which are close in the embedding space example Demos related to Airlines, Flights , Airport Management, Airport ground operation management etc.

VinayBhatt_2-1708053913535.png

BTP Solution Components

AI core / BTP CF Runtime python buildpack(Python API), docker image

AI Launchpad : ML Ops , orchestration and monitoring of deployed API.

SAP Build Apps : Frontend

SAP BTP Object Store : CSV extracts store

HANA Cloud Vector database : Text embeddings / similarity search

 

Zero Shot Classification using LLM

Following is another example wherein I tried Zero Shot classification using a GPT model orchestrated using SAP Gen AI Hub ( SAP AI Core/Launchpad)

Here users are using SAP Analytics cloud to visualize the Average Co2 on a dashboard based on an analysis of their spend at various vendors/retails and across various transaction descriptions. As there are too many descriptions the dashboard is not very intuitive, we then call AI Core GPT proxy to categorize transactions to fixed Categories like Retail,Accomodation, Food etc. using a prompt like below : 

PROMPT

Here we are asking the GPT model to assign close to 66 transaction descriptions into 13 categories, the Index of the data will be preserved and will be later used to create the mapping in the data model.

 

 

Categorize the numerized descriptions below into the 13 categories ['Agricultural Services' 'Contracted Services' 'Airlines' 'Car Rental'
 'Lodging' 'Transportation Services' 'Utility Services'
 'Retail Outlet Services' 'Clothing Stores' 'Miscellaneous Stores'
 'Business Services' 'Professional Services and Membership Organizations'
 'Government Services'].

Display the result in a table with the format "| INDEX OF DESCRIPTION | CATEGORY |".
Descriptions:
| 0 | Meat Provisioners – Freezer and Locker |
| 1 | Grocery Stores, Supermarkets |
| 2 | Cable and other pay television (previously Cable Services) |
| 3 | Digital Goods: Media, Books, Movies, Music |
| 4 | Financial Institutions – Manual Cash Disbursements |
| 5 | Sporting Goods Stores |
| 6 | Service Stations ( with or without ancillary services) |
| 7 | Financial Institutions – Merchandise and Services |
| 8 | Eating places and Restaurants |
| 9 | Household Appliance Stores |
| 10 | Drugs, Drug Proprietors, and Druggist’s Sundries |
| 11 | Glass, Paint, and Wallpaper Stores |
| 12 | Petroleum and Petroleum Products |
| 13 | Taxicabs and Limousines |
| 14 | Book Stores |
| 15 | Drug Stores and Pharmacies |
| 16 | Candy, Nut, and Confectionery Stores |
| 17 | Veterinary Services |
| 18 | Miscellaneous and Specialty Retail Stores |
| 19 | Money Orders – Wire Transfer |
| 20 | Shoe Stores |
| 21 | Lodging – Hotels, Motels, Resorts, Central Reservation Services (not elsewhere classified) |
| 22 | Family Clothing Stores |
| 23 | Miscellaneous Home Furnishing Specialty Stores |
| 24 | Fast Food Restaurants |
| 25 | Caterers |
| 26 | Local/Suburban Commuter Passenger Transportation – Railroads, Feries, Local Water Transportation. |
| 27 | Misc. Food Stores – Convenience Stores and Specialty Markets |
| 28 | Legal Services and Attorneys |
| 29 | Men’s Women’s and Children’s Uniforms and Commercial Clothing |
| 30 | Civic, Fraternal, and Social Associations |
| 31 | Department Stores |
| 32 | Orthopedic Goods Prosthetic Devices |
| 33 | Telecommunications Equipment including telephone sales |
| 34 | Nurseries – Lawn and Garden Supply Store |
| 35 | Package Stores – Beer, Wine, and Liquor |
| 36 | Men’s and Women’s Clothing Stores |
| 37 | Computers, Computer Peripheral Equipment, Software |
| 38 | Dairy Products Stores |
| 39 | Membership Organizations ( Not Elsewhere Classified) |
| 40 | Equipment Rental and Leasing Services, Tool Rental, Furniture Rental, and Appliance Rental |
| 41 | Watch, Clock, Jewelry, and Silverware Stores |
| 42 | Travel Agencies and Tour Operations |
| 43 | Laundry, Cleaning, and Garment Services |
| 44 | Commercial Footwear |
| 45 | Card Shops, Gift, Novelty, and Souvenir Shops |
| 46 | Digital Goods: Games |
| 47 | Hardware Stores |
| 48 | Cigar Stores and Stands |
| 49 | Bakeries |
| 50 | Membership Clubs (Sports, Recreation, Athletic), Country Clubs, and Private Golf Courses |
| 51 | Recreation Services (Not Elsewhere Classified) |
| 52 | Women’s Ready-to-Wear Stores |
| 53 | Women’s Accessory and Specialty Shops |
| 54 | Tax Payments |
| 55 | Management, Consulting, and Public Relations Services |
| 56 | Drinking Places (Alcoholic Beverages), Bars, Taverns, Cocktail lounges, Nightclubs and Discotheques |
| 57 | News Dealers and Newsstands |
| 58 | Ambulance Services |
| 59 | Industrial Supplies, Not Elsewhere Classified |
| 60 | Computer Software Stores |
| 61 | Motion Picture Theaters |
| 62 | Cosmetic Stores |
| 63 | Electronic Sales |
| 64 | Hospitals |
| 65 | Miscellaneous Publishing and Printing |
| 66 | Wholesale Clubs |

 

 

RESULTS: 

As you see in the results 66 Indexes are now assigned to 13 Categories or transaction descriptions: 

 

 

This classification is based on the provided categories and the details of the descriptions:

| INDEX OF DESCRIPTION | CATEGORY |
|----------------------|-------------------------------------|
| 0 | Retail Outlet Services |
| 1 | Retail Outlet Services |
| 2 | Utility Services |
| 3 | Retail Outlet Services |
| 4 | Financial Institutions |
| 5 | Retail Outlet Services |
| 6 | Retail Outlet Services |
| 7 | Business Services |
| 8 | Retail Outlet Services |
| 9 | Retail Outlet Services |
| 10 | Retail Outlet Services |
| 11 | Retail Outlet Services |
| 12 | Retail Outlet Services |
| 13 | Transportation Services |
| 14 | Retail Outlet Services |
| 15 | Retail Outlet Services |
| 16 | Retail Outlet Services |
| 17 | Professional Services and Membership Organizations |
| 18 | Miscellaneous Stores |
| 19 | Financial Institutions |
| 20 | Clothing Stores |
| 21 | Lodging |
| 22 | Clothing Stores |
| 23 | Retail Outlet Services |
| 24 | Retail Outlet Services |
| 25 | Retail Outlet Services |
| 26 | Transportation Services |
| 27 | Retail Outlet Services |
| 28 | Professional Services and Membership Organizations |
| 29 | Clothing Stores |
| 30 | Professional Services and Membership Organizations |
| 31 | Retail Outlet Services |
| 32 | Retail Outlet Services |
| 33 | Retail Outlet Services |
| 34 | Agricultural Services |
| 35 | Retail Outlet Services |
| 36 | Clothing Stores |
| 37 | Retail Outlet Services |
| 38 | Retail Outlet Services |
| 39 | Professional Services and Membership Organizations |
| 40 | Contracted Services |
| 41 | Retail Outlet Services |
| 42 | Professional Services and Membership Organizations |
| 43 | Professional Services and Membership Organizations |
| 44 | Clothing Stores |
| 45 | Retail Outlet Services |
| 46 | Retail Outlet Services |
| 47 | Retail Outlet Services |
| 48 | Retail Outlet Services |
| 49 | Retail Outlet Services |
| 50 | Professional Services and Membership Organizations |
| 51 | Recreation Services |
| 52 | Clothing Stores |
| 53 | Clothing Stores |
| 54 | Government Services |
| 55 | Professional Services and Membership Organizations |
| 56 | Retail Outlet Services |
| 57 | Retail Outlet Services |
| 58 | Professional Services and Membership Organizations |
| 59 | Retail Outlet Services |
| 60 | Retail Outlet Services |
| 61 | Recreation Services |
| 62 | Retail Outlet Services |
| 63 | Retail Outlet Services |
| 64 | Professional Services and Membership Organizations |
| 65 | Retail Outlet Services |
| 66 | Retail Outlet Services |

Note: There were some descriptions that didn't fit perfectly into any of the provided categories. For these, the closest match was chosen based on the context. For example, "Financial Institutions – Manual Cash Disbursements" and "Financial Institutions – Merchandise and Services" were assigned to "Financial Institutions", which is not present in the provided categories but seems the most appropriate based on the description.

 

 

The AI Core code calls GPT to map the transaction descriptions to the outcome categories & the results are then processed and saved back in the HANA cloud database. The SAC live connection then pulls the updated records  in a new simplified dashboard.

VinayBhatt_0-1708056237744.png

Below is a simpler dashboard with lesser categories after update from GPT : 

VinayBhatt_1-1708056525314.png

BTP Solution Components

AI core & Gen AI Hub : App logic in Python in a docker image(GPT call / prompt management) 

AI Launchpad : ML Ops , operations monitoring of deployed API.

SAP Analytics Cloud : Frontend

 

AI QUIZ APP

Following is a sample quiz application which uses Gen AI to create Multiple Choice Question & Answers , using product specific or organization specific scenarios. Quizes can be generated in JSON format using a LLM and then served using a Frontend application. 

PROMPT

In the prompt we have provided a JSON template for the response, GPT model will return question/answer pair in this template , making it easier to directly use this in the frontend application.

 

 

using the below text as context : 

"
What Is Edge Integration Cell
Edge Integration Cell is an optional hybrid integration runtime offered as part of SAP Integration Suite, which enables you to manage APIs and run integration scenarios within your private landscape.
The hybrid deployment model of Edge Integration Cell enables you to:
* Design and monitor your integration content in the cloud.
* Deploy and run your integration content in your private landscape.
To learn more about how hybrid deployment works using Edge Integration Cell, see Hybrid Deployment Using Edge Integration Cell.
To compare hybrid deployment with the standard deployment model of SAP Integration Suite, see Standard Deployment in the Cloud.
Edge Integration Cell supports the following use cases:
* Security or compliance use cases
In many enterprises, sensitive data must be managed and controlled inside the enterprise's firewall. In addition, there could be strict architectural restrictions and you want to keep your data within your private landscape.
* Getting a migration path for SAP Process Integration customers
SAP Process Integration is used by many customers for ground-to-ground integration scenarios. Edge Integration Cell allows these customers to benefit from the newest innovations that come with SAP Integration Suite, with the option to design and monitor integration content in the cloud, and deploy and run their scenarios exclusively in their private landscapes.
Note
If you want to use integration flows to integrate your on-premise applications, you can use SAP Process Orchestration in addition to SAP Integration Suite. SAP Integration Suite comes with a set of runtime profiles that make sure that the integration flow editor allows you to design only those features that are supported by the runtime components of a specific SAP Process Orchestration release.
For more information, see Runtime Profiles.
However, this option requires you to install a separate product, SAP Process Orchestration, for processing and monitoring messages.
Using Edge Integration Cell, you can manage all tasks – from integration design up to processing and monitoring the scenario – within one service: SAP Integration Suite.

In both cases, we recommend using a hybrid integration approach for enterprise-wide connectivity.
For more information about the supported features and limitations of Edge Integration Cell, see Edge Integration Cell Runtime Scope.
"

Generate five multiple choice question answer set output as a single JSON code, using below template , the link property of the JSON should default to the url: “link":"https://help.sap.com/docs/integration-suite/sap-integration-suite/what-is-sap-integration-suite-edge-integration-cell”

{
            "type": "multiple",
            "difficulty": "easy",
            "category": “SAP BTP - Edge”,
            "question": “What is fundamental technology behind ChatGPT”,
            "correct_answer": “Generative AI”,
            "incorrect_answers": [
                "Its cool",
                "Ethanol",
                "Formaldehyde"
            ],
            "link":""

 

 

Test the Response using different LLM models on Gen AI Hub , here we have the opportunity to maintain our prompts.

VinayBhatt_1-1708060250367.png

The generated questions JSON can be saved in a GIT repo and exposed as an API using Python Flask/Fast API on cloud foundry buildpack. Frontend Application here is built on React. Here is a reference Quiz Open source App which can be customized to read from a Private API instead of Open Trivia Database : GIT

VinayBhatt_0-1708170480571.png

 

BTP Solution Components

AI core & Gen AI Hub : App logic in Python in a docker image(GPT call / prompt management) 

AI Launchpad : ML Ops , operations and monitoring of deployed API.

React App: FrontendDeployed on Cloud foundry Node buildpack. 

Conclusion

SAP BTP has a powerful platform to quickly build highly scalable applications and further infuse Gen AI using the technologies & products that we explored in this article. I'm happy to collaborate and provide more inputs on any of the applications I have presented in the use cases section.<Please note that these were self initiated projects for personal learning and development >.

2 Comments