📄 Page
1
Generative AI with SAP and Amazon Bedrock Utilizing GenAI with SAP and AWS Business Use Cases — Miguel Figueiredo
📄 Page
2
Generative AI with SAP and Amazon Bedrock Utilizing GenAI with SAP and AWS Business Use Cases Miguel Figueiredo
📄 Page
3
Generative AI with SAP and Amazon Bedrock: Utilizing GenAI with SAP and AWS Business Use Cases ISBN-13 (pbk): 979-8-8688-0967-5 ISBN-13 (electronic): 979-8-8688-0968-2 https://doi.org/10.1007/979-8-8688-0968-2 Copyright © 2025 by Miguel Figueiredo This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: James Robinson-Prior Development Editor: James Markham Coordinating Editor: Gryffin Winkler Cover designed by eStudioCalamar Cover image by geralt @ Pixabay.com Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY 10004, U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail booktranslations@springernature.com; for reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com. Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales web page at http://www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub (https://github.com/Apress). For more detailed information, please visit https://www.apress.com/gp/services/source-code. If disposing of this product, please recycle the paper Miguel Figueiredo Sao Paulo, São Paulo, Brazil
📄 Page
4
To my wife, son, and daughter, my greatest purpose.
📄 Page
5
v About the Author ���������������������������������������������������������������������������������xi About the Technical Reviewers ���������������������������������������������������������xiii Acknowledgments ������������������������������������������������������������������������������xv Introduction ��������������������������������������������������������������������������������������xvii Preface ����������������������������������������������������������������������������������������������xxi Chapter 1: Introduction to Artificial Intelligence ����������������������������������1 Machine Learning �������������������������������������������������������������������������������������������������2 Deep Learning �������������������������������������������������������������������������������������������������������2 NLP ������������������������������������������������������������������������������������������������������������������������2 A Brief History of NLP��������������������������������������������������������������������������������������������3 Computer Vision ����������������������������������������������������������������������������������������������������4 The Beginning of AI �����������������������������������������������������������������������������������������������5 Advances in Technology ����������������������������������������������������������������������������������9 Current Status of AI ���������������������������������������������������������������������������������������������12 Transforming Industries with Generative AI ���������������������������������������������������13 The Rise of Large Language Models �������������������������������������������������������������14 Transformer Architecture �������������������������������������������������������������������������������15 Attention ��������������������������������������������������������������������������������������������������������16 Encoders and Decoders ���������������������������������������������������������������������������������17 Foundation Models ����������������������������������������������������������������������������������������18 Traditional ML vs� Foundation Models �����������������������������������������������������������18 Table of Contents
📄 Page
6
vi Google’s BERT������������������������������������������������������������������������������������������������22 Google’s BARD �����������������������������������������������������������������������������������������������23 Google Gemini �����������������������������������������������������������������������������������������������23 Differences Between Google’s BARD and Gemini ������������������������������������������24 OpenAI’s GPT �������������������������������������������������������������������������������������������������25 Midjourney �����������������������������������������������������������������������������������������������������26 OpenAI in the Spotlight ����������������������������������������������������������������������������������27 The OpenAI GPT Series ����������������������������������������������������������������������������������29 ChatGPT in the Spotlight ��������������������������������������������������������������������������������31 Amazon AIML �������������������������������������������������������������������������������������������������32 Amazon Bedrock �������������������������������������������������������������������������������������������33 Amazon Q Developer �������������������������������������������������������������������������������������40 Amazon EC2 Inf2 Instances Powered by AWS Inferentia2 Chips �������������������42 New Trn1n Instances, Powered by AWS Trainium Chips ��������������������������������42 SAP Joule ������������������������������������������������������������������������������������������������������43 SAP Build Code ����������������������������������������������������������������������������������������������45 SAP AI Foundation �����������������������������������������������������������������������������������������49 The Future of AI ���������������������������������������������������������������������������������������������������53 Chapter 2: GenAI in the Spotlight �������������������������������������������������������55 Reshaping Industries with Generative AI ������������������������������������������������������������55 The Pandemic and AI Disruptions �����������������������������������������������������������������������57 Unleashing AI as Never Before ����������������������������������������������������������������������59 Healthcare and Biotechnology �����������������������������������������������������������������������60 Finance and Investment ��������������������������������������������������������������������������������62 Information Technology ���������������������������������������������������������������������������������63 Communication Services �������������������������������������������������������������������������������65 Legal ��������������������������������������������������������������������������������������������������������������67 Digital Advertising �����������������������������������������������������������������������������������������67 Table of ConTenTs
📄 Page
7
vii Capital Goods�������������������������������������������������������������������������������������������������68 ChatGPT Spotlights GenAI �����������������������������������������������������������������������������������70 A Look at the Evolution of GPT Models ����������������������������������������������������������71 Ascension of Conversational AI Interfaces ����������������������������������������������������74 Pop Culture Influence ������������������������������������������������������������������������������������75 Revolutionizing Linguistic Education �������������������������������������������������������������75 AI Trends Shaping Pop Culture ����������������������������������������������������������������������76 An Exciting Era Unfolds ���������������������������������������������������������������������������������77 Chapter 3: Opportunities and Impacts of GenAI ���������������������������������85 The Impact of Generative AI on Modern Industries ���������������������������������������������86 Chest CT Images ��������������������������������������������������������������������������������������������87 Chest X-Rays �������������������������������������������������������������������������������������������������88 Predicting the Prognosis of COVID-19 �����������������������������������������������������������88 Predicting the Epidemic Trends of COVID-19 �������������������������������������������������90 Drug Discovery and Vaccine Development for COVID-19 ������������������������������91 Drug Repurposing ������������������������������������������������������������������������������������������91 Drug Development �����������������������������������������������������������������������������������������92 Vaccine Development ������������������������������������������������������������������������������������92 Enterprise Modernizing and Faster Coding ���������������������������������������������������������92 A New Hybrid World ���������������������������������������������������������������������������������������94 Getting Even Faster ���������������������������������������������������������������������������������������96 The Rise of Cyborgs ���������������������������������������������������������������������������������������97 The Secret Sauce ����������������������������������������������������������������������������������������101 Prompt Engineering ������������������������������������������������������������������������������������������102 What Is a Prompt? ���������������������������������������������������������������������������������������103 What Makes Prompt Engineering So Relevant? ������������������������������������������103 Which Use Cases Can Take Advantage? ������������������������������������������������������105 What Are Applied Techniques? ��������������������������������������������������������������������107 Table of ConTenTs
📄 Page
8
viii What About Best Practices? ������������������������������������������������������������������������111 Limitations and Concerns ���������������������������������������������������������������������������������112 The Asking Paradigm with GenAI Models ����������������������������������������������������113 Legal Concerns ��������������������������������������������������������������������������������������������115 Knowing Your Rights ������������������������������������������������������������������������������������115 More Concerns ��������������������������������������������������������������������������������������������116 Chapter 4: Getting Started with Amazon Bedrock ����������������������������127 Log in to AWS Console ��������������������������������������������������������������������������������������127 Working with Chat Playground ��������������������������������������������������������������������������133 Working with Image Playgrounds ���������������������������������������������������������������������146 Working with Image Playground (Advanced) ����������������������������������������������������159 Chapter 5: Getting Started with GenAI Using SAP BTP and Amazon Bedrock ������������������������������������������������������������������������173 Log in to the AWS Console ��������������������������������������������������������������������������������214 Launch Amazon SageMaker Studio ������������������������������������������������������������������217 Query SAP HANA Cloud �������������������������������������������������������������������������������������236 Integrate GenAI with SAP HANA Cloud ��������������������������������������������������������������248 Experiment with Langchain SQL Agent �������������������������������������������������������������268 Chapter 6: Building GenAI with SAP, Lambda, and Amazon Bedrock �����285 Analyze a SAP Report Using Generative AI ��������������������������������������������������������287 Integrate Generative AI with SAP HANA and PandasAI �������������������������������������300 Building Generative AI Using Lambda and API Gateway �����������������������������������320 Chapter 7: The AI Journey Gets Started… ����������������������������������������375 New Experiences ����������������������������������������������������������������������������������������������375 Productivity �������������������������������������������������������������������������������������������������������375 Insights �������������������������������������������������������������������������������������������������������������376 Table of ConTenTs
📄 Page
9
ix Creativity �����������������������������������������������������������������������������������������������������������376 Finance Manager ����������������������������������������������������������������������������������������������378 Accounts Payable Manager�������������������������������������������������������������������������������380 SAP Developer ��������������������������������������������������������������������������������������������������382 Order-to-Cash and Procure-to-Pay Insights ������������������������������������������������������386 AI-Powered Dashboard Authoring Experience ��������������������������������������������������388 SAP Business AI ������������������������������������������������������������������������������������������������389 ERP and Finance ������������������������������������������������������������������������������������������391 Human Resources ���������������������������������������������������������������������������������������391 Industries �����������������������������������������������������������������������������������������������������392 IT and Platforms ������������������������������������������������������������������������������������������392 Sourcing and Procurement ��������������������������������������������������������������������������394 Supply Chain ������������������������������������������������������������������������������������������������394 Generative AI Hub ����������������������������������������������������������������������������������������������394 SAP Interactive Value Journey ��������������������������������������������������������������������������398 SAP Road Map Explorer ������������������������������������������������������������������������������������400 Going Beyond with Generative AI ����������������������������������������������������������������������400 Transforming Manufacturing with AWS and SAP �����������������������������������������401 Working with SAP and AWS �������������������������������������������������������������������������402 Exploring the Strategic Value of Generative AI Beyond Productivity ������������403 Tangible Effects on Financial Operations ����������������������������������������������������403 Connecting Audiences Using a Prompt ��������������������������������������������������������404 Predicting with Generative AI ����������������������������������������������������������������������404 Redefining Customer Satisfaction ���������������������������������������������������������������405 Last, but Not Least ��������������������������������������������������������������������������������������������406 Index ���������������������������������������������������������������������������������������������������������407 Table of ConTenTs
📄 Page
10
xi About the Author Miguel Figueiredo is a passionate software professional with more than 30 years of experience in technical solution architecture. He has a degree in information systems and an MBA from Mackenzie University, as well as an international MBA in business administration from FIA Business School in partnership with Vanderbilt University. Miguel gained his experience delivering business intelligence solutions for several Fortune 500 companies and multiple global corporations. As the SAP HANA Services Center of Excellence leader, he was responsible for the evangelization and best-practice adoption of data management and business intelligence in his region. Currently, Miguel advises companies in maximizing value realization in their digital transformation journeys by adopting cloud initiatives. Miguel is dedicated to supporting his family and encouraging the development of good habits for health, both in body and mind.
📄 Page
11
xiii Lino Maggi is a leader with over 15 years of experience in cloud solution architecture, having worked at AWS, SAP, and Capgemini, where he sold impactful projects to Global 500 companies. With deep technical expertise, he focuses on multi-cloud digital transformations, optimizing hybrid infrastructures, and leading large-scale cloud migrations. Lino has also led teams in Generative AI projects, delivering concrete improvements in operational efficiency. His work spans industries such as Consumer Goods, Agribusiness, Manufacturing, and Mining, where he has architected ERP solutions affecting millions. Fluent in Portuguese, English, and Spanish, Lino holds an MBA in International Management and applies the discipline of a nationally-ranked karate athlete to his leadership in technology. Felipe Pojo is a recognized leader in AI and Machine Learning at Amazon Web Services (AWS), where he oversees the AI/ ML and Generative AI Go-to-Market strategy for Brazil. He holds a bachelor’s degree in Business Administration, an MBA in Business Management and Information Systems, and a recent specialization in Generative AI from MIT. About the Technical Reviewers
📄 Page
12
xiv With over nine years of experience as an AI/ML Sales Specialist, Felipe has deep expertise in areas like Conversational AI, Natural Language Processing (NLP), Voice and Speech recognition, Large Language Models (LLMs), Image Generation, and Advanced Analytics. He works with companies across sectors such as banking, telecom, and retail in Latin America, helping them develop intelligent systems that leverage data for automation and insights. His solutions enhance customer experience and drive digital transformation through technologies like contact center automation, document understanding, and predictive analytics. abouT The TeChniCal RevieweRs
📄 Page
13
xv A special thank you to Lino and Felipe, my partners in this incredible mission, for being responsible for a fantastic and essential technical review, enriching the book with their valuable insights. You guys are awesome! I am eternally grateful to my awesome wife, Alessandra, for listening to the first ideas about this book and for always trusting and giving me all the support I've needed in all these years together. Thank you so much, dear. What shall I say about my daughter Beatriz and my son Ethan? Both are extremely talented, responsible, creative, and competitive individuals who make me very proud. They encourage me to always raise the bar in my own work. For my family: This book is dedicated to my mom Ivanir Maciel and the memory of my dad Anselmo Figueiredo for always seeking to transmit their family values, for teaching us to believe in a greater God, for inspiring us, and for dedicating a large part of their lives to us, ensuring that we could fully develop as individuals and professionals. To my sisters Selma, Monica, and Regina and my brother Max: you are always with me in my thoughts. I want to thank everyone who has worked with me and contributed in any manner to my development. A very special thank you to everyone on the Apress team who helped me so much during the entire journey. Special thanks to Divya, the ever-patient Editor; and Laura Berendson, my amazing Development Editor. Finally, I want to express gratitude to you, the reader. Thank you! This book is for you. Good reading! Acknowledgments
📄 Page
14
xvii Introduction This book introduces generative AI and helps to develop an understanding of its key features, technology, architecture, and tangible business use cases with SAP and Amazon Bedrock. It should help you develop the skills needed to use the core features available in the SAP Business Technology Platform with Amazon Bedrock. This book covers concepts regarding large language models (LLMs) and should equip you with practical knowledge to unleash the best use of generative AI (GenAI). As you progress, you will learn how to get started with your own LLM models, understand how to work with different models, and work with generative AI for multiple use cases. Additionally, you will learn how to take advantage of Amazon Bedrock using AWS Lambda and API Gateway, SAP HANA Cloud, Langchain, SQL Agent, and Pandas AI. To fully leverage this knowledge, this book will provide practical step- by- step instructions on how to establish a cloud SAP BTP account model and create your first GenAI artifacts. The book is an important prerequisite for those who want to start with generative AI with SAP and Amazon Bedrock. This book is recommended for those who want to learn about GenAI with SAP, as it shows how to take full advantage of it and supports its practical implementation.
📄 Page
15
xviii This book contains the following chapters: Chapter 1: Introduction to Artificial Intelligence This chapter will help readers to understand new demands that have arise from the current digital transformation and how these changes affect business software needs. Along with this, it introduces how technologies like artificial intelligence (AI), natural language processing (NLP), and machine learning were disruptive during the pandemic. This chapter closes with an explanation of the status of AI. Chapter 2: GenAI in the Spotlight This chapter will help readers to understand what GenAI means, and discuss the popularization of the technology behind ChatGPT and OpenAI. Chapter 3: Opportunities and Impacts of GenAI The goal of this chapter is to help readers identify opportunities and impacts brought by generative AI in different areas. Chapter 4: Getting Started with Amazon Bedrock This chapter will help readers understand the playground area in Amazon Bedrock, as well as which resources and LLMs are available to start building your generative AI cases. Chapter 5: Getting Started GenAI with SAP BTP and Amazon Bedrock This chapter helps readers to explore the use of Amazon Sagemaker Notebook to integrate a generative artificial intelligence large language model (LLM) in order to improve the user's experience exploring their business data stored in SAP HANA Cloud. Chapter 6: Building GenAI with SAP Report, Lambda, and Amazon Bedrock This chapter helps readers understand how to take advantage of Amazon Bedrock to analyze SAP Report by using summarization features and leveraging Claude LLM to simulate a financial analyst. Also, it explores the capabilities of Pandas AI, SAP HANA Cloud, AWS Lambda, and API Gateway. inTRoduCTion
📄 Page
16
xix Chapter 7: The AI Journey Gets Started… This chapter should help readers to envision what to expect from GenAI and offers useful resources and knowledge sources to support continuous research in the field of AI related to SAP use cases. For the best results understanding this book, I recommend starting with Chapter 1 and reading through the book sequentially. inTRoduCTion
📄 Page
17
xxi Preface In July of 2022, I got started as an SAP sales specialist working at AWS with the goal of growing business related to SAP migration and modernization for many customers in different areas. It is not very well known that in January 2021, SAP launched an offering called RISE with SAP to help companies seize the advantages of cloud computing in their mission- critical, core systems. This offering has been important, as it accelerates the modernization of SAP customers and makes it possible to have positive discussions about modern architecture jointly using the SAP and AWS platforms. With the first book I published, I was 100% dedicated to many agendas and situations most new employees have during the first year with a company, identifying which mechanisms would be potentially responsible for helping me achieve my goals. The year 2022 was tremendous for me, but 2023 promised to be an even bigger deal, bringing with it new reorganization and challenging goals. Even though my focus on supporting customers in their journey stayed the same, some good opportunities presented themselves and once again I was able to achieve my goals, ending up with some good stories to share. However, within that year, the conversations around the subject of generative AI were gaining relevance that extended to the context of SAP. GTM teams were able to generate pitches and collaterals in a couple of weeks, which supported corporate messages, empowered by GenAI, seeking a change in existing business processes in pursuit of more productivity and new ways to envision and perform business functions.
📄 Page
18
xxii In January 2024, many research and market analysis institutes released content about AI. A Gartner publication predicted that global spending on AI software would surge from $124 billion in 2022 to $297 billion in 2027, and the market was expected to grow at a 19.1% compound annual growth rate for the next six years. According to this prediction, GenAI's rapid growth could be attributed to enterprise software vendors integrating AI tools into current and future releases, streamlining the widespread adoption of GenAI-based features and new apps. The same prediction holds that GenAI will eventually become a cornerstone of all AI software spending, reaching 35% of worldwide revenues by 2027. Having reached 2024, following all the recent progress of AI, I have no doubt that all projections will continue to shape a promising scenario. This has piqued the interest of most company leaders, who wish to take advantage of GenAI capabilities with SAP and open opportunities far beyond simply migrating their SAP system to a cloud provider. It is my belief that if you can make practical use of this essential learning to support your journey using generative AI with SAP and Amazon Bedrock, the investment you made will have paid off. Think big! Writing a book is not an easy task, and the challenge is even harder when the subject changes so fast, as is the case with generative AI. So, don't be surprised if at the time of reading, some aspects of the topics covered have changed or been updated. PRefaCe
📄 Page
19
1© Miguel Figueiredo 2025 M. Figueiredo, Generative AI with SAP and Amazon Bedrock, https://doi.org/10.1007/979-8-8688-0968-2_1 CHAPTER 1 Introduction to Artificial Intelligence Artificial intelligence (AI) is a branch of computer science that centers on developing machines that can carry out tasks usually associated with intelligence, like voice recognition and decision-making abilities without the need for intervention or control mechanisms in place for them to operate effectively. According to John McCarthy, intelligence development is the science and engineering behind creating machines, specifically intelligent computer programs that have the capability to reason and make decisions autonomously without relying solely on observable methods, like in a science such as biology. This description encapsulates the ideas and intricacies of intelligence enough, but there a simpler explanation too. The folks at IBM put it plainly as follows: “Artificial intelligence is a blend of computer science and rich data sets used to tackle problems.” AI aims to simulate human-like thinking and decision-making processes. It involves the creation of algorithms and models that enable machines to perceive, reason, learn, and make decisions. AI can be divided into two categories: narrow AI and general AI. • Narrow AI: Focuses on specific tasks and is prevalent in various applications today • General AI: Refers to machines that possess human- like intelligence across a wide range of tasks
📄 Page
20
2 Machine Learning Machine learning (ML) is a subset of AI that focuses on the development of algorithms and models that allow computers to learn and improve from experience without being explicitly programmed. ML algorithms analyze large datasets to identify patterns and make predictions or decisions based on those patterns. It relies on statistical techniques to automatically learn from data and adapt its performance. ML can be categorized into three types: supervised learning, unsupervised learning, and reinforcement learning. Deep Learning Deep learning is a subfield of ML that employs artificial neural networks to model and understand complex patterns and relationships within data. Deep learning algorithms are inspired by the structure and function of the human brain, consisting of multiple layers of interconnected nodes (neurons). These networks are capable of learning hierarchical representations of data, enabling them to extract high-level features from raw input. Deep learning has achieved significant breakthroughs in various domains, including computer vision and natural language processing (NLP). NLP Machines that use natural language processing (NLP) technology, a branch of AI, can interact with humans using language meaningfully by interpreting and generating human language data, for tasks such as text classification and sentiment analysis, language translation, question answering, and speech recognition. NLP combines methods, from the fields of linguistics, machine learning, and deep learning to handle and examine text data effectively. Chapter 1 IntroduCtIon to artIfICIal IntellIgenCe