Skip to main content
Integration

Exploring the capabilities of ChatGPT in SAP Ecosystem

Ravi Kant Ranjan Ravi Kant Ranjan, Principal Developer - SAP Fiori, BTP 3 min read

The blend of AI into ERP is going wild these days, as organizations are looking for ways to enhance productivity, improve customer experience, and streamline operations. OpenAI’s ChatGPT has developed an excellent performance, making it a powerful language model that generates answers in the form of human-like text. Below, we explore the capabilities of ChatGPT in the SAP Ecosystem.

Connecting to ChatGPT API

  • Create a user account at https://beta.openai.com/signup/
  • Once you sign up, you can explore the API documentation, Libraries, Models, Error handling, Security, and Compliances.

OpenAI platform overview page with Quickstart tutorial and Examples cards

  • Create your API Key by selecting your profile in the top right corner >> ‘View API Keys’.

OpenAI profile menu open with the View API keys option highlighted

  • Click ‘Create new secret key’ as shown in the image below.

OpenAI API keys page with the Create new secret key button highlighted

  • A new dialog box will appear. Enter the name of your secret key, and then click on the ‘Create Secret Key’ button.

Create new secret key dialog with an optional Name field and Create secret key button

  • Copy your secret key and keep it safely in your vault. Your secret key has now been generated. In this case, you can see my generated secret key in the image below.

OpenAI API keys list showing a masked key named RaviChatGPT created Jun 8, 2023

  • Our secret key is ready with us. Now it’s time to test the ChatGPT API. We will need the Postman tool or any other API testing tool for this. Here I am going with the Postman tool.
  • Click on the API Reference tab >> then click the ‘Making Request’ option.
  • Copy the API URL and body as marked in the image and paste the URL and body section into the Postman tool.
  • Select the operation as POST.

OpenAI API reference Making requests page with the chat completions URL and JSON body marked

  • In the body object, replace the value of the content property with your query text to ChatGPT. I have put my query text as “Write an email to my manager for a leave request.” See the image below.

Postman POST request to the chat completions endpoint with a raw JSON body asking for a leave email

  • In the Authorization tab in Postman, select the authorization type as Bearer Token and paste your secret key in the input box.

Postman Authorization tab with Bearer Token selected and a token field for the secret key

  • Now hit the Send button in the post to run your ChatGPT API. You receive the response in JSON format. Below is my response.

JSON response from gpt-3.5-turbo containing a drafted leave request email

Cool! Isn’t it? Give it a try. It’s easy.

This is how we can test and try the ChatGPT API endpoint. You can also use this API directly in any programming language application. In my next blog, I will show how you can integrate your ChatGPT service with SAP.

Happy Learning!

If you have an interest in viewing similar content, visit our blog, here.

View our LinkedIn, here.

Share