Demo
English
Header Background Shapes Blue

How to Integrate OpenAI in Semarchy xDM in Five Minutes: Step-by-Step Guide

ai blog 4

As mentioned in our first, and second, and third blogs, Semarchy is bullish on the opportunities AI can provide as a copilot to our Master Data Management stakeholders. 

We have had pre-packaged AI/ML capabilities since 2014, and purposefully designed an open and constructive architecture that allows you to easily leverage any state-of-the-art solution. This is the same leading approach used by the top LLMs in the market, in contrast to the approach leveraged by some of the other MDM vendors which forces you into their proprietary, black-box models and constrains your options for the future.

Today, we are taking a break from opinions to focus on providing you a step-by-step guide on integrating OpenAI in xDM in just five minutes.

Let’s begin!

1. Get an OpenAI API Key

Login or create an account with OpenAI, then go to your account page to create an API Key. Copy this API Key.

login view app key
api keys

2. Create a ChatGPT REST Client

Create a new Rest Client, named ChatGPT, with the following parameters. 

Ad Banner - Manage Your Diverse Data With Ease

Leave the other parameters as is.

TIP: You can copy and paste the REST Client code below and configure the HTTP Headers with your API Key.  

{
  "name" : "ChatGPT",
  "label" : "Chat GPT",
  "description" : "Queries OpenAI's model to generate text based on a prompt.\n",
  "errorSelector" : null,
  "timeout" : 5000,
  "maxRetries" : 0,
  "successStatusCodes" : "2xx",
  "httpMethod" : "POST",
  "requestUrl" : "https://api.openai.com/v1/completions",
  "requestHeaders" : "Content-Type:application/json\nAuthorization:Bearer YOUR_API_KEY",
  "requestBodyFormat" : "JSON",
  "requestBody" : "{\n  \"model\": \"gpt-3.5-turbo\",\n  \"prompt\": ${prompt},\n  \"max_tokens\": 4000,\n  \"temperature\": 1.0\n}",
  "requestInputs" : [ {
    "name" : "Prompt",
    "label" : "Prompt",
    "description" : "ChatGPT Query. For example: \"Describe \".",
    "dataType" : "STRING"
  } ],
  "responseOutputs" : [ {
    "name" : "Response",
    "label" : "Response",
    "description" : "Response from ChatGPT",
    "dataType" : "STRING",
    "valueSelector" : "$.choices[0].text",
    "onAbsentValueBehavior" : "FAIL",
    "onDataTypeMismatchBehavior" : "FAIL",
    "defaultValue" : null
  } ]
}

3. Create an HTTP Request

Use the code below to create an HTTP Request we can call with our xDM enricher.

  • Method: POST
  • URL: https://api.openai.com/v1/completions
  • HTTP Headers (make sure to use your API Key here):
    Content-Type:application/json
    Authorization:Bearer YOUR_API_KEY
  • Body:
    {
      “model”: “gpt-3.5-turbo”,
      “prompt”: ${Prompt},
      “max_tokens”: 4000,
      “temperature”: 1.0
    }

NOTE: See the OpenAI API Reference for more details about the models and various parameters you can use in your request.

4. Detect Prompt Inputs and Format Prompt Outputs

For Inputs: In xDM, use the Detect Inputs button to create the Prompt Input.

For Outputs: Create the following output, leaving all other properties as is.

  • Name: Response
  • Value Selector: $.choices[0].text

Your REST Client definition should look like the picture below.

rest client definition window

5. Testing the OpenAI REST Client in App Builder

To test your REST Client, you can use a simple prompt for the input value, such as “Define Master Data.”

If configured correctly, the output response should return a value using the API request from OpenAI – similar to the screenshot below.

openai rest client response 1

Using the OpenAI REST Client in xDM

In xDM, define an enricher using this REST Client. Be as specific as possible in your prompt to produce the best results. In the example below, we want to leverage OpenAI inside our Product Retail MDM sample model. 

We want ChatGPT to help us generate the Description attribute of the product from the Name attribute using the following prompt:

Describe ‘ || Name || ‘ in 20 words’

ai description window

You can now use this enricher in your xDM data model or applications.

Voila! 

It took five minutes to easily integrate OpenAI’s ChatGPT capabilities into xDM. That is the power of our open, constructive architecture that enables you to leverage any AI/ML solution. 

Live Example of ChatGPT Inside xDM

Here is an example using ChatGPT’s generative AI capabilities to automatically create product descriptions to augment your users’ MDM workflow.

ai product creation

Five Minutes to Leverage State-of-the-Art AI/ML Capabilities in xDM

You can see how simple it is to leverage leading AI/ML capabilities like ChatGPT with Semarchy xDM. With our open, constructive architecture, you have complete flexibility to choose whatever AI/ML capability best fits your use case. 

That is why this is the leading approach to leveraging AI/ML to augment your MDM needs.

However, even if we make it incredibly easy to integrate AI/ML capabilities into your MDM, overcoming the other obstacles to implementing AI is not as simple. 

In our final blog, we will come even closer to reality and provide you with the best practices on how to overcome these challenges so you can accelerate your AI ambitions today.

If you are itching to get started and need the most recommended and trusted data leader as your partner, we would love to chat.

-FX